Ok so heres my whole code
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
bool Turn = true;
bool MouseInBox ( int l, int t, int r, int b ){
int x = dbMouseX ( ) ,
y = dbMouseY ( ) ;
return (x >= l && x <= r && y >= t && y <= b);}
bool Game = false;
bool Score = false;
bool CScore = false;
bool CatScore = false;
bool Clear = true;
bool RandomPlace = false;
// the main entry point for the application is this function
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
int AAi = 0;
int ABi = 0;
int ACi = 0;
int BAi = 0;
int BBi = 0;
int BCi = 0;
int CAi = 0;
int CBi = 0;
int CCi = 0;
int YourScore = 0;
int ComputerScore = 0;
int CatScorei = 0;
int spots [ 9 ];
int max = 8;
int places [ 3 ] [ 3 ];
int wirow = 0;
int wicolum = 0;
int ComputerFirst = 0;
dbText ( 10, 10, "START GAME" );
dbRandomize ( dbTimer ( ) );
// our main loop
while ( LoopGDK ( ) )
{
if ( AAi == 0 && ABi == 0 && ACi == 0 &&
BAi == 0 && BBi == 0 && BCi == 0 &&
CAi == 0 && CBi == 0 && CCi == 0 )
Clear = true;
else if ( AAi >= 1 || ABi >= 1 || ACi >= 1 ||
BAi >= 1 || BBi >= 1 || BCi >= 1 ||
CAi >= 1 || CBi >= 1 || CCi >= 1 )
Clear = false;
if ( dbMouseClick () == 1 && MouseInBox ( 10, 10, 90, 25 ) && Game == false ){
Game = true;
dbCLS ( );
dbBox ( 249, 75, 251, 375 );
dbBox ( 349, 75, 351, 375 );
dbBox ( 150, 174, 450, 176 );
dbBox ( 150, 274, 450, 276 );
dbText ( 100, 10, "END GAME" );}
if ( dbMouseClick () == 1 && MouseInBox ( 100, 10, 175, 25 ) && Game == true ){
Game = false;
YourScore = 0;
ComputerScore = 0;
dbCLS ( );
AAi = 0;
ABi = 0;
ACi = 0;
BAi = 0;
BBi = 0;
BCi = 0;
CAi = 0;
CBi = 0;
CCi = 0; dbText ( 10, 10, "START GAME" );
dbRandomize ( dbTimer ( ) );
ComputerFirst = dbRnd ( 9 );}
if ( Game == true ){
if ( Turn == true && dbMouseClick () == 1 && MouseInBox ( 151, 74, 248, 173 ) && AAi == 0 ){
dbLine ( 151, 74, 248, 173 );
dbLine ( 151, 173, 248, 74 );
AAi = 1;
Turn = false;}
if ( Turn == true && dbMouseClick () == 1 && MouseInBox ( 252, 74, 350, 173 ) && ABi == 0 ){
dbLine ( 252, 74, 350, 173 );
dbLine ( 252, 173, 350, 74 );
ABi = 1;
Turn = false;}
if ( Turn == true && dbMouseClick () == 1 && MouseInBox ( 352, 74, 449, 173 ) && ACi == 0 ){
dbLine ( 352, 74, 449, 173 );
dbLine ( 352, 173, 449, 74 );
ACi = 1;
Turn = false;}
if ( Turn == true && dbMouseClick () == 1 && MouseInBox ( 151, 177, 248, 273 ) && BAi == 0 ){
dbLine ( 151, 177, 248, 273 );
dbLine ( 151, 273, 248, 177 );
BAi = 1;
Turn = false;}
if ( Turn == true && dbMouseClick () == 1 && MouseInBox ( 252, 177, 350, 273 ) && BBi == 0 ){
dbLine ( 252, 177, 350, 273 );
dbLine ( 252, 273, 350, 177 );
BBi = 1;
Turn = false;}
if ( Turn == true && dbMouseClick () == 1 && MouseInBox ( 352, 177, 449, 273 ) && BCi == 0 ){
dbLine ( 352, 177, 449, 273 );
dbLine ( 352, 273, 449, 177 );
BCi = 1;
Turn = false;}
if ( Turn == true && dbMouseClick () == 1 && MouseInBox ( 151, 277, 248, 374 ) && CAi == 0 ){
dbLine ( 151, 277, 248, 374 );
dbLine ( 151, 374, 248, 277 );
CAi = 1;
Turn = false;}
if ( Turn == true && dbMouseClick () == 1 && MouseInBox ( 252, 277, 350, 374 ) && CBi == 0 ){
dbLine ( 252, 277, 350, 374 );
dbLine ( 252, 374, 350, 277 );
CBi = 1;
Turn = false;}
if ( Turn == true && dbMouseClick () == 1 && MouseInBox ( 352, 277, 449, 374 ) && CCi == 0 ){
dbLine ( 352, 277, 449, 374 );
dbLine ( 352, 374, 449, 277 );
CCi = 1;
Turn = false;}
if ( Turn == false ){
if ( AAi == 1 &&
ABi == 0 &&
ACi == 0 &&
BAi == 0 &&
BBi == 0 &&
BCi == 0 &&
CAi == 0 &&
CBi == 0 &&
CCi == 0 ){
dbCircle ( 200, 325, 48 );
CAi = 2;
Turn = true;}
else if ( AAi == 0 &&
ABi == 1 &&
ACi == 0 &&
BAi == 0 &&
BBi == 0 &&
BCi == 0 &&
CAi == 0 &&
CBi == 0 &&
CCi == 0 ){
dbCircle ( 200, 125, 48 );
AAi = 2;
Turn = true;}
else if ( AAi == 0 &&
ABi == 0 &&
ACi == 1 &&
BAi == 0 &&
BBi == 0 &&
BCi == 0 &&
CAi == 0 &&
CBi == 0 &&
CCi == 0 ){
dbCircle ( 400, 325, 48 );
CCi = 2;
Turn = true;}
else if ( AAi == 0 &&
ABi == 0 &&
ACi == 0 &&
BAi == 1 &&
BBi == 0 &&
BCi == 0 &&
CAi == 0 &&
CBi == 0 &&
CCi == 0 ){
dbCircle ( 200, 325, 48 );
CAi = 2;
Turn = true;}
else if ( AAi == 0 &&
ABi == 0 &&
ACi == 0 &&
BAi == 0 &&
BBi == 1 &&
BCi == 0 &&
CAi == 0 &&
CBi == 0 &&
CCi == 0 ){
dbCircle ( 300, 125, 48 );
ABi = 2;
Turn = true;}
else if ( AAi == 0 &&
ABi == 0 &&
ACi == 0 &&
BAi == 0 &&
BBi == 0 &&
BCi == 1 &&
CAi == 0 &&
CBi == 0 &&
CCi == 0 ){
dbCircle ( 400, 125, 48 );
ACi = 2;
Turn = true;}
else if ( AAi == 0 &&
ABi == 0 &&
ACi == 0 &&
BAi == 0 &&
BBi == 0 &&
BCi == 0 &&
CAi == 1 &&
CBi == 0 &&
CCi == 0 ){
dbCircle ( 200, 125, 48 );
AAi = 2;
Turn = true;}
else if ( AAi == 0 &&
ABi == 0 &&
ACi == 0 &&
BAi == 0 &&
BBi == 0 &&
BCi == 0 &&
CAi == 0 &&
CBi == 1 &&
CCi == 0 ){
dbCircle ( 200, 325, 48 );
CAi = 2;
Turn = true;}
else if ( AAi == 0 &&
ABi == 0 &&
ACi == 0 &&
BAi == 0 &&
BBi == 0 &&
BCi == 0 &&
CAi == 0 &&
CBi == 0 &&
CCi == 1 ){
dbCircle ( 200, 325, 48 );
CAi = 2;
Turn = true;}
else if ( AAi == 0 &&
ABi == 0 &&
ACi == 0 &&
BAi == 0 &&
BBi == 0 &&
BCi == 0 &&
CAi == 0 &&
CBi == 0 &&
CCi == 0 ){
if ( ComputerFirst == 1 ){
dbCircle ( 200, 125, 48 );
AAi = 2;
Turn = true;}
else if ( ComputerFirst == 2 ){
dbCircle ( 300, 125, 48 );
ABi = 2;
Turn = true;}
else if ( ComputerFirst == 3 ){
dbCircle ( 400, 125, 48 );
ACi = 2;
Turn = true;}
else if ( ComputerFirst == 4 ){
dbCircle ( 200, 225, 48 );
BAi = 2;
Turn = true;}
else if ( ComputerFirst == 5 ){
dbCircle ( 300, 225, 48 );
BBi = 2;
Turn = true;}
else if ( ComputerFirst == 6 ){
dbCircle ( 400, 225, 48 );
BCi = 2;
Turn = true;}
else if ( ComputerFirst == 7 ){
dbCircle ( 200, 325, 48 );
CAi = 2;
Turn = true;}
else if ( ComputerFirst == 8 ){
dbCircle ( 300, 325, 48 );
CBi = 2;
Turn = true;}
else if ( ComputerFirst == 9 ){
dbCircle ( 400, 325, 48 );
CCi = 2;
Turn = true;}}}
else if ( Turn == false && Clear == false ){
dbRandomize ( dbTimer ( ) );
ComputerFirst = spots [ dbRnd ( max ) ];
spots [ ComputerFirst ] = spots [ max ];
max--;
wirow = ComputerFirst/3;
wicolum = ComputerFirst-wirow*3;
places [ wicolum ] [ wirow ] = 2;
dbCircle ( 200 + 100 * wicolum, 125 + 100 * wirow, 48 );
Turn = true;}
if ( Game == false && Score == true ){
AAi = 0;
ABi = 0;
ACi = 0;
BAi = 0;
BBi = 0;
BCi = 0;
CAi = 0;
CBi = 0;
CCi = 0;
Score = false; dbCLS ( );}
else if ( Game == false && CScore == true ){
AAi = 0;
ABi = 0;
ACi = 0;
BAi = 0;
BBi = 0;
BCi = 0;
CAi = 0;
CBi = 0;
CCi = 0;
CScore = false; dbCLS ( );}
else if ( Game == false && CatScore == true ){
AAi = 0;
ABi = 0;
ACi = 0;
BAi = 0;
BBi = 0;
BCi = 0;
CAi = 0;
CBi = 0;
CCi = 0;
dbCLS ( );}}
// update the screen
dbSync ( );
}
// return back to windows
return;
}
Am I doing what you said to do correctly?
Ok I did NOT do that correctly at all. I don't understand fully how that would work, but
Quote: "wirow=ComputerFirst/3.;
wicolum=ComputerFirst-wirow*3;"
how does that work? I mean if it chose to be "2" and you divide it by three it would place the circle to the left of the grid board. Did you just do that as an example code or what? Also since a human player would go as well how would I work that in? This really confused me.
Join Terrestrial Productions at http://terrestrialproductions.webs.com to help develop games for the community!