Sizewell B++



 DEVELOP > c-Plus-Plus > Sizewell B++

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1
Topic: DEVELOP > c-Plus-Plus
User: "Divvy Bollocks"
Date: 30 Mar 2006 06:58:13 AM
Object: Sizewell B++
This is a multi-part message in MIME format.
------=_NextPart_000_0049_01C65401.FCCB7310
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
=20
// A big 7 and three-quarters size "Hello" to all C++ programmers out =
there. This here is the second program what I've
// ever wrote, the first being a "***** world you *****" program. It's =
a nice little poker patience program, poker
// patience being a patience game whereby 10 poker hands are placed on =
the table in a 5x5 square. Try it if you like.
// It's not really a C++ program as such, more of a SLOGic program heh =
heh. It writes results to a file results.txt
// and I just had to post it to this newsgroup because because because =
.....
// I'm sending it off to the BNFL with my CV in response to their =
advert:
//
// <<Programmer required to write "lowering of graphite rods into =
reactor core program" at Sizewell B.
// Good benefits package, nice pension (probably)>>
// Er .... If anyone's interested, compile it with the /O2 switch ... =
optimise for speed.
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///// =
/////
///// Program: Poker Patience Program (ppp.cpp) =
/////
///// Writer: Peter Lambert using "Learn to Program with Borland C++ =
Builder 1.0" (=A380) /////
///// which was a GUI C++ for Windows 95. Nice graphcs, bitmaps =
and all that. /////
///// And then rewritten for Microsoft Visual C++ Toolkit 2003 =
(a FREE compiler). /////
///// Date: 29th March 2006 between about 3pm and 3.45pm honest =
/////
///// John Huston: Filling straights is a sucker's game =
/////
///// Robert Duvall: 2 of Spades, 3 of Spades, 4 of Diamonds, 6 of =
Clubs, 8 of Spades /////
///// Instruction: Mince around with skore[] variables to improve play =
/////
///// Dealer: Your dealer tonight is Frankie Machinek =
/////
///// Note: Dealer can be a bit slow at beginning of each game because =
of validation /////
///// Version Number: You're yanking me off now right? =
/////
///// =
/////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////////////////////////////// P R O G R A M N O T E S =
////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
////=20
//// TO DO:
////=20
//// 1 .... Indenting ... Each "if" & "for" should be DIRECTLY above its =
associated "{" & "}".
//// 2 .... Check for redundant variables.
//// 3 .... Analyze those 136 odd "skore" variables that determine where =
cards are placed.
//// Can any improvements be made to up that average score per =
game?
//// 4 .... You could introduce some "CANNY LOGIC" so that placement of =
cards takes into
//// consideration ONLY the remaining cards in the deck. Hence if =
we're looking at a=20
//// pair of 7's and one or both of the other two 7's has awready =
been placed elsewhere
//// then that pair of 7's ain't ever gonna be a prial or a =
foursy. Same sorta thing
//// with potential straight flushes. If you're looking at =
4,5,6,7 of clubs and either
//// or both of the other two cards (ie 3 & 8 of clubs) have =
already been placed=20
//// elsewhere then this can only ever become a flush or a =
straight. Etc etc etc.
//// Complex yes, but required.
//// 5 .... If you're really stuck for things to do you could try to =
"bitmapise" the whole=20
//// program so that for 100 games it writes 101 files, 001.jpg, =
002.jpg, 003.jpg ...
//// 099.jpg, 100.jpg plus summary.txt.
////=20
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
#pragma warning(disable: 4786)
#include <string>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <conio.h>
using namespace std; // VERY IMPORTANT!!!
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////// R A N D O M N U M B E R F U N C T I =
O N //////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
int RandInt(int lower,int higher)
{
return lower + rand() % (higher - lower + 1);
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
//////////////// F I N D T O P R O W I N T A B L E A =
R R A Y /////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
int find_top(int harray[11][11])
{
int x, y, z;
z =3D 0;
bool kwit =3D false;
// Find top
for(x=3D0; x<=3D10; x++)
{
for(y=3D0; y<=3D10; y++)
{
if (harray[x][y] !=3D 0)
{
z =3D x;
kwit =3D true;
break;
}
}
if (kwit) break;
}
return z;
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////// F I N D B O T T O M R O W I N T A B L E =
A R R A Y //////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
int find_bottom(int harray[11][11])
{
int x, y, z;
z =3D 0;
bool kwit =3D false;
// Find bottom
for(x=3D10; x>=3D0; x--)
{
for(y=3D0; y<=3D10; y++)
{
if (harray[x][y] !=3D 0)
{
z =3D x;
kwit =3D true;
break;
}
}
if (kwit) break;
}
return z;
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
////////////// F I N D LEFTMOST COLUMN I N T A B L E =
A R R A Y ///////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
int find_left(int harray[11][11])
{
int x, y, z;
z =3D 0;
bool kwit =3D false;
// Find left
for(x=3D0; x<=3D10; x++)
{
for(y=3D0; y<=3D10; y++)
{
if (harray[y][x] !=3D 0)
{
z =3D x;
kwit =3D true;
break;
}
}
if (kwit) break;
}
return z;
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////// F I N D RIGHTMOST COLUMN I N T A B L E =
A R R A Y ///////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
int find_right(int harray[11][11])
{
int x, y, z;
z =3D 0;
bool kwit =3D false;
// Find right
for(x=3D10; x>=3D0; x--)
{
for(y=3D0; y<=3D10; y++)
{
if (harray[y][x] !=3D 0)
{
z =3D x;
kwit =3D true;
break;
}
}
if (kwit) break;
}
return z;
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
//////////////////// T H E I D E N T I F Y H A N D F U N C T =
I O N ///////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
int identify_hand(int hand[5])
{
int i =3D 0;
int pair01 =3D 0, pair02 =3D 0, pair03 =3D 0, pair04 =3D 0,
pair12 =3D 0, pair13 =3D 0, pair14 =3D 0,
pair23 =3D 0, pair24 =3D 0,
pair34 =3D 0;
bool no_pairs =3D false, single_pair =3D false, two_pairs =3D false, =
flush =3D false, prial =3D false, straight =3D false, schtraight =3D =
false, bum_schtraight =3D false, dog_schtraight =3D false, full_hand =3D =
false, fours =3D false;
int number_of_pairs =3D 0;
int number_of_cards =3D 0, hand_identifier =3D 0;
int the_number_5 =3D 5; // This is the size of the hand[] array ... =
required for the sort() function
int card1_pips=3D0, card1_suit=3D0, card2_pips=3D0, card2_suit=3D0, =
card3_pips=3D0, card3_suit=3D0, card4_pips=3D0, card4_suit=3D0, =
card5_pips=3D0, card5_suit=3D0;
//Right ... first up we need to sort this hand[] array
sort(hand, hand + the_number_5);
// Thus hand[] will contain ...=20
// {0,0,0,0,0} ... No cards=20
// {0,0,0,0,104} ... 1 card (AS)
// {0,0,0,104,401} ... 2 cards (AS & 4H)
// {0,0,0,501,502} ... 2 cards (5H & 5D)
// {0,0,101,102,1301} ... 3 cards (AH, AD & KH)
// {0,303,402,704,604} ... 4 cards (3C, 4D, 7S & 6S)
card5_suit =3D (hand[0] % 100);
card4_suit =3D (hand[1] % 100);
card3_suit =3D (hand[2] % 100);
card2_suit =3D (hand[3] % 100);
card1_suit =3D (hand[4] % 100);
card5_pips =3D (hand[0] - card5_suit)/100;
card4_pips =3D (hand[1] - card4_suit)/100;
card3_pips =3D (hand[2] - card3_suit)/100;
card2_pips =3D (hand[3] - card2_suit)/100;
card1_pips =3D (hand[4] - card1_suit)/100;
=20
//cardn_suit will now contain the suit (1, 2, 3 or 4 - HDCS) for card n
//cardn_pips will now contain the pips (1=3DA, 2=3D2, 3=3D3, 4=3D4 ... =
etc etc etc ... 9=3D9, 10=3D10, 11=3DJ, 12=3DQ and 13=3DK) for card n
// If hand[] =3D {0,0, 1.1, 3.3, 4.4} ... (AH, 3C, 4S) =
card1_pips =3D 4, card2_pips =3D 3, cards3_pips =3D 1 (the ace)
// If hand[] =3D {0, 1.1, 10.3, 12.4, 13.1} ... (AH, 10C, QS, KH) =
card1_pips =3D 13 (K), card2_pips =3D 12 (Q), cards3_pips =3D 10, =
cards4_pips =3D 1 (the ace)
// ie ... the cards are written to card1, card2, card3 ... etc is =
DESCENDING order KING HIGHEST (13) ACE LOWEST (1)
=20
for(i=3D0; i<=3D4; i++)
{
if (hand[i] !=3D 0) number_of_cards++;
}
// Let's get this show on the road
if (number_of_cards =3D=3D 0) hand_identifier =3D -2;
if (number_of_cards =3D=3D 1) hand_identifier =3D -1;
if (number_of_cards =3D=3D 2)
{
if (card1_pips =3D=3D card2_pips) single_pair =3D true;
if (card1_suit =3D=3D card2_suit) flush =3D true;
if ((card1_pips - card2_pips =3D=3D 1) || ((card1_pips =3D=3D 1) && =
(card2_pips =3D=3D 13))) straight =3D true;
if ((card1_pips - card2_pips =3D=3D 2) || ((card1_pips =3D=3D 1) && =
(card2_pips =3D=3D 12))) schtraight =3D true;
if ((card1_pips - card2_pips =3D=3D 3) || ((card1_pips =3D=3D 1) && =
(card2_pips =3D=3D 11))) bum_schtraight =3D true;
if ((card1_pips - card2_pips =3D=3D 4) || ((card1_pips =3D=3D 1) && =
(card2_pips =3D=3D 10))) dog_schtraight =3D true;
if (!single_pair && !flush && !straight && !schtraight && =
!bum_schtraight && !dog_schtraight) hand_identifier =3D 0;
if (single_pair) hand_identifier =3D 1;
if (flush && !straight && !schtraight && !bum_schtraight && =
!dog_schtraight) hand_identifier =3D 2;
if (!flush && straight && !schtraight && !bum_schtraight && =
!dog_schtraight) hand_identifier =3D 3;
if (!flush && !straight && schtraight && !bum_schtraight && =
!dog_schtraight) hand_identifier =3D 4;
if (!flush && !straight && !schtraight && bum_schtraight && =
!dog_schtraight) hand_identifier =3D 5;
if (!flush && !straight && !schtraight && !bum_schtraight && =
dog_schtraight) hand_identifier =3D 6;
if (flush && straight && !schtraight && !bum_schtraight && =
!dog_schtraight) hand_identifier =3D 7;
if (flush && !straight && schtraight && !bum_schtraight && =
!dog_schtraight) hand_identifier =3D 8;
if (flush && !straight && !schtraight && bum_schtraight && =
!dog_schtraight) hand_identifier =3D 9;
if (flush && !straight && !schtraight && !bum_schtraight && =
dog_schtraight) hand_identifier =3D 10;
}
if (number_of_cards =3D=3D 3)
{
if (card1_pips =3D=3D card2_pips) pair01 =3D 1;
if (card1_pips =3D=3D card3_pips) pair02 =3D 1;
if (card2_pips =3D=3D card3_pips) pair12 =3D 1;
number_of_pairs =3D pair01 + pair02 + pair12;
if (number_of_pairs =3D=3D 0) no_pairs =3D true;
if (number_of_pairs =3D=3D 1) single_pair =3D true;
if (number_of_pairs =3D=3D 3) prial =3D true;
if (no_pairs)
{
if ((card1_suit =3D=3D card2_suit) && (card1_suit =3D=3D card3_suit) =
&& (card2_suit =3D=3D card3_suit)) flush =3D true;
if (((card1_pips - card2_pips =3D=3D 1) && (card2_pips - card3_pips =
=3D=3D 1)) || ((card1_pips =3D=3D 13) && (card2_pips =3D=3D 12) && =
(card3_pips =3D=3D 1))) straight =3D true;
if ((card1_pips - card3_pips =3D=3D 3) && ((card1_pips - card2_pips =
=3D=3D 1) || (card2_pips - card3_pips =3D=3D 1))) schtraight =3D true;
if (((card1_pips =3D=3D 13) || (card1_pips =3D=3D 12)) && =
((card3_pips =3D=3D 1) && (card2_pips =3D=3D 11))) schtraight =3D true;
if ((card1_pips - card3_pips =3D=3D 4) && ((card2_pips > card3_pips) =
&& (card1_pips > card2_pips))) bum_schtraight =3D true;
if ((card3_pips =3D=3D 1) && (card2_pips =3D=3D 10) && ((card1_pips =
=3D=3D 11) || (card1_pips =3D=3D 12) || (card1_pips =3D=3D 13))) =
bum_schtraight =3D true;
}
if (no_pairs && !flush && !straight && !schtraight && !bum_schtraight) =
hand_identifier =3D 11;
if (single_pair && !flush && !straight && !schtraight && =
!bum_schtraight) hand_identifier =3D 12;
if (flush && !straight && !schtraight && !bum_schtraight) =
hand_identifier =3D 13;
if (prial && !flush && !straight && !schtraight && !bum_schtraight) =
hand_identifier =3D 14;
if (!flush && straight && !schtraight && !bum_schtraight) =
hand_identifier =3D 15;
if (!flush && !straight && schtraight && !bum_schtraight) =
hand_identifier =3D 16;
if (!flush && !straight && !schtraight && bum_schtraight) =
hand_identifier =3D 17;
if (flush && straight && !schtraight && !bum_schtraight) =
hand_identifier =3D 18;
if (flush && !straight && schtraight && !bum_schtraight) =
hand_identifier =3D 19;
if (flush && !straight && !schtraight && bum_schtraight) =
hand_identifier =3D 20;
}
if (number_of_cards =3D=3D 4)
{
if (card1_pips =3D=3D card2_pips) pair01 =3D 1;
if (card1_pips =3D=3D card3_pips) pair02 =3D 1;
if (card1_pips =3D=3D card4_pips) pair03 =3D 1;
if (card2_pips =3D=3D card3_pips) pair12 =3D 1;
if (card2_pips =3D=3D card4_pips) pair13 =3D 1;
if (card3_pips =3D=3D card4_pips) pair23 =3D 1;
number_of_pairs =3D pair01 + pair02 + pair03 +
pair12 + pair13 +
pair23;
if (number_of_pairs =3D=3D 0) no_pairs =3D true;
if (number_of_pairs =3D=3D 1) single_pair =3D true;
if (number_of_pairs =3D=3D 2) two_pairs =3D true;
if (number_of_pairs =3D=3D 3) prial =3D true;
if (number_of_pairs =3D=3D 6) fours =3D true;
if (no_pairs)
{
if ((card1_suit =3D=3D card2_suit) && (card1_suit =3D=3D card3_suit) =
&& (card1_suit =3D=3D card4_suit) && (card2_suit =3D=3D card3_suit) && =
(card2_suit =3D=3D card4_suit) && (card3_suit =3D=3D card4_suit)) flush =
=3D true;
if ((card1_pips - card2_pips =3D=3D 1) && (card2_pips - card3_pips =
=3D=3D 1) && (card3_pips - card4_pips =3D=3D 1)) straight =3D true;
if ((card1_pips =3D=3D 13) && (card2_pips =3D=3D 12) && (card3_pips =
=3D=3D 11) && (card4_pips =3D=3D 1)) straight =3D true;
if ((card1_pips - card4_pips =3D=3D 4) && ((card1_pips - card2_pips =
<=3D 2) && (card3_pips - card4_pips <=3D 2))) schtraight =3D true;
if ((card4_pips =3D=3D 1) && (card3_pips =3D=3D 10) && ((card1_pips =
=3D=3D 13) || (card1_pips =3D=3D 12)) && ((card2_pips =3D=3D 12) || =
(card2_pips =3D=3D 11))) schtraight =3D true;
}
if (no_pairs && !flush && !straight && !schtraight) hand_identifier =
=3D 21;
if (single_pair && !flush && !straight && !schtraight) =
hand_identifier =3D 22;
if (two_pairs && !flush && !straight && !schtraight) hand_identifier =
=3D 23;
if (flush && !straight && !schtraight) hand_identifier =3D 24;
if (prial && !flush && !straight && !schtraight) hand_identifier =3D =
25;
if (!flush && straight && !schtraight) hand_identifier =3D 26;
if (!flush && !straight && schtraight) hand_identifier =3D 27;
if (fours && !flush && !straight && !schtraight) hand_identifier =3D =
28;
if (flush && straight && !schtraight) hand_identifier =3D 29;
if (flush && !straight && schtraight) hand_identifier =3D 30;
}
if (number_of_cards =3D=3D 5)
{
if (card1_pips =3D=3D card2_pips) pair01 =3D 1;
if (card1_pips =3D=3D card3_pips) pair02 =3D 1;
if (card1_pips =3D=3D card4_pips) pair03 =3D 1;
if (card1_pips =3D=3D card5_pips) pair04 =3D 1;
if (card2_pips =3D=3D card3_pips) pair12 =3D 1;
if (card2_pips =3D=3D card4_pips) pair13 =3D 1;
if (card2_pips =3D=3D card5_pips) pair14 =3D 1;
if (card3_pips =3D=3D card4_pips) pair23 =3D 1;
if (card3_pips =3D=3D card5_pips) pair24 =3D 1;
if (card4_pips =3D=3D card5_pips) pair34 =3D 1;
number_of_pairs =3D pair01 + pair02 + pair03 + pair04 +
pair12 + pair13 + pair14 +
pair23 + pair24 +
pair34;
if (number_of_pairs =3D=3D 0) no_pairs =3D true;
if (number_of_pairs =3D=3D 1) single_pair =3D true;
if (number_of_pairs =3D=3D 2) two_pairs =3D true;
if (number_of_pairs =3D=3D 3) prial =3D true;
if (number_of_pairs =3D=3D 4) full_hand =3D true;
if (number_of_pairs =3D=3D 6) fours =3D true;
if (no_pairs)
{
if ((card1_suit =3D=3D card2_suit) && (card1_suit =3D=3D card3_suit) =
&& (card1_suit =3D=3D card4_suit) && (card1_suit =3D=3D card5_suit) &&
(card2_suit =3D=3D card3_suit) && (card2_suit =3D=3D card4_suit) =
&& (card2_suit =3D=3D card5_suit) &&
(card3_suit =3D=3D card4_suit) && (card3_suit =3D=3D card5_suit) =
&&
(card4_suit =3D=3D card5_suit)) flush =3D true;
if ((card1_pips - card2_pips =3D=3D 1) && (card2_pips - card3_pips =
=3D=3D 1) && (card3_pips - card4_pips =3D=3D 1) && (card4_pips - =
card5_pips =3D=3D 1)) straight =3D true;
if ((card1_pips =3D=3D 13) && (card2_pips =3D=3D 12) && (card3_pips =
=3D=3D 11) && (card4_pips =3D=3D 10) && (card5_pips =3D=3D 1)) straight =
=3D true;
}
if (no_pairs && !flush && !straight && !schtraight) hand_identifier =
=3D 31;
if (single_pair && !flush && !straight && !schtraight) hand_identifier =
=3D 32;
if (two_pairs && !flush && !straight && !schtraight) hand_identifier =
=3D 33;
if (flush && !straight && !schtraight) hand_identifier =3D 34;
if (prial && !flush && !straight && !schtraight) hand_identifier =3D =
35;
if (full_hand && !flush && !straight && !schtraight) hand_identifier =
=3D 36;
if (!flush && straight && !schtraight) hand_identifier =3D 37;
if (fours && !flush && !straight && !schtraight) hand_identifier =3D =
38;
if (flush && straight && !schtraight) hand_identifier =3D 39;
}
return hand_identifier;
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
////////////////// EVALUATE HANDS BEFORE UNT AFTER =
FUNCTION //////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
int evaluate_before_unt_after_hands(int before[5], int after[5])
{
int beforeski =3D 0, afterski =3D 0;
int igta =3D 0; // I'll give that a .... eg .... Adding a 4 of =
diamonds to a 2,3,5 of diamonds .... I'll give that a 40!!
int skore[136];
// -2 - 0 cards: you are holding onto a hand made of thin air
// -1 - 1 card: you have a card. But is it a hand?
// 0 - 2 cards: bum hand
// 1 - 2 cards: pair
// 2 - 2 cards: flush
// 3 - 2 cards: straight (A-2, 4-5, 6-7, 9-10, J-Q, K-A)
// 4 - 2 cards: "schtraight" (A-3, 4-6, 6-8, 9-J, Q-A ... one filler =
card required)
// 5 - 2 cards: bum "schtraight" (A-4, 4-7, 6-9, 9-Q, J-A ... two =
filler cards required)
// 6 - 2 cards: dog "schtraight" (A-5, 4-8, 6-10, 9-K, 10-A ... three =
filler cards required)
// 7 - 2 cards: straight flush
// 8 - 2 cards: "schtraight" flush
// 9 - 2 cards: bum "schtraight" flush
// 10 - 2 cards: dog "schtraight" flush
// 11 - 3 cards: bum hand
// 12 - 3 cards: pair
// 13 - 3 cards: flush
// 14 - 3 cards: prial
// 15 - 3 cards: straight (A-2-3, 6-7-8, Q-K-A)
// 16 - 3 cards: "schtraight" (A-2-4, A-3-4, 6-7-9, J-K-A ... one =
filler card required)
// 17 - 3 cards: bum "schtraight" (A-2-5, A-3-5, A-4-5, 6-8-10, 10-J-A =
.... two filler cards required)
// 18 - 3 cards: straight flush
// 19 - 3 cards: "schtraight" flush
// 20 - 3 cards: bum "schtraight" flush
// 21 - 4 cards: bum hand
// 22 - 4 cards: pair
// 23 - 4 cards: two pairs
// 24 - 4 cards: flush
// 25 - 4 cards: prial
// 26 - 4 cards: straight (A-2-3-4, 6-7-8-9, J-Q-K-A)
// 27 - 4 cards: "schtraight" (A-3-4-5, 6-8-9-10, 10-J-K-A ... one =
filler card required)
// 28 - 4 cards: fours
// 29 - 4 cards: straight flush
// 30 - 4 cards: "schtraight" flush
// 31 - 5 cards: bum hand
// 32 - 5 cards: pair
// 33 - 5 cards: two pairs
// 34 - 5 cards: flush
// 35 - 5 cards: prial
// 36 - 5 cards: full hand
// 37 - 5 cards: straight
// 38 - 5 cards: fours
// 39 - 5 cards: straight flush
// =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
// SCORE BEFORE AFTER COMMENT
// =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
skore[0] =3D -10; // -1 0 1 card made into a 2 card bum =
hand
skore[1] =3D 10; // -1 1 1 card made into a 2 card pair
skore[2] =3D 4; // -1 2 1 card made into a 2 card flush
skore[3] =3D 5; // -1 3 1 card made into a 2 card =
straight
skore[4] =3D 3; // -1 4 1 card made into a 2 card =
"schtraight"
skore[5] =3D 1; // -1 5 1 card made into a 2 card bum =
"schtraight"
skore[6] =3D -1; // -1 6 1 card made into a 2 card dog =
"schtraight"
skore[7] =3D 12; // -1 7 1 card made into a 2 card =
straight flush
skore[8] =3D 10; // -1 8 1 card made into a 2 card =
"schtraight" flush
skore[9] =3D 8; // -1 9 1 card made into a 2 card bum =
"schtraight" flush
skore[10] =3D 6; // -1 10 1 card made into a 2 card dog =
"schtraight" flush
skore[11] =3D -5; // 0 11 2 card bum hand not improved =
upon
skore[12] =3D 6; // 0 12 2 card bum hand improved to a 3 =
card pair
skore[13] =3D -15; // 1 12 2 card pair not improved upon
skore[14] =3D 50; // 1 14 2 card pair improved to a 3 =
card prial
skore[15] =3D -8; // 2 11 2 card flush buggered up
skore[16] =3D 8; // 2 12 2 card flush made into a 3 card =
pair
skore[17] =3D 15; // 2 13 2 card flush improved to a 3 =
card flush
skore[18] =3D -10; // 3 11 2 card straight buggered up
skore[19] =3D -2; // 3 12 2 card straight made into a 3 =
card pair
skore[20] =3D 20; // 3 15 2 card straight improved to a 3 =
card straight
skore[21] =3D 12; // 3 16 2 card straight improved to a 3 =
card "schtraight"
skore[22] =3D 4; // 3 17 2 card straight improved to a 3 =
card bum "schtraight"
skore[23] =3D -6; // 4 11 2 card "schtraight" buggered up
skore[24] =3D 0; // 4 12 2 card "schtraight" made into a =
3 card pair
skore[25] =3D 25; // 4 15 2 card "schtraight" improved to =
a 3 card straight
skore[26] =3D 18; // 4 16 2 card "schtraight" improved to =
a 3 card "schtraight"
skore[27] =3D 8; // 4 17 2 card "schtraight" improved to =
a 3 card bum "schtraight"
skore[28] =3D -2; // 5 11 2 card bum "schtraight" =
buggered up
skore[29] =3D 2; // 5 12 2 card bum "schtraight" made =
into a 3 card pair
skore[30] =3D 24; // 5 16 2 card bum "schtraight" =
improved to a 3 card "schtraight"
skore[31] =3D 12; // 5 17 2 card bum "schtraight" =
improved to a 3 card bum "schtraight"
skore[32] =3D 2; // 6 11 2 card dog "schtraight" =
buggered up
skore[33] =3D 4; // 6 12 2 card dog "schtraight" made =
into a 3 card pair
skore[34] =3D 16; // 6 17 2 card dog "schtraight" =
improved to a 3 card bum "schtraight"
skore[35] =3D -20; // 7 11 2 card straight flush buggered =
up
skore[36] =3D -15; // 7 12 2 card straight flush made into =
a 3 card pair
skore[37] =3D -12; // 7 13 2 card straight flush made into =
a 3 card flush
skore[38] =3D 10; // 7 15 2 card straight flush made into =
a 3 card straight
skore[39] =3D 4; // 7 16 2 card straight flush made into =
a 3 card "schtraight"
skore[40] =3D -2; // 7 17 2 card straight flush made into =
a 3 card bum "schtraight"
skore[41] =3D 40; // 7 18 2 card straight flush improved =
to a 3 card straight flush
skore[42] =3D 25; // 7 19 2 card straight flush improved =
to a 3 card "schtraight" flush
skore[43] =3D 10; // 7 20 2 card straight flush improved =
to a 3 card bum "schtraight" flush
skore[44] =3D -18; // 8 11 2 card "schtraight" flush =
buggered up
skore[45] =3D -12; // 8 12 2 card "schtraight" flush made =
into a 3 card pair
skore[46] =3D -6; // 8 13 2 card "schtraight" flush made =
into a 3 card flush
skore[47] =3D -6; // 8 15 2 card "schtraight" flush made =
into a 3 card straight
skore[48] =3D -12; // 8 16 2 card "schtraight" flush made =
into a 3 card "schtraight"
skore[49] =3D -16; // 8 17 2 card "schtraight" flush made =
into a 3 card bum "schtraight"
skore[50] =3D 45; // 8 18 2 card "schtraight" flush =
improved to a 3 card straight flush
skore[51] =3D 30; // 8 19 2 card "schtraight" flush =
improved to a 3 card "schtraight" flush
skore[52] =3D 15; // 8 20 2 card "schtraight" flush =
improved to a 3 card bum "schtraight" flush
skore[53] =3D -16; // 9 11 2 card bum "schtraight" flush =
buggered up
skore[54] =3D -9; // 9 12 2 card bum "schtraight" flush =
made into a 3 card pair
skore[55] =3D 0; // 9 13 2 card bum "schtraight" flush =
made into a 3 card flush
skore[56] =3D -8; // 9 16 2 card bum "schtraight" flush =
made into a 3 card "schtraight"
skore[57] =3D 12; // 9 17 2 card bum "schtraight" flush =
made into a 3 card bum "schtraight"
skore[58] =3D 35; // 9 19 2 card bum "schtraight" flush =
improved to a 3 card "schtraight" flush
skore[59] =3D 20; // 9 20 2 card bum "schtraight" flush =
improved to a 3 card bum "schtraight" flush
skore[60] =3D -14; // 10 11 2 card dog "schtraight" flush =
buggered up
skore[61] =3D -6; // 10 12 2 card dog "schtraight" flush =
made into a 3 card pair
skore[62] =3D 12; // 10 13 2 card dog "schtraight" flush =
made into a 3 card flush
skore[63] =3D -8; // 10 17 2 card dog "schtraight" flush =
made into a 3 card bum "schtraight"
skore[64] =3D 25; // 10 20 2 card dog "schtraight" flush =
improved to a 3 card bum "schtraight" flush
skore[65] =3D 2; // 11 21 3 card bum hand not improved =
upon
skore[66] =3D 5; // 11 22 3 card bum hand improved to a 4 =
card pair
skore[67] =3D -6; // 12 22 3 card pair not improved upon
skore[68] =3D 45; // 12 25 3 card pair improved to a 4 =
card prial
skore[69] =3D 40; // 12 23 3 card pair improved to a 4 =
card two pair
skore[70] =3D -12; // 13 21 3 card flush buggered up
skore[71] =3D -8; // 13 22 3 card flush made into a 4 card =
pair
skore[72] =3D 25; // 13 24 3 card flush improved to a 4 =
card flush
skore[73] =3D -10; // 14 25 3 card prial not improved upon
skore[74] =3D 100; // 14 28 3 card prial improved to an all =
fours
skore[75] =3D -20; // 15 21 3 card straight buggered up
skore[76] =3D -16; // 15 22 3 card straight made into a 4 =
card pair
skore[77] =3D 26; // 15 26 3 card straight improved to a 4 =
card straight
skore[78] =3D 20; // 15 27 3 card straight improved to a 4 =
card "schtraight"
skore[79] =3D -16; // 16 21 3 card "schtraight" buggered up
skore[80] =3D -12; // 16 22 3 card "schtraight" made into a =
4 card pair
skore[81] =3D 30; // 16 26 3 card "schtraight" improved to =
a 4 card straight
skore[82] =3D 22; // 16 27 3 card "schtraight" improved to =
a 4 card "schtraight"
skore[83] =3D -12; // 17 21 3 card bum "schtraight" =
buggered up
skore[84] =3D -8; // 17 22 3 card bum "schtraight" made =
into a 4 card pair
skore[85] =3D 24; // 17 27 3 card bum "schtraight" =
improved to a 4 card "schtraight"
skore[86] =3D -35; // 18 21 3 card straight flush buggered =
up
skore[87] =3D -30; // 18 22 3 card straight flush made into =
a 4 card pair
skore[88] =3D -20; // 18 24 3 card straight flush made into =
a 4 card flush
skore[89] =3D -12; // 18 26 3 card straight flush made into =
a 4 card straight
skore[90] =3D -20; // 18 27 3 card straight flush made into =
a 4 card "schtraight"
skore[91] =3D 45; // 18 29 3 card straight flush improved =
to a 4 card straight flush
skore[92] =3D 36; // 18 30 3 card straight flush improved =
to a 4 card "schtraight" flush
skore[93] =3D -30; // 19 21 3 card "schtraight" flush =
buggered up
skore[94] =3D -25; // 19 22 3 card "schtraight" flush made =
into a 4 card pair
skore[95] =3D -15; // 19 24 3 card "schtraight" flush made =
into a 4 card flush
skore[96] =3D -6; // 19 26 3 card "schtraight" flush made =
into a 4 card straight
skore[97] =3D -15; // 19 27 3 card "schtraight" flush made =
into a 4 card "schtraight"
skore[98] =3D 49; // 19 29 3 card "schtraight" flush =
improved to a 4 card straight flush
skore[99] =3D 40; // 20 21 3 card bum "schtraight" flush =
buggered up
skore[100] =3D -25; // 20 22 3 card bum "schtraight" flush =
made into a 4 card pair
skore[101] =3D -20; // 20 24 3 card bum "schtraight" flush =
made into a 4 card flush
skore[102] =3D -10; // 20 26 3 card bum "schtraight" flush =
made into a 4 card straight
skore[103] =3D -10; // 20 27 3 card bum "schtraight" flush =
made into a 4 card "schtraight"
skore[104] =3D 44; // 20 30 3 card bum "schtraight" flush =
improved to a 4 card "schtraight" flush
skore[105] =3D 3; // 21 31 4 card bum hand not improved =
upon
skore[106] =3D 4; // 21 32 4 card bum hand improved to a 5 =
card pair
skore[107] =3D -7; // 22 32 4 card pair not improved upon
skore[108] =3D 30; // 22 35 4 card pair improved to a 5 =
card prial
skore[109] =3D 29; // 22 33 4 card pair improved to a 5 =
card two pair
skore[110] =3D -5; // 23 33 4 card two pair not improved =
upon
skore[111] =3D 90; // 23 36 4 card two pair improved to a =
full hand
skore[112] =3D -30; // 24 31 4 card flush buggered up
skore[113] =3D -28; // 24 32 4 card flush made into a 5 card =
pair
skore[114] =3D 50; // 24 34 4 card flush improved to a 5 =
card flush
skore[115] =3D -10; // 25 35 4 card prial not improved upon
skore[116] =3D 100; // 25 38 4 card prial improved to an all =
fours
skore[117] =3D 90; // 25 36 4 card prial improved to a full =
hand
skore[118] =3D -70; // 26 31 4 card straight buggered up
skore[119] =3D -68; // 26 32 4 card straight made into a 5 =
card pair
skore[120] =3D 80; // 26 37 4 card straight improved to a 5 =
card straight
skore[121] =3D -65; // 27 31 4 card "schtraight" buggered up
skore[122] =3D -63; // 27 32 4 card "schtraight" made into a =
5 card pair
skore[123] =3D 85; // 27 37 4 card "schtraight" improved to =
a 5 card straight
skore[124] =3D 0; // 28 38 4 card all fours not buggered =
up but strangely not improved upon either
skore[125] =3D -60; // 29 31 4 card straight flush buggered =
up
skore[126] =3D -58; // 29 32 4 card straight flush made into =
a 5 card pair
skore[127] =3D 48; // 29 34 4 card straight flush made into =
a 5 card flush
skore[128] =3D 10; // 29 37 4 card straight flush made into =
a 5 card straight
skore[129] =3D 200; // 29 39 4 card straight flush improved =
to a 5 card STRAIGHT FLUSH bejesus!
skore[130] =3D -55; // 30 31 4 card "schtraight" flush =
buggered up
skore[131] =3D -53; // 30 32 4 card "schtraight" flush made =
into a 5 card pair
skore[132] =3D 46; // 30 34 4 card "schtraight" flush made =
into a 5 card flush
skore[133] =3D 15; // 30 37 4 card "schtraight" flush made =
into a 5 card straight
skore[134] =3D 250; // 30 39 4 card "schtraight" flush =
improved to a 5 card STRAIGHT FLUSH bejesus!
beforeski =3D identify_hand(before);
afterski =3D identify_hand(after);
// Zeroise that *****
igta =3D 0;
// I don't have it with "switch" statements
if (beforeski =3D=3D -2) igta =3D 0;
if (beforeski =3D=3D -1)
{
if (afterski =3D=3D 0) igta =3D skore[0];
if (afterski =3D=3D 1) igta =3D skore[1];
if (afterski =3D=3D 2) igta =3D skore[2];
if (afterski =3D=3D 3) igta =3D skore[3];
if (afterski =3D=3D 4) igta =3D skore[4];
if (afterski =3D=3D 5) igta =3D skore[5];
if (afterski =3D=3D 6) igta =3D skore[6];
if (afterski =3D=3D 7) igta =3D skore[7];
if (afterski =3D=3D 8) igta =3D skore[8];
if (afterski =3D=3D 9) igta =3D skore[9];
if (afterski =3D=3D 10) igta =3D skore[10];
}
if (beforeski =3D=3D 0)
{
if (afterski =3D=3D 11) igta =3D skore[11];
if (afterski =3D=3D 12) igta =3D skore[12];
}
if (beforeski =3D=3D 1)
{
if (afterski =3D=3D 12) igta =3D skore[13];
if (afterski =3D=3D 14) igta =3D skore[14];
}
if (beforeski =3D=3D 2)
{
if (afterski =3D=3D 11) igta =3D skore[15];
if (afterski =3D=3D 12) igta =3D skore[16];
if (afterski =3D=3D 13) igta =3D skore[17];
}
if (beforeski =3D=3D 3)
{
if (afterski =3D=3D 11) igta =3D skore[18];
if (afterski =3D=3D 12) igta =3D skore[19];
if (afterski =3D=3D 15) igta =3D skore[20];
if (afterski =3D=3D 16) igta =3D skore[21];
if (afterski =3D=3D 17) igta =3D skore[22];
}
if (beforeski =3D=3D 4)
{
if (afterski =3D=3D 11) igta =3D skore[23];
if (afterski =3D=3D 12) igta =3D skore[24];
if (afterski =3D=3D 15) igta =3D skore[25];
if (afterski =3D=3D 16) igta =3D skore[26];
if (afterski =3D=3D 17) igta =3D skore[27];
}
if (beforeski =3D=3D 5)
{
if (afterski =3D=3D 11) igta =3D skore[28];
if (afterski =3D=3D 12) igta =3D skore[29];
if (afterski =3D=3D 16) igta =3D skore[30];
if (afterski =3D=3D 17) igta =3D skore[31];
}
if (beforeski =3D=3D 6)
{
if (afterski =3D=3D 11) igta =3D skore[32];
if (afterski =3D=3D 12) igta =3D skore[33];
if (afterski =3D=3D 17) igta =3D skore[34];
}
if (beforeski =3D=3D 7)
{
if (afterski =3D=3D 11) igta =3D skore[35];
if (afterski =3D=3D 12) igta =3D skore[36];
if (afterski =3D=3D 13) igta =3D skore[37];
if (afterski =3D=3D 15) igta =3D skore[38];
if (afterski =3D=3D 16) igta =3D skore[39];
if (afterski =3D=3D 17) igta =3D skore[40];
if (afterski =3D=3D 18) igta =3D skore[41];
if (afterski =3D=3D 19) igta =3D skore[42];
if (afterski =3D=3D 20) igta =3D skore[43];
}
if (beforeski =3D=3D 8)
{
if (afterski =3D=3D 11) igta =3D skore[44];
if (afterski =3D=3D 12) igta =3D skore[45];
if (afterski =3D=3D 13) igta =3D skore[46];
if (afterski =3D=3D 15) igta =3D skore[47];
if (afterski =3D=3D 16) igta =3D skore[48];
if (afterski =3D=3D 17) igta =3D skore[49];
if (afterski =3D=3D 18) igta =3D skore[50];
if (afterski =3D=3D 19) igta =3D skore[51];
if (afterski =3D=3D 20) igta =3D skore[52];
}
if (beforeski =3D=3D 9)
{
if (afterski =3D=3D 11) igta =3D skore[53];
if (afterski =3D=3D 12) igta =3D skore[54];
if (afterski =3D=3D 13) igta =3D skore[55];
if (afterski =3D=3D 16) igta =3D skore[56];
if (afterski =3D=3D 17) igta =3D skore[57];
if (afterski =3D=3D 19) igta =3D skore[58];
if (afterski =3D=3D 20) igta =3D skore[59];
}
if (beforeski =3D=3D 10)
{
if (afterski =3D=3D 11) igta =3D skore[60];
if (afterski =3D=3D 12) igta =3D skore[61];
if (afterski =3D=3D 13) igta =3D skore[62];
if (afterski =3D=3D 17) igta =3D skore[63];
if (afterski =3D=3D 20) igta =3D skore[64];
}
if (beforeski =3D=3D 11)
{
if (afterski =3D=3D 21) igta =3D skore[65];
if (afterski =3D=3D 22) igta =3D skore[66];
}
if (beforeski =3D=3D 12)
{
if (afterski =3D=3D 22) igta =3D skore[67];
if (afterski =3D=3D 25) igta =3D skore[68];
if (afterski =3D=3D 23) igta =3D skore[69];
}
if (beforeski =3D=3D 13)
{
if (afterski =3D=3D 21) igta =3D skore[70];
if (afterski =3D=3D 22) igta =3D skore[71];
if (afterski =3D=3D 24) igta =3D skore[72];
}
if (beforeski =3D=3D 14)
{
if (afterski =3D=3D 25) igta =3D skore[73];
if (afterski =3D=3D 28) igta =3D skore[74];
}
if (beforeski =3D=3D 15)
{
if (afterski =3D=3D 21) igta =3D skore[75];
if (afterski =3D=3D 22) igta =3D skore[76];
if (afterski =3D=3D 26) igta =3D skore[77];
if (afterski =3D=3D 27) igta =3D skore[78];
}
if (beforeski =3D=3D 16)
{
if (afterski =3D=3D 21) igta =3D skore[79];
if (afterski =3D=3D 22) igta =3D skore[80];
if (afterski =3D=3D 26) igta =3D skore[81];
if (afterski =3D=3D 27) igta =3D skore[82];
}
if (beforeski =3D=3D 17)
{
if (afterski =3D=3D 21) igta =3D skore[83];
if (afterski =3D=3D 22) igta =3D skore[84];
if (afterski =3D=3D 27) igta =3D skore[85];
}
if (beforeski =3D=3D 18)
{
if (afterski =3D=3D 21) igta =3D skore[86];
if (afterski =3D=3D 22) igta =3D skore[87];
if (afterski =3D=3D 24) igta =3D skore[88];
if (afterski =3D=3D 26) igta =3D skore[89];
if (afterski =3D=3D 27) igta =3D skore[90];
if (afterski =3D=3D 29) igta =3D skore[91];
if (afterski =3D=3D 30) igta =3D skore[92];
}
if (beforeski =3D=3D 19)
{
if (afterski =3D=3D 21) igta =3D skore[93];
if (afterski =3D=3D 22) igta =3D skore[94];
if (afterski =3D=3D 24) igta =3D skore[95];
if (afterski =3D=3D 26) igta =3D skore[96];
if (afterski =3D=3D 27) igta =3D skore[97];
if (afterski =3D=3D 29) igta =3D skore[98];
}
if (beforeski =3D=3D 20)
{
if (afterski =3D=3D 21) igta =3D skore[99];
if (afterski =3D=3D 22) igta =3D skore[100];
if (afterski =3D=3D 24) igta =3D skore[101];
if (afterski =3D=3D 26) igta =3D skore[102];
if (afterski =3D=3D 27) igta =3D skore[103];
if (afterski =3D=3D 30) igta =3D skore[104];
}
if (beforeski =3D=3D 21)
{
if (afterski =3D=3D 31) igta =3D skore[105];
if (afterski =3D=3D 32) igta =3D skore[106];
}
if (beforeski =3D=3D 22)
{
if (afterski =3D=3D 32) igta =3D skore[107];
if (afterski =3D=3D 35) igta =3D skore[108];
if (afterski =3D=3D 33) igta =3D skore[109];
}
if (beforeski =3D=3D 23)
{
if (afterski =3D=3D 33) igta =3D skore[110];
if (afterski =3D=3D 36) igta =3D skore[111];
}
if (beforeski =3D=3D 24)
{
if (afterski =3D=3D 31) igta =3D skore[112];
if (afterski =3D=3D 32) igta =3D skore[113];
if (afterski =3D=3D 34) igta =3D skore[114];
}
if (beforeski =3D=3D 25)
{
if (afterski =3D=3D 35) igta =3D skore[115];
if (afterski =3D=3D 38) igta =3D skore[116];
if (afterski =3D=3D 36) igta =3D skore[117];
}
if (beforeski =3D=3D 26)
{
if (afterski =3D=3D 31) igta =3D skore[118];
if (afterski =3D=3D 32) igta =3D skore[119];
if (afterski =3D=3D 37) igta =3D skore[120];
}
if (beforeski =3D=3D 27)
{
if (afterski =3D=3D 31) igta =3D skore[121];
if (afterski =3D=3D 32) igta =3D skore[122];
if (afterski =3D=3D 37) igta =3D skore[123];
}
if (beforeski =3D=3D 28)
{
if (afterski =3D=3D 38) igta =3D skore[124];
}
if (beforeski =3D=3D 29)
{
if (afterski =3D=3D 31) igta =3D skore[125];
if (afterski =3D=3D 32) igta =3D skore[126];
if (afterski =3D=3D 34) igta =3D skore[127];
if (afterski =3D=3D 37) igta =3D skore[128];
if (afterski =3D=3D 39) igta =3D skore[129];
}
if (beforeski =3D=3D 30)
{
if (afterski =3D=3D 31) igta =3D skore[130];
if (afterski =3D=3D 32) igta =3D skore[131];
if (afterski =3D=3D 34) igta =3D skore[132];
if (afterski =3D=3D 37) igta =3D skore[133];
if (afterski =3D=3D 39) igta =3D skore[134];
}
return igta;
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////////////////////////////// M A I N F U N C T I O N =
////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
void main(void)=20
{
int card_counter;
int table[11][11];
int i, j, k, x, y, z; // Multi-purpose variables
int row, column, orig_row, orig_col, right, left, top, bottom, high, =
wide;
int pozzish; // The positional counter ... goes from 0 =
to 7
int numeric_suit_identifier;
int the5cards_before[5];
int the5cards_after[5];
int random_number;
struct card
{
int numero;
char pips[3];
char suit[2];
int card_id;
};
int compass_score[8][4]; =20
// The compass_score array
// compass_score[n][0] holds LEGAL POSITION: 0 is illegal, 1 is legal =
....=20
// a legal position doesn't neccessarily mean that the game will be =
completble,=20
// it merely means that it's within the 5x5 matrix
//=20
// compass_score[n][1] holds VERTICAL SCORE for "n"th element
// compass_score[n][2] holds HORIZONTAL SCORE for "n"th element
// compass_score[n][3] holds TOTAL SCORE for "n"th element
bool tchbdf =3D false; // This card has been dealt =
before
bool legal_position =3D false; // Not a legal position =
guv'nor, I'm afraid
int sihl =3D 0; //stick it here luvva, =
place card at pozzish(sihl) for best score...
int slog =3D 0;
int p =3D 0;
int sorted_compass_score_array[8];
int total_score[8];
int the_number_8 =3D 8;
int skr =3D 0;
int element =3D 0;
bool pcot =3D false; //Place card on table?
int place_card_here =3D 0; // Please can I place the card on the =
table here? 0=3DE, 1=3DSE, 2=3DS, 3=3DSW, 4=3DW, 5=3DNW, 6=3DN, 7=3DNE =
.... compass point style
bool can_do =3D false;
int v_row, v_column, v_place_card_here, v_card_counter, =
copy_of_table[11][11];
bool card_placeable =3D false;
bool completable =3D false;
bool new_card =3D true;
bool resolved_it =3D false;
int crack[26][3];
int current_card =3D 0;
int pozzy =3D 0, backstop =3D 0, save_row =3D 0, save_column =3D 0;
int hygh =3D 0, wyde =3D 0, q_bottom =3D 0, q_top =3D 0, q_right =3D 0, =
q_left =3D 0;
int vertical_hand[5], horizontal_hand[5];
int identum =3D 0;
int current_game =3D 0;
int vertical_wall[5], horizontal_wall[5];
int scoot;
bool no_walls; // Sausages
int nogtp =3D 50; // Number of games to play
int vertical_score[5], horizontal_score[5];
int best_score_ever =3D 0, worse_score_ever =3D 0;
int best_game_ever =3D 0, worst_game_ever =3D 0;
int score_for_this_game =3D 0, score_tally =3D 0;
int bum_hands =3D 0, one_pairs =3D 0, two_pairs =3D 0, flushes =3D 0, =
prials =3D 0, full_hands =3D 0, straights =3D 0, fours =3D 0, =
straight_flushes =3D 0;
float average_score_per_game =3D 0;
float anpg_bum_hands =3D 0, anpg_one_pairs =3D 0, anpg_two_pairs =3D 0, =
anpg_flushes =3D 0, anpg_prials =3D 0, anpg_full_hands =3D 0, =
anpg_straights =3D 0, anpg_fours =3D 0, anpg_straight_flushes =3D 0; =
// anpg =3D average number per game
float start_time =3D 0, stop_time =3D 0, time_taken =3D 0, =
average_time_per_game =3D 0;
start_time =3D time(NULL);
ofstream phile ("results.txt");
//Seed rand() with current time
srand(unsigned(time(NULL)));
for(current_game=3D1; current_game <=3D nogtp; current_game++)
{
// A bit of screen output just to let ya know what gives
// cout<<"Game number - "<<current_game<<" ... Card number - =
"<<card_counter<<endl;
card the25[25];
//Zeroise card array
for(i=3D0; i !=3D 25; i++)=20
{
the25[i].numero =3D 0;
strcpy(the25[i].pips, " ");
strcpy(the25[i].suit, " ");
the25[i].card_id =3D 0;
}
//Zeroise table array
for(x=3D0; x<=3D10; x++)
for(y=3D0; y<=3D10; y++)
table[x][y] =3D 0;
for(card_counter=3D0; card_counter <=3D 24; card_counter++)=20
{
// A bit of screen output just to let ya know what gives
cout<<"Game number - "<<current_game<<" ... Card number - =
"<<card_counter+1<<endl;
random_number =3D RandInt(1,52); // Will be between 1 & 52 =20
=20
// This is the first card dealt ... no need to check to see if it's a =
duplicate.
if (card_counter =3D=3D 0) tchbdf =3D false;
// This is not the first card dealt.=20
// Need to check to see if the RNG has dealt this card previously.
if (card_counter !=3D 0) tchbdf =3D true;
while (tchbdf)
{
for(j=3D0; j<=3Dcard_counter; j++)
{
tchbdf =3D false;
if (the25[j].numero =3D=3D random_number)
// Alert! Card matches previously dealt card!
{
tchbdf =3D true;
// Deal me a PROPER card please Random Number Generator NOT a =
DUPLICATE.
random_number =3D RandInt(1,52); // Will be between 1 & 52
break;
}
}
}
// Okay, you have a unique card, friend, now crack on ...=20
// Writing card to array ...
the25[card_counter].numero =3D random_number;
//Okay, so here are the cards:
//Hearts.....(King o' Hearts is a lover and he give her everything)
=
//1=3D2H....2=3D3H...3=3D4H...4=3D5H...5=3D6H...6=3D7H...7=3D8H...8=3D9H.=
...9=3D10H..10=3DJH..11=3DQH..12=3DKH..13=3DAH
//Diamonds...(King o' Diamonds is a wedding ring)
=
//14=3D2D..15=3D3D..16=3D4D..17=3D5D..18=3D6D..19=3D7D..20=3D8D..21=3D9D.=
..22=3D10D..23=3DJD..24=3DQD..25=3DKD..26=3DAD
//Clubs......(King o' Clubs makes a dollar)
=
//27=3D2C..28=3D3C..29=3D4C..30=3D5C..31=3D6C..32=3D7C..33=3D8C..34=3D9C.=
..35=3D10C..36=3DJC..37=3DQC..38=3DKC..39=3DAC
//Spades.....(King o' Spades he's a brother, doing his own thing)
=
//40=3D2S..41=3D3S..42=3D4S..43=3D5S..44=3D6S..45=3D7S..46=3D8S..47=3D9S.=
..48=3D10S..49=3DJS..50=3DQS..51=3DKS..52=3DAS
if ((the25[card_counter].numero % 13) =3D=3D 1) =
strcpy(the25[card_counter].pips, " 2");
if ((the25[card_counter].numero % 13) =3D=3D 2) =
strcpy(the25[card_counter].pips, " 3");
if ((the25[card_counter].numero % 13) =3D=3D 3) =
strcpy(the25[card_counter].pips, " 4");
if ((the25[card_counter].numero % 13) =3D=3D 4) =
strcpy(the25[card_counter].pips, " 5");
if ((the25[card_counter].numero % 13) =3D=3D 5) =
strcpy(the25[card_counter].pips, " 6");
if ((the25[card_counter].numero % 13) =3D=3D 6) =
strcpy(the25[card_counter].pips, " 7");
if ((the25[card_counter].numero % 13) =3D=3D 7) =
strcpy(the25[card_counter].pips, " 8");
if ((the25[card_counter].numero % 13) =3D=3D 8) =
strcpy(the25[card_counter].pips, " 9");
if ((the25[card_counter].numero % 13) =3D=3D 9) =
strcpy(the25[card_counter].pips, "10");
if ((the25[card_counter].numero % 13) =3D=3D 10) =
strcpy(the25[card_counter].pips, " J");
if ((the25[card_counter].numero % 13) =3D=3D 11) =
strcpy(the25[card_counter].pips, " Q");
if ((the25[card_counter].numero % 13) =3D=3D 12) =
strcpy(the25[card_counter].pips, " K");
if ((the25[card_counter].numero % 13) =3D=3D 0) =
strcpy(the25[card_counter].pips, " A");
if ((the25[card_counter].numero >=3D 1) && (the25[card_counter].numero =
<=3D 13))=20
{
strcpy(the25[card_counter].suit, "H");
numeric_suit_identifier =3D 1;
}
if ((the25[card_counter].numero >=3D 14) && =
(the25[card_counter].numero <=3D 26))=20
{
strcpy(the25[card_counter].suit, "D");
numeric_suit_identifier =3D 2;
}
if ((the25[card_counter].numero >=3D 27) && =
(the25[card_counter].numero <=3D 39))=20
{
strcpy(the25[card_counter].suit, "C");
numeric_suit_identifier =3D 3;
}
if ((the25[card_counter].numero >=3D 40) && =
(the25[card_counter].numero <=3D 52))=20
{
strcpy(the25[card_counter].suit, "S");
numeric_suit_identifier =3D 4;
}
//The next line gives each dealt card a unique numeric identifier =
which makes array sorting
//and the identification of poker hands much easier later in the =
program ... See card_id.txt
//See card_id_silly.txt for my original card identification system and =
the associated floating point grief.
the25[card_counter].card_id =3D (100 * ((the25[card_counter].numero % =
13) + 1)) + numeric_suit_identifier;
//This gives a nice four digit I=3DN=3DT=3DE=3DG=3DR=3DA=3DL =
identification to the card ....=20
//Don't ***** with floats and doubles when you can stick to good old =
"int".=20
//Who needs to find out that this "3" doesn't "EQUAL" that "3" because =
it differs by 8.88178e-015? ***** it!!!
//So yeah ... Silly me ... I was comparing "3" to =
"2.99999999999999111822" and expecting a true!!! Dunce!!
if (card_counter =3D=3D 0)
// If it's the first card on the table then position it on the table =
at (5,5)
{
row =3D 5;
column =3D 5;
table[row][column] =3D card_counter + 1;
}
// Otherwise ...
if (card_counter >=3D 1)
{
//Zeroise the compass_score array for forthcoming processing
for(x=3D0; x<=3D7; x++)
{
compass_score[x][0] =3D 0;
compass_score[x][1] =3D 0;
compass_score[x][2] =3D 0;
compass_score[x][3] =3D 0;
}
orig_row =3D row;
orig_col =3D column;
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
////////////////////////////////// P O Z Z I S H L O O P =
/////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
////////////////////////////////////////// B E G I N =
/////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
// Plough through the eight possible positions to determine where =
best to place card
for(pozzish=3D0; pozzish<=3D7; pozzish++)
// There are generally eight possible positions for the drawn card to =
be placed ... clockwise from "East"
//
// Position 5 Position 6 Position 7
// (r-1,c-1) (r-1,c) (r-1,c+1)
//
// Position 4 Position 0
// (r,c-1) (r,c) (r,c+1)
//
// Position 3 Position 2 Position 1
// (r+1,c-1) (r+1,c) (r+1,c+1)
{
// What you wanna do here is slog through all eight possible =
positions ...
// With each possible position 0 through 7 do the following ...
// 1 ... Check to see if the card can be placed on the table ...
// (i) And will not replace an already existing card in the =
table
// (ii) And fits within the 5 x 5 frame reference
// 2 ... If it does then score it vertically & horizontlly
// This is handled by function evaluate_hand(...)
// 3 ... When you've done this for all eight positions sort the =
score array
// 4 ... Starting with the highest score see if game is completable
// This is handled by function go_figure(...)
// 5 ... Place card in first available position
// 6 ... Update row & column variables accordingly
if ((pozzish =3D=3D 5) || (pozzish =3D=3D 6) || (pozzish =3D=3D 7)) =
row--;
if ((pozzish =3D=3D 3) || (pozzish =3D=3D 2) || (pozzish =3D=3D 1)) =
row++;
if ((pozzish =3D=3D 5) || (pozzish =3D=3D 4) || (pozzish =3D=3D 3)) =
column--;
if ((pozzish =3D=3D 7) || (pozzish =3D=3D 0) || (pozzish =3D=3D 1)) =
column++;
legal_position =3D true;
if (table[row][column] !=3D 0) legal_position =3D false;
if (card_counter >=3D 5)
{
if ((row < 0) || (row > 10)) legal_position =3D false;
if ((column < 0) || (column > 10)) legal_position =3D false;
=20
// Find top, bottom, left & right of table array ... longwinded
top =3D find_top(table);
bottom =3D find_bottom(table);
left =3D find_left(table);
right =3D find_right(table);
wide =3D right - left + 1;
high =3D bottom - top + 1;
=20
if (((wide =3D=3D 5) && ((column < left) || (column > right))) || =
((high =3D=3D 5) && ((row < top) || (row > bottom)))) legal_position =3D =
false;
}
if (legal_position)
{
// Evaluate score for vertical hand
//Zeroise the5cards_before & after arrays
for(i=3D0; i<=3D4; i++)
the5cards_before[i] =3D 0;
for(i=3D0; i<=3D4; i++)
the5cards_after[i] =3D 0;
j =3D 0;
for(i=3D0; i<=3D10; i++)
{
if (table[i][column] !=3D 0)=20
{
the5cards_before[j] =3D the25[table[i][column]-1].card_id;
j++;
}
}
for(i=3D0; i<=3D4; i++)
the5cards_after[i] =3D the5cards_before[i];
//And now add in the current card at the end position
the5cards_after[4] =3D the25[card_counter].card_id;
compass_score[pozzish][1] =3D =
evaluate_before_unt_after_hands(the5cards_before, the5cards_after);
// Evaluate score for horizontal hand
//Zeroise the5cards_before & after arrays
for(i=3D0; i<=3D4; i++)
the5cards_before[i] =3D 0;
for(i=3D0; i<=3D4; i++)
the5cards_after[i] =3D 0;
j =3D 0;
for(i=3D0; i<=3D10; i++)
{
if (table[row][i] !=3D 0)=20
{
the5cards_before[j] =3D the25[table[row][i]-1].card_id;
j++;
}
}
for(i=3D0; i<=3D4; i++)
the5cards_after[i] =3D the5cards_before[i];
//And now add in the current card at the end position
the5cards_after[4] =3D the25[card_counter].card_id;
compass_score[pozzish][2] =3D =
evaluate_before_unt_after_hands(the5cards_before, the5cards_after);
// Add 'em together
compass_score[pozzish][3] =3D compass_score[pozzish][1] + =
compass_score[pozzish][2];
=20
}
if (!legal_position) compass_score[pozzish][0] =3D 0;
if (legal_position) compass_score[pozzish][0] =3D 1;
// Reset row & column positions
row =3D orig_row;
column =3D orig_col;
// Next!!!
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
////////////////////////////////// P O Z Z I S H L O O P =
/////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
//////////////////////////////////////////// E N D =
///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
// Right so here we are .... and we should have an array called =
compass_score containing the legal_position,
// horizontal, vertical & total scores for each of the 8 possible =
card placement positions (E, SE, S, SW, W, NW, N & NE).
//
// compass_score[n][0] compass_score[n][1] compass_score[n][2] =
compass_score[n][3] =20
// LEGAL VERTICAL HORIZONTAL =
TOTAL
// POSITION? SCORE SCORE =
SCORE
// 0 1 5 0 =
5
// 1 0 0 0 =
0
// 2 1 -30 0 =
-30
// 3 0 12 13 =
25
// 4 1 -5 10 =
5
// 5 1 80 -30 =
50
// 6 0 -25 30 =
5
// 7 0 15 10 =
25
//
// Thus the sorted_compass_score_array[] array would contain {5, 3, =
7, 0, 4, 6, 1, 2} .. or it had better know why not
// So ... we need to create this sorted_compass_score_array[] and =
fill it with said elements ...
=20
// First up, we'll make a copy of just the TOTAL SCORE
for(i=3D0; i<=3D7; i++) total_score[i] =3D compass_score[i][3];
// Now sort this total_score array ... This will fill the array in =
ascending order ... thus {-30, 0, 5, 5, 5, 25, 25 ,50}
sort(total_score, total_score + the_number_8);
skr =3D -999;
k =3D 0;
for(i=3D7; i>=3D0; i--)=20
{
if (skr !=3D total_score[i])
{
for(j=3D0; j<=3D7; j++)
{
if (compass_score[j][3] =3D=3D total_score[i])
{
sorted_compass_score_array[k] =3D j;
k++;
}
}=20
}
skr =3D total_score[i];
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////////////////////////////// S L O G L O O P =
////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
////////////////////////////////////////// B E G I N =
/////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
=20
=20
// Now slog through sorted_compass_score_array & try and assess if =
card is placeable ....
for(slog=3D0; slog<=3D7; slog++)
// SLOG BEGIN
{
place_card_here =3D sorted_compass_score_array[slog];
if (compass_score[place_card_here][0] =3D=3D 0) can_do =3D false;
if (compass_score[place_card_here][0] =3D=3D 1) can_do =3D true;
if ((card_counter >=3D 1) && (card_counter <=3D 4))
{
// Don't worry about checking if position valid, first 5 cards on =
table impossible to bungle ... Stick 'em where you like
} =20
if (card_counter =3D=3D 5)
{
// HEREWITH VALIDATION FOR PLACEMENT OF SIXTH CARD
// This sort of checking was originally left to the jolly old=20
// go_figure routine but the capture of these here 17 individual=20
// instances of "no_can_do"-ability makes program MUCHO QUICKER.
// As you can see, the placement of the first 6 cards is quite =
tricky
// and can easily (without validation) lead to a mullered game =
and
// a dead game with only 6 cards placed on the table is something =
// I am really not interested in, not even a little bit. So =
there.
// I think I've got all valid instances of circumstances whereby
// the placement of the 6th card leads to a dead game but I ... =
er
// .... do .... ahem .... I do keep finding new ones. The old =
program
// (the Borland C++ Builder 1.0) only listed 10 of the 17 =
detailed here.
// Instance 1 (loft ladder)
// x x 1 2 3 x x
// x x x x 4 5 6
// x x x x x x x
//if ((table[5][6] =3D=3D 2) && (table[5][7] =3D=3D 3) && =
(table[6][7] =3D=3D 4) && (table[6][8] =3D=3D 5) && (place_card_here =
=3D=3D 0)) can_do =3D false;
// Instance 2 (loft ladder)
// x x 1 2 4 x x
// x x x x 3 5 6
// x x x x x x x
//if ((table[5][6] =3D=3D 2) && (table[6][7] =3D=3D 3) && =
(table[5][7] =3D=3D 4) && (table[6][8] =3D=3D 5) && (place_card_here =
=3D=3D 0)) can_do =3D false;
// Instance 3 (monkey wrench)
// x x 1 2 3 4 x
// x x x x x 5 6
// x x x x x x x
//if ((table[5][6] =3D=3D 2) && (table[5][7] =3D=3D 3) && =
(table[5][8] =3D=3D 4) && (table[6][8] =3D=3D 5) && (place_card_here =
=3D=3D 0)) can_do =3D false;
// Instance 4 (monkey wrench)
// x x 1 2 3 4 x
// x x x x x 6 5
// x x x x x x x
//if ((table[5][6] =3D=3D 2) && (table[5][7] =3D=3D 3) && =
(table[5][8] =3D=3D 4) && (table[6][9] =3D=3D 5) && (place_card_here =
=3D=3D 4)) can_do =3D false;
// Instance 5 (monkey wrench)
// x x 1 2 3 5 x
// x x x x x 4 6
// x x x x x x x
//if ((table[5][6] =3D=3D 2) && (table[5][7] =3D=3D 3) && =
(table[6][8] =3D=3D 4) && (table[5][8] =3D=3D 5) && (place_card_here =
=3D=3D 1)) can_do =3D false;
// Instance 6 (monkey wrench)
// x x 1 2 3 6 x
// x x x x x 4 5
// x x x x x x x
//if ((table[5][6] =3D=3D 2) && (table[5][7] =3D=3D 3) && =
(table[6][8] =3D=3D 4) && (table[6][9] =3D=3D 5) && (place_card_here =
=3D=3D 5)) can_do =3D false;
// Instance 7 (monkey wrench)
// x x 1 2 x x x
// x x x 3 4 5 6
// x x x x x x x
//if ((table[5][6] =3D=3D 2) && (table[6][6] =3D=3D 3) && =
(table[6][7] =3D=3D 4) && (table[6][8] =3D=3D 5) && (place_card_here =
=3D=3D 0)) can_do =3D false;
// Instance 8 (monkey wrench)
// x x x 1 2 x x
// 6 5 4 3 x x x
// x x x x x x x
//if ((table[5][6] =3D=3D 2) && (table[6][5] =3D=3D 3) && =
(table[6][4] =3D=3D 4) && (table[6][3] =3D=3D 5) && (place_card_here =
=3D=3D 4)) can_do =3D false;
// Instance 9 (monkey wrench)
// x 1 x x
// x 3 2 x
// x x 4 x
// x x 5 x
// x x 6 x
// x x x x
//if ((table[6][6] =3D=3D 2) && (table[6][5] =3D=3D 3) && =
(table[7][6] =3D=3D 4) && (table[8][6] =3D=3D 5) && (place_card_here =
=3D=3D 2)) can_do =3D false;
// Instance 10 (monkey wrench)
// 6 5 4 1 x x
// x x x 3 2 x
// x x x x x x
//if ((table[6][6] =3D=3D 2) && (table[6][5] =3D=3D 3) && =
(table[5][4] =3D=3D 4) && (table[5][3] =3D=3D 5) && (place_card_here =
=3D=3D 4)) can_do =3D false;
// Instance 11 (monkey wrench)
// x 1 3 x x x
// x x 2 4 5 6
// x x x x x x
//if ((table[6][6] =3D=3D 2) && (table[5][6] =3D=3D 3) && =
(table[6][7] =3D=3D 4) && (table[6][8] =3D=3D 5) && (place_card_here =
=3D=3D 0)) can_do =3D false;
// Instance 12 (buttercup)
// x 1 x x x x
// x x 2 x x x
// x x x 3 x x
// x x x x 4 5
// x x x x 6 x
// x x x x x x
//if ((table[6][6] =3D=3D 2) && (table[7][7] =3D=3D 3) && =
(table[8][8] =3D=3D 4) && (table[8][9] =3D=3D 5) && (place_card_here =
=3D=3D 3)) can_do =3D false;
// Instance 13 (buttercup)
// x 1 x x x x
// x x 2 x x x
// x x x 3 x x
// x x x x 4 6
// x x x x 5 x
// x x x x x x
//if ((table[6][6] =3D=3D 2) && (table[7][7] =3D=3D 3) && =
(table[8][8] =3D=3D 4) && (table[9][8] =3D=3D 5) && (place_card_here =
=3D=3D 7)) can_do =3D false;
// Instance 14 (butterfly wings)
// x x x 1 x x
// x x x 3 2 x
// x 6 4 x x x
// x x 5 x x x
// x x x x x x
//if ((table[6][6] =3D=3D 2) && (table[6][5] =3D=3D 3) && =
(table[7][4] =3D=3D 4) && (table[8][4] =3D=3D 5) && (place_card_here =
=3D=3D 5)) can_do =3D false;
// Instance 15 (butterfly wings)
// x x x 1 x x
// x x x 3 2 x
// x 5 4 x x x
// x x 6 x x x
// x x x x x x
//if ((table[6][6] =3D=3D 2) && (table[6][5] =3D=3D 3) && =
(table[7][4] =3D=3D 4) && (table[7][3] =3D=3D 5) && (place_card_here =
=3D=3D 1)) can_do =3D false;
// Instance 16 (butterfly wings)
// x x x x x x
// x x x 5 x x
// x x x 4 6 x
// x 1 3 x x x
// x x 2 x x x
//if ((table[6][6] =3D=3D 2) && (table[5][6] =3D=3D 3) && =
(table[4][7] =3D=3D 4) && (table[3][7] =3D=3D 5) && (place_card_here =
=3D=3D 1)) can_do =3D false;
// Instance 17 (butterfly wings)
// x x x x x x
// x x x 6 x x
// x x x 4 5 x
// x 1 3 x x x
// x x 2 x x x
//if ((table[6][6] =3D=3D 2) && (table[5][6] =3D=3D 3) && =
(table[4][7] =3D=3D 4) && (table[4][8] =3D=3D 5) && (place_card_here =
=3D=3D 5)) can_do =3D false;
// And that should be it ...
// Because of the way cards are placed (E-SE-S-SW-W-NW-N-NE) the =
only two possible starts are ...
// x x x x
// x 1 2 x
// x x x x
// ... as above if the computer likes the match between 1st and =
2nd card (ie a pair, same suit, or has straight potential) or ...
// x x x x
// x 1 x x
// x x 2 x
// x x x x
// ... as above if the computer dislikes the match between 1st =
and 2nd card (ie the two cards are no good for nothing) ...
// Above block restructured ... This will save a couple of picoseconds =
per game ...
if (table[5][6] =3D=3D 2)
{
if (table[5][7] =3D=3D 3)=20
{
if ((table[6][7] =3D=3D 4) && (table[6][8] =3D=3D 5) && =
(place_card_here =3D=3D 0)) can_do =3D false; // Instance 1
if (table[5][8] =3D=3D 4)
{
if ((table[6][8] =3D=3D 5) && (place_card_here =3D=3D 0)) can_do =3D =
false; // Instance 3
if ((table[6][9] =3D=3D 5) && (place_card_here =3D=3D 4)) can_do =3D =
false; // Instance 4
}
if (table[6][8] =3D=3D 4)
{
if ((table[5][8] =3D=3D 5) && (place_card_here =3D=3D 1)) can_do =3D =
false; // Instance 5
if ((table[6][9] =3D=3D 5) && (place_card_here =3D=3D 5)) can_do =3D =
false; // Instance 6
}
}
if ((table[6][8] =3D=3D 5) && (place_card_here =3D=3D 0))
{
if ((table[6][7] =3D=3D 3) && (table[5][7] =3D=3D 4)) can_do =3D =
false; // Instance 2
if ((table[6][6] =3D=3D 3) && (table[6][7] =3D=3D 4)) can_do =3D =
false; // Instance 7
}
if ((table[6][5] =3D=3D 3) && (table[6][4] =3D=3D 4) && (table[6][3] =
=3D=3D 5) && (place_card_here =3D=3D 4)) can_do =3D false; // =
Instance 8
}
else if (table[6][6] =3D=3D 2)
{
if (table[6][5] =3D=3D 3)
{
if (table[7][4] =3D=3D 4)=20
{
if ((table[8][4] =3D=3D 5) && (place_card_here =3D=3D 5)) can_do =3D =
false; // Instance 14
if ((table[7][3] =3D=3D 5) && (place_card_here =3D=3D 1)) can_do =3D =
false; // Instance 15
}
if ((table[7][6] =3D=3D 4) && (table[8][6] =3D=3D 5) && =
(place_card_here =3D=3D 2)) can_do =3D false; // Instance 9
if ((table[5][4] =3D=3D 4) && (table[5][3] =3D=3D 5) && =
(place_card_here =3D=3D 4)) can_do =3D false; // Instance 10
}
if ((table[7][7] =3D=3D 3) && (table[8][8] =3D=3D 4))
{
if ((table[8][9] =3D=3D 5) && (place_card_here =3D=3D 3)) can_do =3D =
false; // Instance 12
if ((table[9][8] =3D=3D 5) && (place_card_here =3D=3D 7)) can_do =3D =
false; // Instance 13
}
if (table[5][6] =3D=3D 3)
{
if (table[4][7] =3D=3D 4)
{
if ((table[3][7] =3D=3D 5) && (place_card_here =3D=3D 1)) can_do =3D =
false; // Instance 16
if ((table[4][8] =3D=3D 5) && (place_card_here =3D=3D 5)) can_do =3D =
false; // Instance 17
}
if ((table[6][7] =3D=3D 4) && (table[6][8] =3D=3D 5) && =
(place_card_here =3D=3D 0)) can_do =3D false; // Instance 11
}
}
}
if ((card_counter >=3D 6) && (card_counter <=3D 23))
{
=20
if ((compass_score[place_card_here][0]) =3D=3D 1) =
// Legal position
{ =20
// Now it's time to GO FIGURE
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////////////////// T H E G O F I G U R E R O U T I N E =
///////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////////////////////////////////// B E G I N =
//////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
{
// Try and figure out if the game is completable with card at this =
position
// First five cards on table a doddle ... no validation required
// Sixth card validation handled elsewhere
// HEREWITH validation for 7th to 24th cards (card_counter =3D 6 to 23)
v_row =3D row;
v_column =3D column;
if ((place_card_here =3D=3D 5) || (place_card_here =3D=3D 6) || =
(place_card_here =3D=3D 7)) v_row--;
if ((place_card_here =3D=3D 3) || (place_card_here =3D=3D 2) || =
(place_card_here =3D=3D 1)) v_row++;
if ((place_card_here =3D=3D 5) || (place_card_here =3D=3D 4) || =
(place_card_here =3D=3D 3)) v_column--;
if ((place_card_here =3D=3D 7) || (place_card_here =3D=3D 0) || =
(place_card_here =3D=3D 1)) v_column++;
// Make a copy of the "table" array
for (i=3D0; i<=3D10; i++)
for(j=3D0; j<=3D10; j++)
copy_of_table[i][j] =3D table[i][j];
=20
// Reset variables for the GO FIGURISATION validation
new_card =3D true;
pozzy =3D 0;
can_do =3D false;
completable =3D false;
resolved_it =3D false;
backstop =3D card_counter;
current_card =3D backstop + 1;
card_placeable =3D false;
no_walls =3D true;
// Now place card on table
copy_of_table[v_row][v_column] =3D current_card;
// "copy_of_table" array now contains the card previously held in the =
hand
// Now we need to see if game can be completed
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
/////////////// R O U T I N E T O C H E C K F O R W A L =
L S ///////////////////////
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
///////////////////////////////////////// B E G I N =
///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
//// =
////
//// * * x x =
////
//// x x x x x =
x x x ////=20
//// x x x x x x x x =
x x ////
//// x x x x x x x x x x =
* x x x x * ////
//// x x x x x x x x x x =
x ////
//// =
////
//// For example: "Impassable vertical walls" =
"Impassable horizontal walls" ////
//// * =3D card we wanna place =
////
//// =
////
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
// Find top, bottom, left & right of table array ... longwinded
q_top =3D find_top(copy_of_table);
q_bottom =3D find_bottom(copy_of_table);
q_left =3D find_left(copy_of_table);
q_right =3D find_right(copy_of_table);
wyde =3D q_right - q_left + 1;
hygh =3D q_bottom - q_top + 1;
if ((hygh =3D=3D 5) || (wyde =3D=3D 5)) // Simple as that
{
// Perform routines to look for "impassable walls"
// 0 =3D There are no cards in this column
// 1 =3D A vertical wall is found in this column
// 2 =3D Cards are known to be in this column but there is no =
vertical wall to be found here
no_walls =3D true;
if (hygh =3D=3D 5) // Check for impassable (ie 5 cards high) =
vertical "walls"
{
for(i=3D0; i<=3D4; i++)
vertical_wall[i] =3D 0;
for(y=3Dq_left; y<=3Dq_right; y++)
{
scoot =3D y - q_left;
vertical_wall[scoot] =3D 1; // Assume it's a "wall"
for(x=3Dq_top; x<=3D(q_top + 4); x++)
if (copy_of_table[x][y] =3D=3D 0) vertical_wall[scoot] =
=3D 2; // A-ha! But it isn't a "wall"!
}
// Look for 5 card high columns sandwiched by incomplete =
columns @ positions 1, 2 & 3 ...
if ((vertical_wall[1] =3D=3D 1) && (vertical_wall[0] =3D=3D =
2) && ((vertical_wall[2] =3D=3D 2) || (vertical_wall[3] =3D=3D 2) || =
(vertical_wall[4] =3D=3D 2))) no_walls =3D false;
if ((vertical_wall[2] =3D=3D 1) && ((vertical_wall[0] =3D=3D =
2) || (vertical_wall[1] =3D=3D 2)) && ((vertical_wall[3] =3D=3D 2) || =
(vertical_wall[4] =3D=3D 2))) no_walls =3D false;
if ((vertical_wall[3] =3D=3D 1) && (vertical_wall[4] =3D=3D =
2) && ((vertical_wall[0] =3D=3D 2) || (vertical_wall[1] =3D=3D 2) || =
(vertical_wall[2] =3D=3D 2))) no_walls =3D false;
}
if ((no_walls) && (wyde =3D=3D 5)) // Check for impassable =
(ie 5 cards wide) horizontal "walls"
{
for(i=3D0; i<=3D4; i++)
horizontal_wall[i] =3D 0;
for(x=3Dq_top; x<=3Dq_bottom; x++)
{
scoot =3D x - q_top;
horizontal_wall[scoot] =3D 1; // Assume it's a "wall"
for(y=3Dq_left; y<=3D(q_left + 4); y++)
if (copy_of_table[x][y] =3D=3D 0) horizontal_wall[scoot] =
=3D 2; // A-ha! But it isn't a "wall"!
}
// Look for 5 card wide rows sandwiched by incomplete rows @ =
positions 1, 2 & 3 ...
if ((horizontal_wall[1] =3D=3D 1) && (horizontal_wall[0] =
=3D=3D 2) && ((horizontal_wall[2] =3D=3D 2) || (horizontal_wall[3] =
=3D=3D 2) || (horizontal_wall[4] =3D=3D 2))) no_walls =3D false;
if ((horizontal_wall[2] =3D=3D 1) && ((horizontal_wall[0] =
=3D=3D 2) || (horizontal_wall[1] =3D=3D 2)) && ((horizontal_wall[3] =
=3D=3D 2) || (horizontal_wall[4] =3D=3D 2))) no_walls =3D false;
if ((horizontal_wall[3] =3D=3D 1) && (horizontal_wall[4] =
=3D=3D 2) && ((horizontal_wall[0] =3D=3D 2) || (horizontal_wall[1] =
=3D=3D 2) || (horizontal_wall[2] =3D=3D 2))) no_walls =3D false;
}
}
// I have found at least one VERY VERY NASTY and VERY VERY UNPASSABLE =
W-A-L-L!!!! so "NO CAN DO"
if (!no_walls) can_do =3D false;
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
/////////////// R O U T I N E T O C H E C K F O R W A L =
L S ///////////////////////
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
/////////////////////////////////////////// E N D =
/////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
//////////////////////////
if (no_walls)
// Alright, so there are no vertical or horizontal "walls" so we'll have =
to use some SLOGic to establish if game completable
{
// Zeroise crack array
for (i=3D0; i<=3D25; i++)
{
crack[i][0] =3D 0;
crack[i][1] =3D 0;
crack[i][2] =3D 0;
}
// And stick position variables to crack[] array
// This crack array is a sort of tracer, a document of card placements
// It might look like this ... but then again it might not
//
// It's a sort of tracer like I said, what more can I tell you?
//
// 0 0 0
// 0 0 0
// 0 0 0
// 0 0 0
// 0 0 0
// 0 0 0
// 0 0 0
// 0 0 0
// 1 5 7
// 3 5 6
// 6 4 6
// 0 3 5 etc etc
crack[current_card][0] =3D place_card_here;
crack[current_card][1] =3D v_row;
crack[current_card][2] =3D v_column;
// Begin W-H-I-L-E loop
do
{
if (new_card)
{
save_row =3D v_row;
save_column =3D v_column;
}
new_card =3D false;
card_placeable =3D true;
//WE NOW NEED NEED TO CHECK TO SEE IF THE CARD IS PLACE-ABLE AT pozzy =
AND IF SO "card_placeable =3D true;" ELSE "card_placeable =3D false;"
// card_placeable =3D check_position(true, pozzy, p_rowski, =
p_columnski); =20
// ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ =
^ ^ ^ ^
//THAT's WHAT THIS (now defunct) FUNCTION USED TO =
DO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! THAT'S WHY IT DON'T =
WORK!!!!!!
//THIS IS THE VITAL BIT OF machinery THAT IS STOPPING IT ALL FROM =
WORKING
if ((pozzy =3D=3D 5) || (pozzy =3D=3D 6) || (pozzy =3D=3D 7)) v_row--;
if ((pozzy =3D=3D 3) || (pozzy =3D=3D 2) || (pozzy =3D=3D 1)) v_row++;
if ((pozzy =3D=3D 5) || (pozzy =3D=3D 4) || (pozzy =3D=3D 3)) =
v_column--;
if ((pozzy =3D=3D 7) || (pozzy =3D=3D 0) || (pozzy =3D=3D 1)) =
v_column++;
// Find top, bottom, left & right of table array ... longwinded
q_top =3D find_top(copy_of_table);
q_bottom =3D find_bottom(copy_of_table);
q_left =3D find_left(copy_of_table);
q_right =3D find_right(copy_of_table);
wyde =3D q_right - q_left + 1;
hygh =3D q_bottom - q_top + 1;
if ((v_row < 0) || (v_row > 10) || (v_column < 0) || (v_column > 10)) =
card_placeable =3D false;
if (copy_of_table[v_row][v_column] !=3D 0) card_placeable =3D false;
if (((wyde =3D=3D 5) && ((v_column < q_left) || (v_column > q_right))) =
|| ((hygh =3D=3D 5) && ((v_row < q_top) || (v_row > q_bottom)))) =
card_placeable =3D false;
//WE NOW NEED NEED TO CHECK TO SEE IF THE CARD IS PLACE-ABLE AT pozzy =
AND IF SO "card_placeable =3D true;" ELSE "card_placeable =3D false;"
// card_placeable =3D check_position(true, pozzy, p_rowski, =
p_columnski); =20
// ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ =
^ ^ ^
//THAT's WHAT THIS (now defunct) FUNCTION USED TO =
DO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! THAT'S WHY IT DON'T =
WORK!!!!!!
//THIS IS THE VITAL BIT OF machinery THAT IS STOPPING IT ALL FROM =
WORKING
//Ah shaddup ... I've only gone and fecking cracked it!!!
if (card_placeable && (pozzy <=3D 7))
{
// Extra checking ... Never a bad idea
// if (((v_row >=3D crack[current_card][1] - 1) && (v_row <=3D =
crack[current_card][1] + 1))
// && ((v_column >=3D crack[current_card][2] - 1) && =
(v_column <=3D crack[current_card][2] + 1)))
// {
current_card++;
crack[current_card][0] =3D pozzy;
crack[current_card][1] =3D v_row;
crack[current_card][2] =3D v_column;
copy_of_table[v_row][v_column] =3D current_card;
new_card =3D true;
pozzy =3D 0;
// }
if (current_card =3D=3D 25)
{
completable =3D true;
resolved_it =3D true;
}
}
else
{
v_row =3D save_row;
v_column =3D save_column;
pozzy++;
if (pozzy =3D=3D 8) // Slogged through all eight positions =
and found none legal. We now need to backup one level ...
{
do
{
// Backup one card ... And try different pozzish
copy_of_table[save_row][save_column] =3D 0;
// If the following pozzy is 8 then backup again
pozzy =3D crack[current_card][0] + 1;
// Erase values from crack[]
crack[current_card][0] =3D 0;
crack[current_card][1] =3D 0;
crack[current_card][2] =3D 0;
current_card--;
if (current_card =3D=3D backstop)
{
resolved_it =3D true;
completable =3D false;
}
save_row =3D crack[current_card][1];
save_column =3D crack[current_card][2];
v_row =3D crack[current_card][1];
v_column =3D crack[current_card][2];
}
while (pozzy =3D=3D 8);
}
}
}
while (!resolved_it);
// End W-H-I-L-E loop
}
if (completable) can_do =3D true;
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////////////////// T H E G O F I G U R E R O U T I N E =
///////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////// E N D =
////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
}
}
if (can_do)
{
=20
if ((place_card_here =3D=3D 5) || (place_card_here =3D=3D 6) || =
(place_card_here =3D=3D 7)) row--;
if ((place_card_here =3D=3D 3) || (place_card_here =3D=3D 2) || =
(place_card_here =3D=3D 1)) row++;
if ((place_card_here =3D=3D 5) || (place_card_here =3D=3D 4) || =
(place_card_here =3D=3D 3)) column--;
if ((place_card_here =3D=3D 7) || (place_card_here =3D=3D 0) || =
(place_card_here =3D=3D 1)) column++;
table[row][column] =3D card_counter + 1;
break; // Exit the =
FOR loop
}
if (slog =3D=3D 7 && !can_do)
{
cout<<"Oh dear. I appear to have fucked up (like the ***** I am). =
I'm very sorry."<<endl;
phile<<"I'm afraid I've fucked this one up. Don't blame me =
though, I only do what I'm told."<<endl;
exit;
}
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////////////////////////////// S L O G L O O P =
////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////// E N D =
////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
}
}
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////////// W R I T E R E S U L T S F I L E T O D =
I S K ////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////////////////////////////////// B E G I N =
//////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
// Write table to file BEGIN
top =3D find_top(table);
left =3D find_left(table);
// According to Hoyle ...
//
// One Pair - 1=20
// Two Pair - 3
// Flush - 5
// Threes - 6
// Full - 10
// Straight - 12
// Fours - 16
// Straight Flush - 30
phile<<"Game number - =
"<<current_game<<endl<<"=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D";
if (current_game >=3D 10) phile<<"=3D";
if (current_game >=3D 100) phile<<"=3D";
if (current_game >=3D 100) phile<<"=3D";
if (current_game >=3D 1000) phile<<"=3D";
if (current_game >=3D 10000) phile<<"=3D";
phile<<endl<<endl;
for(i=3D0; i<=3D4; i++)
{
for(j=3D0; j<=3D4; j++)
{=20
k =3D table[i+top][j+left] - 1;
phile<<table[i+top][j+left];
if (k >=3D 0)=20
{
phile<<"-";
if ((table[i+top][j+left] >=3D 1) && (table[i+top][j+left] <=3D =
9)) phile << " ";
phile<<the25[k].pips<<the25[k].suit<<" ";
}
if (j =3D=3D 4)
// List score for horizontal hand ...
{
for(x=3D0; x<=3D4; x++)
horizontal_hand[x] =3D the25[table[top+i][left+x]-1].card_id;
identum =3D identify_hand(horizontal_hand);
if (identum =3D=3D 31)=20
{
horizontal_score[i] =3D 0;
phile<<" ---- shite";
bum_hands++;
}
if (identum =3D=3D 32)=20
{
horizontal_score[i] =3D 1;
phile<<" ---- 1pair";
one_pairs++;
}
if (identum =3D=3D 33)=20
{
horizontal_score[i] =3D 3;
phile<<" ---- 2pair";
two_pairs++;
}
if (identum =3D=3D 34)
{
horizontal_score[i] =3D 5;
phile<<" ---- flush";
flushes++;
}
if (identum =3D=3D 35)=20
{
horizontal_score[i] =3D 6;
phile<<" ---- prial";
prials++;
}
if (identum =3D=3D 36)
{
horizontal_score[i] =3D 10;
phile<<" ---- fulla";
full_hands++;
}
if (identum =3D=3D 37)=20
{
horizontal_score[i] =3D 12;
phile<<" ---- run";
straights++;
}
if (identum =3D=3D 38)
{
horizontal_score[i] =3D 16;
phile<<" ---- fours";
fours++;
}
if (identum =3D=3D 39)=20
{
horizontal_score[i] =3D 30;
phile<<" ---- S F";
straight_flushes++;
}
}
}
phile<<endl<<endl;
}
// List scores for vertical hands ...
for(i=3D0; i<=3D4; i++)
{
for(j=3D0; j<=3D4; j++)
vertical_hand[j] =3D the25[table[top+j][left+i]-1].card_id;=20
identum =3D identify_hand(vertical_hand);
if (i =3D=3D 0) phile<<" | | | | | =
"<<endl<<" | | | | | "<<endl;
if (identum =3D=3D 31)=20
{
vertical_score[i] =3D 0;
phile<<" shite ";
bum_hands++;
}
if (identum =3D=3D 32)=20
{
vertical_score[i] =3D 1;
phile<<" 1pair ";
one_pairs++;
}
if (identum =3D=3D 33)=20
{
vertical_score[i] =3D 3;
phile<<" 2pair ";
two_pairs++;
}
if (identum =3D=3D 34)
{
vertical_score[i] =3D 5;
phile<<" flush ";
flushes++;
}
if (identum =3D=3D 35)=20
{
vertical_score[i] =3D 6;
phile<<" prial ";
prials++;
}
if (identum =3D=3D 36)
{
vertical_score[i] =3D 10;
phile<<" fulla ";
full_hands++;
}
if (identum =3D=3D 37)=20
{
vertical_score[i] =3D 12;
phile<<" run ";
straights++;
}
if (identum =3D=3D 38)
{
vertical_score[i] =3D 16;
phile<<" fours ";
fours++;
}
if (identum =3D=3D 39)=20
{
vertical_score[i] =3D 30;
phile<<" S F ";
straight_flushes++;
}
}
score_for_this_game =3D 0;
for(i=3D0; i<=3D4; i++)
score_for_this_game =3D score_for_this_game + vertical_score[i] + =
horizontal_score[i];
if (current_game =3D=3D 1)
{
best_score_ever =3D score_for_this_game;
worse_score_ever =3D score_for_this_game;
}
else if (current_game > 2)
{
if (score_for_this_game > best_score_ever)=20
{
best_score_ever =3D score_for_this_game;
best_game_ever =3D current_game;
}
if (score_for_this_game < worse_score_ever)=20
{
worse_score_ever =3D score_for_this_game;
worst_game_ever =3D current_game;
}
}
score_tally =3D score_tally + score_for_this_game;
phile<<" SCORE - "<<score_for_this_game<<endl<<endl<<endl<<endl;
// Write table to file END
// END nogtp current_game loop
}
average_score_per_game =3D (float)score_tally/nogtp;
anpg_bum_hands =3D (float) bum_hands/nogtp;
anpg_one_pairs =3D (float) one_pairs/nogtp;
anpg_two_pairs =3D (float) two_pairs/nogtp;
anpg_flushes =3D (float) flushes/nogtp;
anpg_prials =3D (float) prials/nogtp;
anpg_full_hands =3D (float) full_hands/nogtp;
anpg_straights =3D (float) straights/nogtp;
anpg_fours =3D (float) fours/nogtp;
anpg_straight_flushes =3D (float) straight_flushes/nogtp;
stop_time =3D time(NULL);=20
time_taken =3D stop_time - start_time;
average_time_per_game =3D (float) time_taken/nogtp;
phile<<endl<<endl<<endl<<endl;
phile<<"Number of Games played .......................... =
"<<nogtp<<endl;
phile<<"Total time taken ................................ =
"<<time_taken<<" seconds"<<endl;
phile<<"Average time per game ........................... =
"<<average_time_per_game<<" seconds"<<endl<<endl;
phile<<"AVerage S-C-O-R-E per game ...................... =
"<<average_score_per_game<<endl;
phile<<"Worst Game Score ................................ =
"<<worse_score_ever<<" (Game "<<worst_game_ever<<")"<<endl;
phile<<"Best Game Score ................................. =
"<<best_score_ever<<" (Game "<<best_game_ever<<")"<<endl<<endl;
phile<<"Average number of Bum Hands per game ............ =
"<<anpg_bum_hands<<endl;
phile<<"Average number of One Pairs per game ............ =
"<<anpg_one_pairs<<endl;
phile<<"Average number of Two Pairs per game ............ =
"<<anpg_two_pairs<<endl;
phile<<"Average number of Flushes per game .............. =
"<<anpg_flushes<<endl;
phile<<"Average number of Prials per game ............... =
"<<anpg_prials<<endl;
phile<<"Average number of Full Hands per game ........... =
"<<anpg_full_hands<<endl;
phile<<"Average number of Straights per game ............ =
"<<anpg_straights<<endl;
phile<<"Average number of Fours per game ................ =
"<<anpg_fours<<endl;
phile<<"Average number of Straight Flushes per game ..... =
"<<anpg_straight_flushes<<endl<<endl<<endl;
phile<<"Thank you for playing Mister Divvy Bollocks' Poker Patience, =
have a nice day.";
phile.close();
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
///////////////// W R I T E R E S U L T S F I L E T O D =
I S K ////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
/////////////////////////////////////////// E N D =
////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////=
/////////////////////////
}

