<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flock of Cats</title>
	<atom:link href="http://www.flockofcats.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flockofcats.com</link>
	<description>Politics, Video Games, Japan, Random Stuff, Etc</description>
	<lastBuildDate>Thu, 31 Dec 2009 12:03:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>BlackJack</title>
		<link>http://www.flockofcats.com/sneaky/stuff/blackjack/</link>
		<comments>http://www.flockofcats.com/sneaky/stuff/blackjack/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 11:22:01 +0000</pubDate>
		<dc:creator>sneaky</dc:creator>
				<category><![CDATA[Stuff]]></category>

		<guid isPermaLink="false">http://www.flockofcats.com/?p=886</guid>
		<description><![CDATA[I made a blackjack game in C++. You can click the link to download the game (probably only works on windows). You can see the source code after the jump.


#include &#60;iostream&#62;		//for basic input/output
#include &#60;string&#62;		//for strings
#include &#60;cstdlib&#62;		//for...I forgot...the random number?
#include &#60;ctime&#62;		//for seeding random number with clock
#include &#60;windows.h&#62;	//for colors
#include &#34;colors.h&#34;		//include color definitions

using namespace std;

#define HEARTS &#34;H&#34;		//define suits
#define [...]]]></description>
			<content:encoded><![CDATA[<p>I made a <a href="http://www.flockofcats.com/Blackjack.exe">blackjack game in C++</a>. You can click the link to download the game (probably only works on windows). You can see the source code after the jump.</p>
<p><span id="more-886"></span></p>
<pre class="brush: cpp;">
#include &lt;iostream&gt;		//for basic input/output
#include &lt;string&gt;		//for strings
#include &lt;cstdlib&gt;		//for...I forgot...the random number?
#include &lt;ctime&gt;		//for seeding random number with clock
#include &lt;windows.h&gt;	//for colors
#include &quot;colors.h&quot;		//include color definitions

using namespace std;

#define HEARTS &quot;H&quot;		//define suits
#define DIAMONDS &quot;D&quot;
#define CLUBS &quot;C&quot;
#define SPADES &quot;S&quot;

void clear_screen ( void )	//Function to clear the screen
{
  DWORD n;                         /* Number of characters written */
  DWORD size;                      /* number of visible characters */
  COORD coord = {0};               /* Top left screen position */
  CONSOLE_SCREEN_BUFFER_INFO csbi;

  /* Get a handle to the console */
  HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );

  GetConsoleScreenBufferInfo ( h, &amp;csbi );

  /* Find the number of characters to overwrite */
  size = csbi.dwSize.X * csbi.dwSize.Y;

  /* Overwrite the screen buffer with whitespace */
  FillConsoleOutputCharacter ( h, TEXT ( ' ' ), size, coord, &amp;n );
  GetConsoleScreenBufferInfo ( h, &amp;csbi );
  FillConsoleOutputAttribute ( h, csbi.wAttributes, size, coord, &amp;n );

  /* Reset the cursor to the top left position */
  SetConsoleCursorPosition ( h, coord );
}

struct card {  //info for one card
string face;
string suit;
int value;

};

void make_deck(card deck[]) { //fill the deck with cards

card * deck_p;

deck_p=deck;
int counter=0;
for (int i=0; i&lt;4; i++){
	for (int j=0; j&lt;13; j++){

		if (j==0) { deck_p-&gt;value = 11; deck_p-&gt;face = &quot;A&quot;;}
		if ((j&gt;0) &amp;&amp; (j&lt;9)) {deck_p-&gt;value = j+1; deck_p-&gt;face = j+49;}
		if (j==9) { deck_p-&gt;value = 10; deck_p-&gt;face = &quot;10&quot;;}
		if (j==10) { deck_p-&gt;value = 10; deck_p-&gt;face = &quot;J&quot;;}
		if (j==11) { deck_p-&gt;value = 10; deck_p-&gt;face = &quot;Q&quot;;}
		if (j==12) { deck_p-&gt;value = 10; deck_p-&gt;face = &quot;K&quot;;}

		if (i==0) {deck_p-&gt;suit = HEARTS;}
		if (i==1) {deck_p-&gt;suit = DIAMONDS;}
		if (i==2) {deck_p-&gt;suit = CLUBS;}
		if (i==3) {deck_p-&gt;suit = SPADES;}
		deck_p++;
			}
		}
}

void shuffle_deck(card deck[]) { // exchange two cards (SHUFFLE number of times)

	card temp;
	const int SHUFFLE = 200;	//define number of shuffles
    int random1=0;
	int random2=0;
    int lowest=0, highest=51;
    int range=(highest-lowest)+1;

	for (int n=0; n&lt; SHUFFLE; n++) {
		random1 = lowest+int(range*rand()/(RAND_MAX + 1.0));
		random2 = lowest+int(range*rand()/(RAND_MAX + 1.0));
	temp = deck[random1];
	deck[random1]=deck[random2];
	deck[random2]=temp;
	}
	cout &lt;&lt;endl &lt;&lt; &quot;New deck!! Shuffling!&quot; &lt;&lt;endl&lt;&lt;endl;
	Sleep(1000);
}

class hand_c { //define class for manipulating player and dealer hands

	card hand[20];	//I tried to make this a dynamic array but gave up and just defined a constant array of 20, which is more than enough for a Blackjack hand
	int ace_count;	//For counting number of aces to adjust value to 1 or 11
	int hand_value;	//Total value of hand

public:
	int hand_count;	//Number of cards in hand
	bool blackjack;	//True if hand is Blackjack

int calc_hand_value () {  //function for calculating value of hand

	hand_value=0;
	ace_count=0;

	for (int j=0; j&lt;hand_count; j++)
		hand_value+=hand[j].value;

	for (int k=0; k&lt;hand_count; k++) {
		if (hand[k].face==&quot;A&quot;)
			ace_count++; }
	for (int m=1; m&lt;=ace_count; m++)
	{if (hand_value &gt; 21) hand_value-=10;} //subtract 10 for each ace if hand value is over 21, thus taking ace as 1

	return (hand_value);

}

int hidden_hand_value () {	//calculate the value excluding first card

	hand_value=hand[1].value;

	return (hand_value);

}

void get_deal(card deck[], int &amp;dealt_cards) {	//perform initial deal of two cards to player and dealer

	hand_count=0;
	hand_value=0;
	blackjack=false;

	if (dealt_cards == 52) {		//check that there are enough cards, if not, shuffle new deck
			make_deck(deck);
			shuffle_deck(deck);
			dealt_cards=0;
			cout &lt;&lt;endl &lt;&lt; &quot;...New deck!! Re-shuffling!&quot; &lt;&lt;endl&lt;&lt; endl;
			Sleep(1000);}

	hand[0]=deck[dealt_cards];	//deal first card
	dealt_cards++;
	hand_count++;

	if (dealt_cards == 52) {
			make_deck(deck);
			shuffle_deck(deck);
			dealt_cards=0;
			cout &lt;&lt;endl &lt;&lt; &quot;...New deck!! Re-shuffling!&quot; &lt;&lt;endl&lt;&lt;endl;
			Sleep(1000);}

	hand[1]=deck[dealt_cards];	//deal second card
	dealt_cards++;
	hand_count++;

	for (int j=0; j&lt;hand_count; j++)
		hand_value+=hand[j].value;

	if (hand_value==21)		//check for blackjack
		blackjack=true;
	}

void print_hand() {

	 HANDLE hOut;								//shit for color
	 hOut = GetStdHandle(STD_OUTPUT_HANDLE);

for (int k=0; k&lt;hand_count; k++)
{
	if ((hand[k].suit==HEARTS)||(hand[k].suit==DIAMONDS))  //print red face of card
	{
		cout &lt;&lt;&quot;  &quot;;
		SetConsoleTextAttribute (hOut, BWI | FRI);
		cout.width(2);
		cout&lt;&lt; hand[k].face &lt;&lt;&quot;      &quot;&lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout&lt;&lt; &quot;  &quot;&lt;&lt;flush;}
	else						//print black face of cards
	{
		cout &lt;&lt;&quot;  &quot;;
		SetConsoleTextAttribute (hOut, BWI | FNULL);
		cout.width(2);
		cout&lt;&lt; hand[k].face &lt;&lt;&quot;      &quot;&lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout&lt;&lt; &quot;  &quot;&lt;&lt;flush;}
	}

	cout &lt;&lt; endl;
	for (int k=0; k&lt;hand_count; k++)  //print white space
		{SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush; SetConsoleTextAttribute (hOut, BWI | FRI); cout &lt;&lt;&quot;        &quot; &lt;&lt; flush; SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush;}
	cout &lt;&lt; endl;
	for (int k=0; k&lt;hand_count; k++)	//print white space
		{SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush; SetConsoleTextAttribute (hOut, BWI | FRI); cout &lt;&lt;&quot;        &quot; &lt;&lt; flush; SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush;}
	cout &lt;&lt; endl;

	for (int k=0; k&lt;hand_count; k++) {
		if ((hand[k].suit==HEARTS)||(hand[k].suit==DIAMONDS)) { //print red suits
			cout &lt;&lt;&quot;  &quot;;
			SetConsoleTextAttribute (hOut, BWI | FRI);
			cout.width(7);
			cout&lt;&lt; hand[k].suit &lt;&lt; &quot; &quot;&lt;&lt; flush;
			SetConsoleTextAttribute(hOut, BNULL | FW);
			cout&lt;&lt; &quot;  &quot;&lt;&lt;flush;}
		else {									//print black suits
			cout &lt;&lt;&quot;  &quot;;
			SetConsoleTextAttribute (hOut, BWI | FNULL);
			cout.width(7);
			cout&lt;&lt; hand[k].suit &lt;&lt; &quot; &quot; &lt;&lt; flush;
			SetConsoleTextAttribute(hOut, BNULL | FW);
			cout&lt;&lt; &quot;  &quot;&lt;&lt;flush;}
		}
		cout &lt;&lt;endl;

	}

void print_hidden_hand() {		//as above, but hide first card, print it blue

	 HANDLE hOut;
	 hOut = GetStdHandle(STD_OUTPUT_HANDLE);

for (int k=0; k&lt;hand_count; k++)
{

	if (k==0)
	{
		cout &lt;&lt;&quot;  &quot;;
		SetConsoleTextAttribute (hOut, BB | FNULL);
		cout&lt;&lt; &quot;        &quot;&lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout&lt;&lt; &quot;  &quot;&lt;&lt;flush;}
	else if ((hand[k].suit==HEARTS)||(hand[k].suit==DIAMONDS))
	{
		cout &lt;&lt;&quot;  &quot;;
		SetConsoleTextAttribute (hOut, BWI | FRI);
		cout.width(2);
		cout&lt;&lt; hand[k].face &lt;&lt;&quot;      &quot;&lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout&lt;&lt; &quot;  &quot;&lt;&lt;flush;}
	else
	{
		cout &lt;&lt;&quot;  &quot;;
		SetConsoleTextAttribute (hOut, BWI | FNULL);
		cout.width(2);
		cout&lt;&lt; hand[k].face &lt;&lt;&quot;      &quot;&lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout&lt;&lt; &quot;  &quot;&lt;&lt;flush;}
	}

	cout &lt;&lt; endl;

	for (int k=0; k&lt;hand_count; k++){
		if (k==0)
			{SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush; SetConsoleTextAttribute (hOut, BB | FB); cout &lt;&lt;&quot;        &quot; &lt;&lt; flush; SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush;}
		else
			{SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush; SetConsoleTextAttribute (hOut, BWI | FRI); cout &lt;&lt;&quot;        &quot; &lt;&lt; flush; SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush;}
	}
	cout &lt;&lt; endl;

	for (int k=0; k&lt;hand_count; k++){
		if (k==0)
			{SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush; SetConsoleTextAttribute (hOut, BB | FB); cout &lt;&lt;&quot;        &quot; &lt;&lt; flush; SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush;}
		else
			{SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush; SetConsoleTextAttribute (hOut, BWI | FRI); cout &lt;&lt;&quot;        &quot; &lt;&lt; flush; SetConsoleTextAttribute(hOut, BNULL | FW); cout &lt;&lt; &quot;  &quot; &lt;&lt; flush;}
	}
	cout &lt;&lt; endl;

	for (int k=0; k&lt;hand_count; k++){
		if (k==0){
			cout &lt;&lt;&quot;  &quot;;
			SetConsoleTextAttribute (hOut, BB | FB);
			cout &lt;&lt; &quot;        &quot;&lt;&lt; flush;
			SetConsoleTextAttribute(hOut, BNULL | FW);
			cout&lt;&lt; &quot;  &quot;&lt;&lt;flush;}
		else if ((hand[k].suit==HEARTS)||(hand[k].suit==DIAMONDS)){
			cout &lt;&lt;&quot;  &quot;;
			SetConsoleTextAttribute (hOut, BWI | FRI);
			cout.width(7);
			cout&lt;&lt; hand[k].suit &lt;&lt; &quot; &quot;&lt;&lt; flush;
			SetConsoleTextAttribute(hOut, BNULL | FW);
			cout&lt;&lt; &quot;  &quot;&lt;&lt;flush;}
		else {
			cout &lt;&lt;&quot;  &quot;;
			SetConsoleTextAttribute (hOut, BWI | FNULL);
			cout.width(7);
			cout&lt;&lt; hand[k].suit &lt;&lt; &quot; &quot; &lt;&lt; flush;
			SetConsoleTextAttribute(hOut, BNULL | FW);
			cout&lt;&lt; &quot;  &quot;&lt;&lt;flush;}
		}

	cout &lt;&lt;endl;

}

void hit (card deck[], int &amp;dealt_cards) {	//add a card for hit

	if (dealt_cards == 52) {	//check there are enough cards to deal, else shuffle new deck
		make_deck(deck);
		shuffle_deck(deck);
		dealt_cards=0;
		cout &lt;&lt;endl &lt;&lt; &quot;...New deck!! Re-shuffling!&quot; &lt;&lt;endl&lt;&lt;endl;
		Sleep(1000);}

	hand[hand_count]=deck[dealt_cards];
	dealt_cards++;
	hand_count++;

}

}player_hand, dealer_hand;  //objects(?) for player and dealer hands

void make_bet ( double &amp;bet,  double &amp;cash) {	//function to get bet

	HANDLE hOut;
	hOut = GetStdHandle(STD_OUTPUT_HANDLE);

	if (cash!=0) {
		cout &lt;&lt; &quot;You have &quot;;
			SetConsoleTextAttribute(hOut, BNULL | FGI); cout &lt;&lt;&quot;$&quot; &lt;&lt; cash &lt;&lt; flush;  SetConsoleTextAttribute(hOut, BNULL | FW);
			cout &lt;&lt;&quot;. Enter your wager (enter 0 to quit) --&gt; &quot;;
			SetConsoleTextAttribute(hOut, BNULL | FGI);
			cin &gt;&gt; bet; SetConsoleTextAttribute(hOut, BNULL | FW);}
	else if (cash ==0)	//if no money, set bet as zero to quit
		bet = 0;
	while ( (!cin.good()) || (bet &gt; cash)||(bet &lt; 0))	//check for valid input
	if (!cin.good()) {	//numbers only
		cout &lt;&lt; endl &lt;&lt; &quot;Enter a valid wager. Only money, no abc#$%^&amp; shit, please!&quot; &lt;&lt;endl;
		cout &lt;&lt; &quot;You have &quot;;
			SetConsoleTextAttribute(hOut, BNULL | FGI); cout &lt;&lt;&quot;$&quot; &lt;&lt; cash &lt;&lt; flush;  SetConsoleTextAttribute(hOut, BNULL | FW);
			cout &lt;&lt;&quot;. Enter your wager (enter 0 to quit) --&gt; &quot;;
			SetConsoleTextAttribute(hOut, BNULL | FGI); SetConsoleTextAttribute(hOut, BNULL | FW);;
			cin.clear(); cin.sync(); cin &gt;&gt; bet;
			SetConsoleTextAttribute(hOut, BNULL | FW);}

	else if (bet &gt; cash) {	//check that bet is less than available cash
		cout &lt;&lt; endl &lt;&lt; &quot;Sorry, champ. You don't have enough money.&quot; &lt;&lt;endl;
		cout &lt;&lt; &quot;You have &quot;;
			SetConsoleTextAttribute(hOut, BNULL | FGI); cout &lt;&lt;&quot;$&quot; &lt;&lt; cash &lt;&lt; flush;  SetConsoleTextAttribute(hOut, BNULL | FW);
			cout &lt;&lt;&quot;. Enter your wager (enter 0 to quit) --&gt; &quot;;
			SetConsoleTextAttribute(hOut, BNULL | FGI);
			cin.clear(); cin.sync();cin &gt;&gt; bet;
			SetConsoleTextAttribute(hOut, BNULL | FW);}

	else if (bet &lt; 0) {	//check for negative bets
		cout &lt;&lt; endl &lt;&lt; &quot;No negative bets, Mr. Smartypants.&quot; &lt;&lt;endl;
		cout &lt;&lt; &quot;You have &quot;;
			SetConsoleTextAttribute(hOut, BNULL | FGI); cout &lt;&lt;&quot;$&quot; &lt;&lt; cash &lt;&lt; flush;  SetConsoleTextAttribute(hOut, BNULL | FW);
			cout &lt;&lt;&quot;. Enter your wager (enter 0 to quit) --&gt; &quot;;
			SetConsoleTextAttribute(hOut, BNULL | FGI);
			cin.clear(); cin.sync(); cin &gt;&gt; bet;
			SetConsoleTextAttribute(hOut, BNULL | FW); }

	cash=cash-bet;	//deduct bet from cash

}

void win_lose ( double bet,  double &amp;cash, bool bought_ins) {	//check for winner

	HANDLE hOut;
	hOut = GetStdHandle(STD_OUTPUT_HANDLE);

	if ((dealer_hand.blackjack==true)&amp;&amp;(bought_ins==true)){ //if insurance is bought and dealer Blackjacks, payout
		cout &lt;&lt; &quot;You won &quot;;
		SetConsoleTextAttribute(hOut, BNULL | FGI);
		cout &lt;&lt; &quot;$&quot; &lt;&lt; bet &lt;&lt;  flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot; from insurance!&quot; &lt;&lt; endl &lt;&lt;endl;
	}

	if ((dealer_hand.blackjack==false)&amp;&amp;(bought_ins==true)){ //lose insurance if not dealer blackjack
		cout &lt;&lt; &quot;You lost your insurance of &quot;;
		SetConsoleTextAttribute(hOut, BNULL | FRI);
		cout &lt;&lt; &quot;$&quot; &lt;&lt; bet/2 &lt;&lt;  flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot;.&quot; &lt;&lt; endl &lt;&lt;endl;
	}

	if (dealer_hand.blackjack==true) {	//player loses if dealer gets BJ
		SetConsoleTextAttribute (hOut, BNULL | FRI);
		cout &lt;&lt; &quot;Dealer got blackjack! &quot; &lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot; You lost your bet of &quot;&lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FRI);
		cout&lt;&lt; &quot;-- $&quot; &lt;&lt; bet &lt;&lt;&quot; --&quot;&lt;&lt; flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; endl &lt;&lt;endl;
		}

	else if (player_hand.blackjack==true) {		//player wins if BJ
		SetConsoleTextAttribute (hOut, BNULL | FGI);
		cout &lt;&lt; &quot;You got blackjack! &quot; &lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot; You get back your bet of &quot;&lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FYI);
		cout&lt;&lt; &quot;$&quot; &lt;&lt; bet&lt;&lt; flush;
		SetConsoleTextAttribute(hOut, BNULL | FGI);
		cout&lt;&lt; &quot; + $&quot; &lt;&lt; bet*1.5 &lt;&lt;  flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot; in winnings!&quot; &lt;&lt; endl &lt;&lt;endl;
		cash = cash + bet*2.5;
		}

	else if (player_hand.calc_hand_value() &gt; 21) {	//check for player over 21, if bust, player always loses
		SetConsoleTextAttribute (hOut, BNULL | FRI);
		cout &lt;&lt; &quot;Bust! &quot; &lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot; You lost your bet of &quot;&lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FRI);
		cout&lt;&lt; &quot;-- $&quot; &lt;&lt; bet &lt;&lt;&quot; --&quot;&lt;&lt; flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; endl &lt;&lt;endl;
		}
	else if ((dealer_hand.calc_hand_value() &gt; 21) &amp;&amp; (player_hand.calc_hand_value() &lt;= 21)) {	//if dealer, but not player busts, player wins
		SetConsoleTextAttribute (hOut, BNULL | FGI);
		cout &lt;&lt; &quot;Dealer busts. You win!&quot; &lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot; You get back your bet of &quot;&lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FYI);
		cout&lt;&lt; &quot;$&quot; &lt;&lt; bet&lt;&lt; flush;
		SetConsoleTextAttribute(hOut, BNULL | FGI);
		cout&lt;&lt; &quot; + $&quot; &lt;&lt; bet&lt;&lt;  flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot; in winnings!&quot; &lt;&lt; endl &lt;&lt;endl;
		cash+=bet*2;
	}
	else if ((dealer_hand.calc_hand_value() &lt;= 21) &amp;&amp; (player_hand.calc_hand_value() &lt;= 21) &amp;&amp; (player_hand.calc_hand_value() &gt; dealer_hand.calc_hand_value())) {
		SetConsoleTextAttribute (hOut, BNULL | FGI);  //no one busts, check if player is higher
		cout &lt;&lt; &quot;You beat the dealer!&quot;  &lt;&lt;flush;
		SetConsoleTextAttribute (hOut, BNULL | FW);
		cout &lt;&lt; &quot; You get back your bet of &quot;;
		SetConsoleTextAttribute(hOut, BNULL | FYI);
		cout&lt;&lt;  &quot;$&quot; &lt;&lt; bet&lt;&lt;  flush;
		SetConsoleTextAttribute(hOut, BNULL | FGI);
		cout&lt;&lt; &quot; + $&quot; &lt;&lt; bet&lt;&lt;  flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot; in winnings!&quot; &lt;&lt; endl &lt;&lt;endl;
		cash+=bet*2;
	}
	else if ((dealer_hand.calc_hand_value() &lt;= 21) &amp;&amp; (player_hand.calc_hand_value() &lt;= 21) &amp;&amp; (player_hand.calc_hand_value() &lt; dealer_hand.calc_hand_value())) {
		SetConsoleTextAttribute (hOut, BNULL | FRI); //no one busts, check if dealer is higher
		cout &lt;&lt; &quot;Dealer wins!&quot; &lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot; You lost your bet of &quot;;
		SetConsoleTextAttribute(hOut, BNULL | FRI);
		cout&lt;&lt; &quot;-- $&quot; &lt;&lt; bet&lt;&lt; &quot; -- &quot; &lt;&lt; flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; endl &lt;&lt;endl;
			}
	else if ((dealer_hand.calc_hand_value() &lt;= 21) &amp;&amp; (player_hand.calc_hand_value() &lt;= 21) &amp;&amp; (player_hand.calc_hand_value() == dealer_hand.calc_hand_value())) {
		SetConsoleTextAttribute (hOut, BNULL | FWI); cout &lt;&lt; &quot;Push.&quot;  &lt;&lt;flush; SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot; You get back your bet of &quot;;			//check for non-bust tie
		SetConsoleTextAttribute(hOut, BNULL | FYI);
		cout&lt;&lt; &quot;$&quot; &lt;&lt; bet&lt;&lt; flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; endl &lt;&lt;endl;
		cash+=bet;
	}

}