------=_NextPart_000_0049_01C65401.FCCB7310
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD><FONT face=3DArial><FONT size=3D2>
<BODY>
<DIV>&nbsp;
<DIV>// A big 7 and three-quarters size "Hello" to all C++ programmers =
out=20
there. This here is the second program what I've<BR>// ever wrote, the =
first=20
being a "***** world you *****" program. It's a nice little poker =
patience=20
program, poker<BR>// patience being a patience game whereby 10 poker =
hands are=20
placed on the table in a 5x5 square. Try it if you like.<BR>// It's not =
really a=20
C++ program as such, more of a SLOGic program heh heh. It writes results =
to a=20
file results.txt<BR>// and I just had to post it to this newsgroup =
because=20
because because ....</DIV>
<DIV>&nbsp;</DIV>
<DIV>// I'm sending it off to the BNFL with my CV in response to their=20
advert:<BR>//<BR>// &lt;&lt;Programmer required to write "lowering of =
graphite=20
rods into reactor core program" at Sizewell B.<BR>// Good benefits =
package, nice=20
pension (probably)&gt;&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>// Er .... If anyone's interested, compile it with the /O2 =
switch ...=20
optimise for speed.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>////////////////////////////////////////////////////////////////////=
//////////////////////////////<BR>///////////////////////////////////////=
///////////////////////////////////////////////////////////<BR>//////////=
/////////////////////////////////////////////////////////////////////////=
///////////////<BR>/////&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/////<BR>/////&nbsp; Program: Poker Patience Program=20
(ppp.cpp)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/////<BR>/////&nbsp; Writer: Peter Lambert using "Learn to Program with =
Borland=20
C++ Builder 1.0" (=A380)&nbsp;&nbsp;&nbsp;&nbsp;=20
/////<BR>/////&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
which was a=20
GUI C++ for Windows 95. Nice graphcs, bitmaps and all=20
that.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/////<BR>/////&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; And =
then=20
rewritten for Microsoft Visual C++ Toolkit 2003 (a FREE =
compiler).&nbsp;&nbsp;=20
/////<BR>/////&nbsp; Date: 29th March 2006 between about 3pm and 3.45pm=20
honest&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/////<BR>/////&nbsp; John Huston: Filling straights is a sucker's=20
game&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
/////<BR>/////&nbsp; Robert Duvall: 2 of Spades, 3 of Spades, 4 of =
Diamonds, 6=20
of Clubs, 8 of Spades&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
/////<BR>/////&nbsp;=20
Instruction: Mince around with skore[] variables to improve=20
play&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/////<BR>/////&nbsp; Dealer: Your dealer tonight is Frankie=20
Machinek&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
/////<BR>/////&nbsp; Note: Dealer can be a bit slow at beginning of each =
game=20
because of validation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
/////<BR>/////&nbsp; Version Number: You're yanking me off now=20
right?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
/////<BR>/////&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
/////<BR>////////////////////////////////////////////////////////////////=
//////////////////////////////////<BR>///////////////////////////////////=
///////////////////////////////////////////////////////////////<BR>//////=
/////////////////////////////////////////////////////////////////////////=
///////////////////</DIV>
<DIV>&nbsp;</DIV>
<DIV>////////////////////////////////////////////////////////////////////=
//////////////////////////////<BR>///////////////////////////////////////=
///////////////////////////////////////////////////////////<BR>//////////=
///////////////////////////=20
P R O G R A M&nbsp;&nbsp;&nbsp;&nbsp; N O T E S=20
////////////////////////////////<BR>/////////////////////////////////////=
/////////////////////////////////////////////////////////////<BR>////////=
/////////////////////////////////////////////////////////////////////////=
/////////////////</DIV>
<DIV>&nbsp;</DIV>
<DIV>////////////////////////////////////////////////////////////////////=
///////////////////////////////<BR>//////////////////////////////////////=
//////////////