void bet_status(double bet, double cash) {		//display bet and cash info
	HANDLE hOut;
	hOut = GetStdHandle(STD_OUTPUT_HANDLE);

		cout &lt;&lt; &quot;You have &quot;;
			SetConsoleTextAttribute(hOut, BNULL | FGI); cout &lt;&lt;&quot;$&quot; &lt;&lt; cash &lt;&lt; flush;  SetConsoleTextAttribute(hOut, BNULL | FW);
			cout &lt;&lt;&quot;. Your current bet is &quot;;
			SetConsoleTextAttribute(hOut, BNULL | FMI);
			cout &lt;&lt; &quot;$&quot; &lt;&lt; bet &lt;&lt;&quot;.&quot;&lt;&lt;endl&lt;&lt;endl;
			SetConsoleTextAttribute(hOut, BNULL | FW);
}

void insurance(double bet, double &amp;cash, bool &amp;bought_ins) {	//insurance function

	HANDLE hOut;
	hOut = GetStdHandle(STD_OUTPUT_HANDLE);

	bought_ins=false;
	char input='?';
	if ((dealer_hand.hidden_hand_value()==11) &amp;&amp; (cash-bet/2 &gt;0.01))  //if ace is showing and player has enough money, offer insurance
	{
		SetConsoleTextAttribute(hOut, BNULL | FMI);
		cout &lt;&lt; &quot;Would you like to buy insurance? y/n --&gt; &quot;&lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cin&gt;&gt;input;
		while ( (!cin.good()) || ( (input!='y') &amp;&amp; (input!='Y') &amp;&amp; (input!='N') &amp;&amp; (input!='n') )) { //check input
			SetConsoleTextAttribute(hOut, BNULL | FMI);
			cout &lt;&lt; endl &lt;&lt; &quot;Do you want insurance or not? y/n --&gt; &quot;&lt;&lt;flush;
			SetConsoleTextAttribute(hOut, BNULL | FW);
			cin.clear(); cin.sync(); cin &gt;&gt; input;
		}

		if ( ((input=='Y')||(input=='y')) &amp;&amp; (dealer_hand.calc_hand_value()==21))	//check if dealer has BJ and pay out if insurance bought
		{cash+=bet; bought_ins=true; }
		if ( ((input=='Y')||(input=='y')) &amp;&amp; (dealer_hand.calc_hand_value()!=21))	//if not dealer BJ, lose insurance if bought
		{cash-=bet/2;bought_ins=true; }

	clear_screen();
	bet_status(bet, cash);
	dealer_hand.print_hidden_hand();
	cout &lt;&lt; endl&lt;&lt; &quot;The dealer has &quot;;
	SetConsoleTextAttribute(hOut, BNULL | FYI);
	cout &lt;&lt; dealer_hand.hidden_hand_value() &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot; showing.&quot;&lt;&lt; endl&lt;&lt;endl;

	player_hand.print_hand();
	cout &lt;&lt; endl&lt;&lt; &quot;You have &quot;;
	SetConsoleTextAttribute(hOut, BNULL | FCI);
	cout &lt;&lt; player_hand.calc_hand_value() &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot;.&quot;&lt;&lt; endl&lt;&lt;endl;

		if ( ((input=='Y')||(input=='y')) &amp;&amp; (dealer_hand.calc_hand_value()==21))
		{cout &lt;&lt; &quot;Your insurance paid off!&quot;&lt;&lt;endl;}
		if ( ((input=='Y')||(input=='y')) &amp;&amp; (dealer_hand.calc_hand_value()!=21))
		{cout &lt;&lt; &quot;You lost your insurance!&quot;&lt;&lt;endl;}

	}
}

void print_intro (){		//intro and explain rules
	HANDLE hOut;
	hOut = GetStdHandle(STD_OUTPUT_HANDLE);

	cout &lt;&lt; &quot;Welcome to &quot;;
	SetConsoleTextAttribute(hOut, BW | FNULL);
	cout &lt;&lt;&quot;Black&quot; &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BW | FRI);
	cout &lt;&lt;&quot;Jack&quot; &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot;!&quot; &lt;&lt; endl &lt;&lt; endl;
	cout &lt;&lt; &quot;At the beginning of each turn, enter your bet or press zero (0) to quit.&quot; &lt;&lt;endl&lt;&lt;endl;
	cout &lt;&lt; &quot;Press &quot;;
	SetConsoleTextAttribute(hOut, BNULL | FCI);
	cout &lt;&lt; &quot;H&quot;&lt;&lt;flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot; to hit, &quot; &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FCI);
	cout &lt;&lt; &quot;S&quot;&lt;&lt;flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot; to stay, or &quot;&lt;&lt;flush;
	SetConsoleTextAttribute(hOut, BNULL | FCI);
	cout &lt;&lt; &quot;D&quot;&lt;&lt;flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot; to double down.&quot;&lt;&lt;endl&lt;&lt;endl;
	cout &lt;&lt; &quot;Sorry, I haven't included the option to split.&quot; &lt;&lt;endl&lt;&lt;endl;
	cout &lt;&lt; &quot;The deck consists of 52 shuffled cards.&quot; &lt;&lt;endl &lt;&lt;&quot;When the deck runs out, a new deck is shuffled and used.&quot;&lt;&lt;endl&lt;&lt;endl;
	cout &lt;&lt; &quot;The dealer stays on &quot; &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FBI);
	cout &lt;&lt; &quot;17 and above &quot;&lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot;(including soft 17).&quot; &lt;&lt;endl &lt;&lt; endl;
	SetConsoleTextAttribute(hOut, BNULL | FMI);
	cout &lt;&lt; &quot;Press ENTER to start&quot; &lt;&lt;endl;
	SetConsoleTextAttribute(hOut, BNULL | FW);

	string trash;
	getline(cin, trash);
}

int main () {

	HANDLE hOut;
	hOut = GetStdHandle(STD_OUTPUT_HANDLE);

	bool bought_ins=false;	//bool for whether insurance is bought
	card deck[52];			//deck of 52 cards
	 double bet=0;		//player bet
	 double cash=1000;	//player cash, starts at 1000
	int dealt_cards=0;	//number of cards dealt, for checking when to shuffle new deck
	char input;			//input for player moves

	srand((unsigned)time(0));	//seed pseudo random generator

	print_intro();

	clear_screen();
	make_deck(deck);
	shuffle_deck(deck);

	make_bet(bet, cash);

	while (bet != 0) {		//bet 0 to quit, otherwise play

	dealer_hand.get_deal(deck, dealt_cards);
	player_hand.get_deal(deck, dealt_cards);

	clear_screen();
	bet_status(bet, cash);
	dealer_hand.print_hidden_hand();
	cout &lt;&lt; endl&lt;&lt; &quot;The dealer has &quot;;
	SetConsoleTextAttribute(hOut, BNULL | FYI);
	cout &lt;&lt; dealer_hand.hidden_hand_value() &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot; showing.&quot;&lt;&lt; endl&lt;&lt;endl;

	player_hand.print_hand();
	cout &lt;&lt; endl&lt;&lt; &quot;You have &quot;;
	SetConsoleTextAttribute(hOut, BNULL | FCI);
	cout &lt;&lt; player_hand.calc_hand_value() &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot;.&quot;&lt;&lt; endl&lt;&lt;endl;

	insurance(bet, cash, bought_ins);	//check for and offer insurance as necessary

	do {

	if (dealer_hand.blackjack==true)	//if someone has blackjack, input is &quot;Stay&quot; since no moves are needed
		input='S';
	else if (player_hand.blackjack==true)
		input='S';
	else {

	if ((bet &lt;=cash)&amp;&amp; !(player_hand.hand_count&gt;2))		//only show double down if player has enough money
	cout &lt;&lt; &quot;Hit (H), Double Down (D), or Stay (S) --&gt; &quot;;
	else if ((bet &gt;cash) || (player_hand.hand_count&gt;2))
		cout &lt;&lt; &quot;Hit (H) or Stay (S) --&gt; &quot;;

	cin &gt;&gt; input;
	cout &lt;&lt;endl;

	if ( ((input == 'd') || (input == 'D')) &amp;&amp; (bet&gt;cash)){		//check for cash to double down
			cout &lt;&lt; &quot;You don't have enough cash to double down. Hit (H) or Stay (S) --&gt; &quot;; cin.clear(); cin.sync(); cin &gt;&gt; input;
				while ( (!cin.good()) || ( !(  (input == 's') || (input == 'S') || (input == 'h') || (input == 'H'))) || ((input == 'd') || (input == 'D')))	{	//check input
					if ((input == 'd') || (input == 'D'))
						{cout &lt;&lt; &quot;Dude, I told you...you don't have enough money.  Hit (H) or Stay (S) --&gt; &quot;;cin.clear(); cin.sync(); cin &gt;&gt; input;}
					else
					{cout &lt;&lt; &quot;Jeez, first you try to double down with no money...&quot;&lt;&lt;endl;
					cout &lt;&lt; &quot;Now you can't even input properly. Hit (H) or Stay (S) --&gt; &quot;; cin.clear(); cin.sync(); cin &gt;&gt; input;}}
	}
	else if ( ((input == 'd') || (input == 'D')) &amp;&amp; (player_hand.hand_count&gt;2)){  //only allow double down on first move
			cout &lt;&lt; &quot;You've already hit, so you can't double down now. Hit (H) or Stay (S) --&gt; &quot;; cin.clear(); cin.sync(); cin &gt;&gt; input;
				while ( (!cin.good()) || ( !(  (input == 's') || (input == 'S') || (input == 'h') || (input == 'H'))) || ((input == 'd') || (input == 'D')))	{
					if ((input == 'd') || (input == 'D'))	//check input
						{cout &lt;&lt; &quot;The moment has passed. Let it go.  Hit (H) or Stay (S) --&gt; &quot;;cin.clear(); cin.sync(); cin &gt;&gt; input;}
					else
					{cout &lt;&lt; &quot;Not only are you late doubling down...&quot;&lt;&lt;endl;
					cout &lt;&lt; &quot;But now you can't even input properly. Hit (H) or Stay (S) --&gt; &quot;; cin.clear(); cin.sync(); cin &gt;&gt; input;}}
	}
	else {
	while ( (!cin.good()) || ( !(  (input == 's') || (input == 'S') || (input == 'h') || (input == 'H') || (input == 'd') || (input == 'D')))) //check input
	{
		if (bet &lt;=cash)
		{cout &lt;&lt; &quot;Try again. Hit (H), Double Down (D), or Stay (S) --&gt; &quot;;cin.clear(); cin.sync(); cin &gt;&gt; input;}
		else if (bet &gt;cash)
		{cout &lt;&lt; &quot;Try again. Hit (H) or Stay (S) --&gt; &quot;; cin.clear(); cin.sync(); cin &gt;&gt; input;}}
	}}

	if ((input=='h')||(input=='H'))		//hit
	{player_hand.hit(deck, dealt_cards); cin.clear(); cin.sync();}

	if (((input=='D')||(input=='d')) &amp;&amp; (bet&lt;=cash)) //double down
	{player_hand.hit(deck, dealt_cards);
	cash-=bet;
	bet*=2;
	cin.clear(); cin.sync(); input='S';} //set to &quot;stay&quot; after double down to prevent other moves

	clear_screen();
	bet_status(bet, cash);

	dealer_hand.print_hidden_hand();		//I should have put all this display stuff in a function...it keeps repeating!
	cout &lt;&lt; endl&lt;&lt; &quot;The dealer has &quot;;
	SetConsoleTextAttribute(hOut, BNULL | FYI);
	cout &lt;&lt; dealer_hand.hidden_hand_value() &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot; showing .&quot;&lt;&lt; endl&lt;&lt;endl;

	player_hand.print_hand();
	cout &lt;&lt; endl&lt;&lt; &quot;You have &quot;;
	SetConsoleTextAttribute(hOut, BNULL | FCI);
	cout &lt;&lt; player_hand.calc_hand_value() &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot;.&quot;&lt;&lt; endl&lt;&lt;endl;

	} while ((player_hand.calc_hand_value() &lt;21) &amp;&amp; ((input!='s') &amp;&amp; (input != 'S')));  //let player hit until &quot;stay&quot;

	while (dealer_hand.calc_hand_value() &lt;17) {		//dealer hits on less than 17

		clear_screen();
		SetConsoleTextAttribute(hOut, BWI | FBI);
		cout&lt;&lt;&quot;Dealer's turn...&quot;&lt;&lt;flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt;endl &lt;&lt;endl;
		dealer_hand.print_hand();
		cout &lt;&lt; endl&lt;&lt; &quot;The dealer has &quot;;
		SetConsoleTextAttribute(hOut, BNULL | FYI);
		cout &lt;&lt; dealer_hand.calc_hand_value() &lt;&lt; flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot;.&quot;&lt;&lt; endl&lt;&lt;endl;

		player_hand.print_hand();
		cout &lt;&lt; endl&lt;&lt; &quot;You have &quot;;
		SetConsoleTextAttribute(hOut, BNULL | FCI);
		cout &lt;&lt; player_hand.calc_hand_value() &lt;&lt; flush;
		SetConsoleTextAttribute(hOut, BNULL | FW);
		cout &lt;&lt; &quot;.&quot;&lt;&lt; endl&lt;&lt;endl;
		Sleep(800);				//pause so dealer cards don't fly out all at once
		dealer_hand.hit(deck, dealt_cards);

		}
	clear_screen();
	cout &lt;&lt;endl &lt;&lt;endl;
	dealer_hand.print_hand();
	cout &lt;&lt; endl&lt;&lt; &quot;The dealer has &quot;;
	SetConsoleTextAttribute(hOut, BNULL | FYI);
	cout &lt;&lt; dealer_hand.calc_hand_value() &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot;.&quot;&lt;&lt; endl&lt;&lt;endl;
	player_hand.print_hand();
	cout &lt;&lt; endl&lt;&lt; &quot;You have &quot;;
	SetConsoleTextAttribute(hOut, BNULL | FCI);
	cout &lt;&lt; player_hand.calc_hand_value() &lt;&lt; flush;
	SetConsoleTextAttribute(hOut, BNULL | FW);
	cout &lt;&lt; &quot;.&quot;&lt;&lt; endl&lt;&lt;endl;

	win_lose(bet, cash, bought_ins);
	make_bet(bet, cash);
	}

	if (cash==0)
		cout &lt;&lt; &quot;Sorry that you lost all your money!!&quot;&lt;&lt;endl&lt;&lt;endl;		//GAMEOVER

	cout &lt;&lt; &quot;Press &lt;Enter&gt; to close.\n&quot;;
	string trash2;
	cin.clear(); cin.sync();
	getline(cin, trash2);

return 0;
}
</pre>
<p>Here&#8217;s all the windows color junk:</p>
<pre class="brush: cpp;">

#ifndef SHORTCOLOURS_H

#define SHORTCOLOURS_H&lt;/code&gt;

&lt;code&gt; &lt;/code&gt;

&lt;code&gt;#define FW FOREGROUND_RED | \

FOREGROUND_GREEN | \

FOREGROUND_BLUE

#define FR FOREGROUND_RED

#define FG FOREGROUND_GREEN

#define FB FOREGROUND_BLUE

#define FY FOREGROUND_RED | \

FOREGROUND_GREEN

#define FC FOREGROUND_GREEN | \

FOREGROUND_BLUE

#define FM FOREGROUND_BLUE | \

FOREGROUND_RED

#define FWI FOREGROUND_RED | \

FOREGROUND_GREEN | \

FOREGROUND_BLUE | \

FOREGROUND_INTENSITY

#define FRI FOREGROUND_RED | \

FOREGROUND_INTENSITY

#define FGI FOREGROUND_GREEN | \

FOREGROUND_INTENSITY

#define FBI FOREGROUND_BLUE | \

FOREGROUND_INTENSITY

#define FYI FOREGROUND_RED | \

FOREGROUND_GREEN | \

FOREGROUND_INTENSITY

#define FCI FOREGROUND_GREEN | \

FOREGROUND_BLUE | \

FOREGROUND_INTENSITY

#define FMI FOREGROUND_BLUE | \

FOREGROUND_RED | \

FOREGROUND_INTENSITY

#define FNULL 0&lt;/code&gt;

&lt;code&gt;#define BW BACKGROUND_RED | \

BACKGROUND_GREEN | \

BACKGROUND_BLUE

#define BR BACKGROUND_RED

#define BG BACKGROUND_GREEN

#define BB BACKGROUND_BLUE

#define BY BACKGROUND_RED | \

BACKGROUND_GREEN

#define BC BACKGROUND_GREEN | \

BACKGROUND_BLUE

#define BM BACKGROUND_BLUE | \

BACKGROUND_RED

#define BWI BACKGROUND_RED | \

BACKGROUND_GREEN | \

BACKGROUND_BLUE | \

BACKGROUND_INTENSITY

#define BRI BACKGROUND_RED | \

BACKGROUND_INTENSITY

#define BGI BACKGROUND_GREEN | \

BACKGROUND_INTENSITY

#define BBI BACKGROUND_BLUE | \

BACKGROUND_INTENSITY

#define BYI BACKGROUND_RED | \

BACKGROUND_GREEN | \

BACKGROUND_INTENSITY

#define BCI BACKGROUND_GREEN | \

BACKGROUND_BLUE | \

BACKGROUND_INTENSITY

#define BMI BACKGROUND_BLUE | \

BACKGROUND_RED | \

BACKGROUND_INTENSITY

#define BNULL 0

#endif</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.flockofcats.com/sneaky/stuff/blackjack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grid Game: Latest C++ Opus</title>
		<link>http://www.flockofcats.com/sneaky/stuff/grid-game-latest-c-opus/</link>
		<comments>http://www.flockofcats.com/sneaky/stuff/grid-game-latest-c-opus/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 12:59:25 +0000</pubDate>
		<dc:creator>sneaky</dc:creator>
				<category><![CDATA[Stuff]]></category>

		<guid isPermaLink="false">http://www.flockofcats.com/?p=880</guid>
		<description><![CDATA[Here is my latest C++ masterpiece after the jump. Move your guy (U) to get the treasure (T) and avoid the monsters (Q and M). 
This is some seriously hi-tech shizzle.
(Oh and I stole the clear screen function from the interweb ^_^. I couldn&#8217;t come up with that on my own!)


#include &#60;iostream&#62;
#include &#60;windows.h&#62;
#include &#60;cstdlib&#62;
#include &#60;ctime&#62;
using [...]]]></description>
			<content:encoded><![CDATA[<p>Here is my latest C++ masterpiece after the jump. Move your guy (U) to get the treasure (T) and avoid the monsters (Q and M). </p>
<p>This is some seriously hi-tech shizzle.</p>
<p>(Oh and I stole the clear screen function from the interweb ^_^. I couldn&#8217;t come up with that on my own!)<br />
<span id="more-880"></span><br />
<code><br />
#include &lt;iostream&gt;<br />
#include &lt;windows.h&gt;<br />
#include &lt;cstdlib&gt;<br />
#include &lt;ctime&gt;<br />
using namespace std;</p>
<p>#define HEIGHT 8<br />
#define WIDTH 8</p>
<p>struct coord {<br />
	int x;<br />
	int y;<br />
};</p>
<p>void clear_screen ( void )<br />
{<br />
  DWORD n;                         /* Number of characters written */<br />
  DWORD size;                      /* number of visible characters */<br />
  COORD coord = {0};               /* Top left screen position */<br />
  CONSOLE_SCREEN_BUFFER_INFO csbi;</p>
<p>  /* Get a handle to the console */<br />
  HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );</p>
<p>  GetConsoleScreenBufferInfo ( h, &#038;csbi );</p>
<p>  /* Find the number of characters to overwrite */<br />
  size = csbi.dwSize.X * csbi.dwSize.Y;</p>
<p>  /* Overwrite the screen buffer with whitespace */<br />
  FillConsoleOutputCharacter ( h, TEXT ( ' ' ), size, coord, &#038;n );<br />
  GetConsoleScreenBufferInfo ( h, &#038;csbi );<br />
  FillConsoleOutputAttribute ( h, csbi.wAttributes, size, coord, &#038;n );</p>
<p>  /* Reset the cursor to the top left position */<br />
  SetConsoleCursorPosition ( h, coord );<br />
}</p>
<p>void initialize_grid(char grid[][HEIGHT], coord u, coord t, coord q, coord m) {<br />
	for (int H=0; H<HEIGHT; H++)<br />
		for (int W=0; W<WIDTH; W++)<br />
			 grid[W][H]='-';<br />
  grid[u.x][u.y]='U';<br />
  grid[t.x][t.y]='T';<br />
  grid[q.x][q.y]='Q';<br />
  grid[m.x][m.y]='M';</p>
<p>}</p>
<p>void print_grid(char grid[][HEIGHT]) {<br />
	for (int H=0; H<HEIGHT; H++)<br />
	{<br />
		for (int W=0; W<WIDTH; W++)<br />
			 cout << grid[W][H];<br />
		cout << endl;<br />
	}</p>
<p>}</p>
<p>void check_input (char &#038;input) {</p>
<p>	switch (input) {<br />
		case 'd':<br />
			input='D';<br />
			break;<br />
		case 'u':<br />
			input='U';<br />
			break;<br />
		case 'l':<br />
			input='L';<br />
			break;<br />
		case 'r':<br />
			input='R';<br />
			break;<br />
		case 'q':<br />
			input='Q';<br />
			break;<br />
		case 'D':<br />
		case 'U':<br />
		case 'L':<br />
		case 'R':<br />
		case 'Q':<br />
			break;<br />
		default:<br />
					cout << "Invalid input. Try again. " <<endl;<br />
					cout <<"Press U, D, L, or R  (Up, Down, Left, or Right) or Q to quit." << endl;<br />
					cout << "Do loop input: ";<br />
					cin >> input;<br />
					check_input(input);<br />
					break;<br />
		}<br />
}</p>
<p>void move_q(char grid[][HEIGHT], coord&#038; q){<br />
	int random_integer1(0);<br />
	int random_integer2(0);<br />
	int lowest=-2, highest=2;<br />
	int range=(highest-lowest)+1;</p>
<p>		if (grid[q.x][q.y]=='M')<br />
			grid[q.x][q.y]='M';<br />
		else if (grid[q.x][q.y]=='U')<br />
			grid[q.x][q.y]='U';<br />
		else<br />
			grid[q.x][q.y]='-';<br />
	random_integer1 = lowest+int(range*rand()/(RAND_MAX + 1.0));<br />
	q.x=q.x+random_integer1;</p>
<p>	random_integer2 = lowest+int(range*rand()/(RAND_MAX + 1.0));<br />
	q.y=q.y+random_integer2;</p>
<p>	if ((q.x<=-1) || (q.x>=WIDTH) || (q.y<=-1) || (q.y>=HEIGHT))<br />
	{<br />
		q.x=q.x-random_integer1;<br />
		q.y=q.y-random_integer2;<br />
		grid[q.x][q.y]='Q';}<br />
	else<br />
		grid[q.x][q.y]='Q';</p>
<p>}</p>
<p>void move_m(char grid[][HEIGHT], coord&#038; m){<br />
	int random_integer3(0);<br />
	int random_integer4(0);<br />
	int lowest=-2, highest=2;<br />
	int range=(highest-lowest)+1;</p>
<p>		if (grid[m.x][m.y]=='Q')<br />
			grid[m.x][m.y]='Q';<br />
		else if (grid[m.x][m.y]=='U')<br />
			grid[m.x][m.y]='U';<br />
		else<br />
			grid[m.x][m.y]='-';<br />
	random_integer3 = lowest+int(range*rand()/(RAND_MAX + 1.0));<br />
	m.x=m.x+random_integer3;</p>
<p>	random_integer4 = lowest+int(range*rand()/(RAND_MAX + 1.0));<br />
	m.y=m.y+random_integer4;</p>
<p>	if ((m.x<=-1) || (m.x>=WIDTH) || (m.y<=-1) || (m.y>=HEIGHT))<br />
	{<br />
		m.x=m.x-random_integer3;<br />
		m.y=m.y-random_integer4;<br />
		grid[m.x][m.y]='M';}<br />
	else<br />
		grid[m.x][m.y]='M';</p>
<p>}</p>
<p>void move_right(char grid[][HEIGHT], coord&#038; u)<br />
{<br />
if (u.x != WIDTH-1)<br />
{<br />
	if (grid[u.x][u.y]=='Q')<br />
		grid[u.x][u.y]='Q';<br />
	else if (grid[u.x][u.y]=='M')<br />
		grid[u.x][u.y]='M';<br />
	else<br />
		grid[u.x][u.y]='-';</p>
<p>	grid[u.x+1][u.y]='U';<br />
	u.x++;<br />
	}</p>
<p>}</p>
<p>void move_left(char grid[][HEIGHT], coord&#038; u)<br />
{<br />
if (u.x != 0)<br />
{<br />
	grid[u.x][u.y]='-';<br />
	grid[u.x-1][u.y]='U';<br />
	u.x--;<br />
}<br />
}</p>
<p>void move_up(char grid[][HEIGHT], coord&#038; u)<br />
{<br />
if (u.y != 0)<br />
{<br />
	grid[u.x][u.y]='-';<br />
	grid[u.x][u.y-1]='U';<br />
	u.y--;<br />
}<br />
}</p>
<p>void move_down (char grid[][HEIGHT], coord&#038; u)<br />
{<br />
if (u.y != HEIGHT-1)<br />
{<br />
	grid[u.x][u.y]='-';<br />
	grid[u.x][u.y+1]='U';<br />
	u.y++;<br />
	}</p>
<p>}</p>
<p>void check_status(char grid[][HEIGHT], coord u, coord t, coord q, coord m, char&#038; input){<br />
	if ((u.x==q.x)&#038;&#038;(u.y==q.y))<br />
	{<br />
	clear_screen();<br />
	print_grid(grid);<br />
	cout << "The Q monster ate you. YOU LOSE!!"<<endl;;<br />
	input='Q';}<br />
	else if ((u.x==t.x)&#038;&#038;(u.y==t.y))<br />
	{<br />
	clear_screen();<br />
	print_grid(grid);<br />
	cout << "You got the treasure. YOU WIN!!"<<endl;;<br />
	input='Q';}<br />
	else if ((m.x==u.x)&#038;&#038;(m.y==u.y))<br />
	{<br />
	clear_screen();<br />
	print_grid(grid);<br />
	cout << "The M monster at you. YOU LOSE!!"<<endl;;<br />
	input='Q';<br />
	}<br />
}</p>
<p>void your_move(char grid[][HEIGHT], coord u, coord t, coord q, coord m)<br />
{<br />
	   char input='m';<br />
	    clear_screen();<br />
		print_grid(grid);</p>
<p>		if (input != 'Q')<br />
			do<br />
			{<br />
				cout << "Press U, D, L, or R  (Up, Down, Left, or Right) or Q to quit: ";<br />
				cin >> input;<br />
				check_input(input);</p>
<p>				switch (input){<br />
					case 'R':<br />
						move_right(grid, u);<br />
						break;<br />
					case 'U':<br />
						move_up(grid, u);<br />
						break;<br />
					case 'L':<br />
						move_left(grid, u);<br />
						break;<br />
					case 'D':<br />
						move_down(grid, u);<br />
						break;<br />
				}<br />
				move_q(grid, q);<br />
				move_m(grid,m);<br />
				clear_screen();<br />
				print_grid(grid);<br />
				check_status(grid,u, t, q, m, input);</p>
<p>			} while (input != 'Q');<br />
}	</p>
<p>int main (){</p>
<p>	coord U={0,0};<br />
	coord T={WIDTH-1, HEIGHT-1};<br />
	coord Q={WIDTH/2, HEIGHT/2};<br />
	coord M={WIDTH/2+1, HEIGHT/2+1};<br />
	char grid[WIDTH][HEIGHT];</p>
<p>	initialize_grid(grid, U, T, Q, M);<br />
	print_grid(grid);</p>
<p>	your_move(grid, U, T, Q, M);</p>
<p>	return (0);<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flockofcats.com/sneaky/stuff/grid-game-latest-c-opus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deal cards</title>
		<link>http://www.flockofcats.com/sneaky/stuff/deal-cards/</link>
		<comments>http://www.flockofcats.com/sneaky/stuff/deal-cards/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 14:16:48 +0000</pubDate>
		<dc:creator>sneaky</dc:creator>
				<category><![CDATA[Stuff]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.flockofcats.com/?p=877</guid>
		<description><![CDATA[Here is some more C++, I am just posting it here to dump it somewhere to show it to someone with 1337 hacks. Please disregard if this sort of thing bores or confuses you. ^_^


#include &#60;iostream&#62;
#include &#60;string&#62;
#include &#60;cstdlib&#62;
#include &#60;ctime&#62;
using namespace std;
 
struct cards {
string face;
string suit;
int value;
bool dealt;
};
string face_choice[13] = {"A", "2", "3", "4", "5", [...]]]></description>
			<content:encoded><![CDATA[<p>Here is some more C++, I am just posting it here to dump it somewhere to show it to someone with 1337 hacks. Please disregard if this sort of thing bores or confuses you. ^_^</p>
<p><span id="more-877"></span><br />
<code><br />
#include &lt;iostream&gt;<br />
#include &lt;string&gt;<br />
#include &lt;cstdlib&gt;<br />
#include &lt;ctime&gt;</code></p>
<p><code>using namespace std;</code></p>
<p><code> </code></p>
<p><code>struct cards {<br />
string face;<br />
string suit;<br />
int value;<br />
bool dealt;<br />
};</p>
<p>string face_choice[13] = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};<br />
int value_choice[13] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10};</p>
<p>cards deck[52];<br />
cards your_card[52];</p>
<p>void initial_deck()<br />
{<br />
int  n(0);</p>
<p>for (n=0; n&lt;52; n++)<br />
{<br />
deck[n].dealt=0;<br />
if ((n/13) == 0)<br />
{	deck[n].suit="Hearts";<br />
deck[n].face=face_choice[n];<br />
deck[n].value=value_choice[n];}</p>
<p>if ((n/13) == 1)<br />
{	deck[n].suit="Diamonds";<br />
deck[n].face=face_choice[n-13];<br />
deck[n].value=value_choice[n-13];<span style="background-color: #ffffff; ">}</span></p>
<p>if ((n/13) == 2)<br />
{	deck[n].suit="Clubs";<br />
deck[n].face=face_choice[n-26];<br />
deck[n].value=value_choice[n-26];}<br />
if ((n/13) == 3)<br />
{	deck[n].suit="Spades";<br />
deck[n].face=face_choice[n-39];<br />
deck[n].value=value_choice[n-39];}<br />
}<br />
}</p>
<p>void deal (int d_num)<br />
{<br />
int n (0);</p>
<p>srand((unsigned)time(0));<br />
int random_integer(0);<br />
int lowest=0, highest=51;<br />
int range=(highest-lowest)+1;</p>
<p>cout &lt;&lt; "Here are your card(s): " &lt;<br />
for ( n=0; n &lt; d_num; n++)<br />
{ random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0));</p>
<p>if (deck[random_integer].dealt != 1)<br />
{your_card[n]=deck[random_integer];<br />
cout&lt;&lt; endl &lt;&lt; your_card[n].face &lt;&lt; " of " &lt;&lt;  your_card[n].suit &lt;&lt; " which is worth " &lt;&lt;  your_card[n].value;<br />
deck[random_integer].dealt=1;}</p>
<p><span style="background-color: #ffffff; ">} </span></p>
<p>}</p>
<p>int main ()<br />
{</p>
<p>int deal_number;</p>
<p>initial_deck();</p>
<p>cout &lt;&lt; "How many cards do you want? (0-52)" &lt;&lt; endl; cin &gt;&gt; deal_number;</p>
<p>if ((deal_number &gt; 52) || (deal_number &lt; 0)){<br />
cout &lt;&lt; "Sorry, there aren't that many cards in the deck!" &lt;&lt; endl;}<br />
else if (deal_number == 0)<br />
cout &lt;&lt; "That's cool, I didn't want to give you cards anyway!" &lt;&lt; endl;<br />
else<br />
deal(deal_number);</p>
<p>return 0;</p>
<p></code></p>
<p><code>}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flockofcats.com/sneaky/stuff/deal-cards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++</title>
		<link>http://www.flockofcats.com/sneaky/stuff/c/</link>
		<comments>http://www.flockofcats.com/sneaky/stuff/c/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 14:32:54 +0000</pubDate>
		<dc:creator>sneaky</dc:creator>
				<category><![CDATA[Stuff]]></category>

		<guid isPermaLink="false">http://www.flockofcats.com/?p=875</guid>
		<description><![CDATA[I have been playing around with C++  the last couple days, just because I am a big computer dork and to see what I can remember from back in high school computer science.
Here is my latest gem.

#include 
#include 
using namespace std;
float num1(0), num2 (0), answer (0);
string operate;
int main ()
{
cout ]]></description>
			<content:encoded><![CDATA[<p>I have been playing around with C++  the last couple days, just because I am a big computer dork and to see what I can remember from back in high school computer science.</p>
<p>Here is my latest gem.</p>
<p><code><br />
#include <iostream><br />
#include <string><br />
using namespace std;</p>
<p>float num1(0), num2 (0), answer (0);<br />
string operate;</p>
<p>int main ()<br />
{<br />
cout << "Welcome to the calculator" << endl;<br />
cout << "Enter the first number" << endl;<br />
cin >> num1;<br />
cout << endl << "Enter the second number." << endl;<br />
cin >> num2;<br />
cout << endl << "What operation would you like to perform? (+ - x /)" << endl;<br />
cin >> operate;</p>
<p>	if (operate == "x") {<br />
		answer=num1*num2;<br />
		cout << answer << endl << "You have multiplied " << num1 << " and " << num2 << ".";<br />
		}</p>
<p>	else if (operate == "+") {<br />
		answer=num1+num2;<br />
		cout << answer << endl << "You have added " << num1 << " and " << num2 << ".";<br />
		}<br />
	else if (operate == "-") {<br />
		answer=num1-num2;<br />
		cout << answer << endl << "You have subtracted " << num2 << " from " << num1 << ".";<br />
		}<br />
	else if (operate == "/") {<br />
		answer=num1/num2;<br />
		cout << answer << endl << "You have divided " << num2 << " into " << num1 << ".";<br />
		}</p>
<p>	else {<br />
		cout << "I'm sorry, you didn't enter a valid operation to perform" << endl;<br />
		}</p>
<p>}</code></p>
<p>Take that MS Calculator!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flockofcats.com/sneaky/stuff/c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Map of Almaty, Kazakhstan</title>
		<link>http://www.flockofcats.com/yulzopolis/peace-corps/map-of-almaty-kazakhstan/</link>
		<comments>http://www.flockofcats.com/yulzopolis/peace-corps/map-of-almaty-kazakhstan/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 22:45:19 +0000</pubDate>
		<dc:creator>Yulzopolis</dc:creator>
				<category><![CDATA[Peace Corps]]></category>
		<category><![CDATA[Russian]]></category>

		<guid isPermaLink="false">http://www.flockofcats.com/?p=869</guid>
		<description><![CDATA[My friend here in Denver has a company called Umapper (www.umapper.com), which lets you make custom maps and applications.  So i was testing it out, and made a map of Almaty, Kazakhstan and wanted to post it here on the website.
Having lived and visited several times in Almaty, hopefully I labeled some places on [...]]]></description>
			<content:encoded><![CDATA[<p>My friend here in Denver has a company called Umapper (<a href="http://www.umapper.com">www.umapper.com</a>), which lets you make custom maps and applications.  So i was testing it out, and made a map of Almaty, Kazakhstan and wanted to post it here on the website.</p>
<p>Having lived and visited several times in Almaty, hopefully I labeled some places on this map that will be useful to anyone who stumbles upon it&#8230;because it is essential that people in Almaty can find the Arasan Bathhouse! (which I labeled on the map).</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="500" height="300" id="umapper_embed"><param name="FlashVars" value="kmlPath=http://umapper.s3.amazonaws.com/maps/kml/49231.kml" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="movie" value="http://umapper.s3.amazonaws.com/templates/swf/embed.swf" /><param name="quality" value="high" /><embed src="http://umapper.s3.amazonaws.com/templates/swf/embed.swf" FlashVars="kmlPath=http://umapper.s3.amazonaws.com/maps/kml/49231.kml" allowScriptAccess="always" allowFullScreen="true" quality="high" width="500" height="300" name="umapper_embed" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flockofcats.com/yulzopolis/peace-corps/map-of-almaty-kazakhstan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On the TX</title>
		<link>http://www.flockofcats.com/sneaky/work/on-the-tx/</link>
		<comments>http://www.flockofcats.com/sneaky/work/on-the-tx/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 23:21:36 +0000</pubDate>
		<dc:creator>sneaky</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[japan]]></category>
		<category><![CDATA[train]]></category>

		<guid isPermaLink="false">http://www.flockofcats.com/sneaky/work/on-the-tx/</guid>
		<description><![CDATA[On the train. All the 8:23 regulars are here. Strangers on a commuter train.  
Yesterday was crazy busy at work. I don&#8217;t fully understand the seasonal ups and downs of the scientific editing business, but right now, we are swamped. I really need to speed up my editing, but of course the trick is [...]]]></description>
			<content:encoded><![CDATA[<p>On the train. All the 8:23 regulars are here. Strangers on a commuter train.  </p>
<p>Yesterday was crazy busy at work. I don&#8217;t fully understand the seasonal ups and downs of the scientific editing business, but right now, we are swamped. I really need to speed up my editing, but of course the trick is to do that while maintaining accuracy.  </p>
<p>Yesterday, I worked from 9:30 am to 9:30 pm, bookended by an hour on the train each way &#8212; on thanksgiving. Lucky me (but Monday was a holiday, so I can&#8217;t complain too much). </p>
<p>It&#8217;s little late, but I wonder if there is somewhere in this country where I can score some pumpkin pie? </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flockofcats.com/sneaky/work/on-the-tx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wave Test</title>
		<link>http://www.flockofcats.com/sneaky/stuff/wave-test/</link>
		<comments>http://www.flockofcats.com/sneaky/stuff/wave-test/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 16:05:06 +0000</pubDate>
		<dc:creator>sneaky</dc:creator>
				<category><![CDATA[Stuff]]></category>

		<guid isPermaLink="false">http://www.flockofcats.com/?p=854</guid>
		<description><![CDATA[After the jump, I have a Google wave embedded.





  var wave =
    new WavePanel('https://wave.google.com/wave/');
  wave.setUIConfig('white', 'black', 'Arial', '13px');
  wave.loadWave('googlewave.com!w+IqzNwpGpA');
  wave.init(document.getElementById('wave'));

]]></description>
			<content:encoded><![CDATA[<p>After the jump, I have a Google wave embedded.</p>
<p><span id="more-854"></span></p>
<div id="wave" style="width: 560px; height: 420px"></div>
<p><script
  type="text/javascript"
  src="http://wave-api.appspot.com/public/embed.js">
</script><br />
<script type="text/javascript">
  var wave =
    new WavePanel('https://wave.google.com/wave/');
  wave.setUIConfig('white', 'black', 'Arial', '13px');
  wave.loadWave('googlewave.com!w+IqzNwpGpA');
  wave.init(document.getElementById('wave'));
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flockofcats.com/sneaky/stuff/wave-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Climate Change and Site Tweaks&#8230;</title>
		<link>http://www.flockofcats.com/sneaky/news-and-politics/climate-change-and-site-tweaks/</link>
		<comments>http://www.flockofcats.com/sneaky/news-and-politics/climate-change-and-site-tweaks/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 07:09:31 +0000</pubDate>
		<dc:creator>sneaky</dc:creator>
				<category><![CDATA[News and Politics]]></category>
		<category><![CDATA[global warming]]></category>
		<category><![CDATA[Meta]]></category>
		<category><![CDATA[Science]]></category>

		<guid isPermaLink="false">http://www.flockofcats.com/?p=846</guid>
		<description><![CDATA[I have not updated this blog in a long time. Time has been short, as I am really busy at work these days. Moreover, I have not had much to write about. Lately, I have felt that my contribution to the Web 2.0 (or are we at Web 5.0?) were better suited to the 140-characters-or-fewer format of [...]]]></description>
			<content:encoded><![CDATA[<p>I have not updated this blog in a long time. Time has been short, as I am really busy at work these days. Moreover, I have not had much to write about. Lately, I have felt that my contribution to the Web 2.0 (or are we at Web 5.0?) were better suited to the 140-characters-or-fewer format of Twitter. After my twitter and Facebook output, there is not much left to write about here.</p>
<p>However, I was struck by the urge to tinker with the Web site today. Even if no one reads it, I still enjoy tweaking it. I mostly upgraded various components of the blog to their most recent versions; thus, most of the changes are not very noticeable. I also implemented a new<span style="background-color: #ffffff; "> login system. You can now log in with Google/Facebook/twitter/OpenID, or you can use your existing FoC login if you would prefer &#8212; you should be able to associate the existing FoC account with a third party login. Let me know if you have any trouble.</span></p>
<p>I also wanted to write something today because a subject came up (other than health care reform, about which I lack the perseverance to write) that I thought was well suited for regular blogging rather than microblogging.</p>
<p><span style="background-color: #ffffff; ">A few days ago, a leading <a title="Climate change research center hacked" href="http://www.nytimes.com/2009/11/21/science/earth/21climate.html?_r=1">climate change research center was hacked</a>. Among other things, their private e-mails have been spread around the Internet. Many climate change deniers have latched onto certain portions of these e-mails as proof &#8212; not just the smoking gun, but the mushroom cloud!! &#8212; that climate change is a big hoax.</span></p>
<p>The most talked about passage stated,</p>
<blockquote><p>&#8220;I&#8217;’ve just completed Mike’s Nature trick of adding in the real temps to each series for the last 20 years (ie from 1981 onwards) amd from 1961 for Keith’s to hide the decline.&#8221;</p></blockquote>
<p>Words like &#8220;trick&#8221; and &#8220;hide&#8221; certainly have a negative nuance, hinting that something untoward took place. However, based on my understanding of the matter, this was not the case. Although I feel silly having to cite the definition of a commonly known word, it is probably the simplest way to approach the first commonly cited point in the e-mail.</p>
<blockquote><p>&#8220;<a href="http://www.answers.com/trick">Trick</a>: A convention or specialized skill peculiar to a particular field of activity.&#8221;</p></blockquote>
<p>Was this definition the intended meaning of &#8220;trick&#8221;, or does it instead refer to malicious deception? The answer to this question depends on the meaning of &#8220;hide the decline&#8221;. Many climate change deniers seem to interpret &#8220;hide the decline&#8221; to mean that global temperatures are actually decreasing and that any reported rise in global temperatures is the result of manipulation of data &#8212; a hoax dreamed up by Al Gore and George Soros. However, surely an enterprising scientist somewhere would notice this, right? Never mind the fact that decreasing temperatures would conflict with numerous separate observations, for example, sea ice thickness, weather patterns, and species extinction.</p>
<p>Therefore, I think it is safe to conclude that the scientists were not hiding declining real global temperatures. So, what were they hiding?</p>
<p>Climate scientists use a variety of proxies instead of actual temperature measurements, such as tree-ring growth and the isotopic composition of polar ice cores. These proxies are necessary to construct models of the global climate thousands of years in the past, since frequent, accurate, and widespread measurement of temperature is a fairly recent occurrence. However, these temperature proxies are not perfect. For example, the <a href="http://scholar.google.com/scholar?hl=en&amp;q=tree+ring+%22divergence+problem%22&amp;btnG=Search&amp;as_sdt=2000&amp;as_ylo=&amp;as_vis=0">tree ring &#8220;divergence problem&#8221;</a>,<a href="http://scholar.google.com/scholar?hl=en&amp;q=tree+ring+%22divergence+problem%22&amp;btnG=Search&amp;as_sdt=2000&amp;as_ylo=&amp;as_vis=0"> </a>whereby the strong correlation between tree-ring growth and temperature considerably weakened after 1960, is <a href="http://adsabs.harvard.edu/abs/2007AGUFMPP51C0663Y">well know</a>. It has been reported that in the e-mail, &#8220;decline&#8221; referred to the decrease in the modeled temperature obtained by using tree-ring data.</p>
<p>In order to deal with large and complex data sets, various statistical treatments must be applied. In this case, tree-ring growth provides good data up to 1960. However, since the correlation subsequently weakened, the &#8220;decline&#8221; needed to be &#8220;hidden&#8221;, not because they were <em>twisting the data</em> to fit their political agenda, but because they were <em>constructing a model</em> to fit the observed data.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flockofcats.com/sneaky/news-and-politics/climate-change-and-site-tweaks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WH Health Bill</title>
		<link>http://www.flockofcats.com/yulzopolis/stuff/wh-health-bill/</link>
		<comments>http://www.flockofcats.com/yulzopolis/stuff/wh-health-bill/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 21:33:04 +0000</pubDate>
		<dc:creator>Yulzopolis</dc:creator>
				<category><![CDATA[Stuff]]></category>

		<guid isPermaLink="false">http://www.flockofcats.com/?p=843</guid>
		<description><![CDATA[It looks like the White House might draft its own health care bill&#8230;.which I think could be a great strategy.  Congress has done 85% of the bill, and now Obama can take control of the debate, while also shielding himself from criticism by saying that he is taking the best parts from the various congressional [...]]]></description>
			<content:encoded><![CDATA[<p>It looks like the White House might <a href="http://www.cnn.com/2009/POLITICS/09/04/obama.health.care/index.html" target="_blank">draft its own health care bill</a>&#8230;.which I think could be a great strategy.  Congress has done 85% of the bill, and now Obama can take control of the debate, while also shielding himself from criticism by saying that he is taking the best parts from the various congressional plans that have already been drafted.  And anything to speed up the sausage-making process would be a good thing. (Damn you Gang of Six!)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flockofcats.com/yulzopolis/stuff/wh-health-bill/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Russian Translation</title>
		<link>http://www.flockofcats.com/yulzopolis/stuff/ninja-links-for-mile-high-russian/</link>
		<comments>http://www.flockofcats.com/yulzopolis/stuff/ninja-links-for-mile-high-russian/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 18:27:06 +0000</pubDate>
		<dc:creator>Yulzopolis</dc:creator>
				<category><![CDATA[Stuff]]></category>

		<guid isPermaLink="false">http://www.flockofcats.com/?p=837</guid>
		<description><![CDATA[ In case anyone wants some great Russian and English translation services, you should check out our new company &#8211; Mile High Russian!  We&#8217;ll translate anything!   We also offer Russian tutoring!
]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="Mile High Russian" src="http://www.milehighrussian.com/eng/images/img03.gif" alt="" width="200" height="78" /> In case anyone wants some great <a title="Mile High Russian" href="http://www.milehighrussian.com" target="_blank">Russian and English translation services</a>, you should check out our new company &#8211; Mile High Russian!  We&#8217;ll translate anything!   We also offer <a href="http://www.milehighrussian.com/eng/otherservices.html" target="_blank">Russian tutoring</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flockofcats.com/yulzopolis/stuff/ninja-links-for-mile-high-russian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
