View Single Post
Old 23 May 2020, 15:46   #7
Toki
Registered User

Toki's Avatar
 
Join Date: Feb 2016
Location: Birmingham
Age: 56
Posts: 62
Thanks, this has helped, thanks very much.

The program compiles now with no errors.

However on loading the program it still doesn't run properly. It loads a the window with the board, click on the board and a circle appears on the grid , but nothing else.

Here is the code at the end of the full code, now with your suggestions.

I'm now not sure if the code in this book ever worked.

Code:
do {
            do{
                /* put up message telling player it's their turn */
                
                SetAPen(rp,4);  /* pen colour */
                Move(rp,283,18);
                Text(rp,"Your Move",9);
                
                Wait(1L<< CurrentWindow->UserPort->mp_SigBit);  /* wait */
                /* until we receive message */
                /* find out the kind of message received */
                message=(struct IntuiMessage *)GetMsg(CurrentWindow->UserPort);
                
                class=message->Class;
                HumansMove=GetMove(class, message);
                ReplyMsg((struct Message *)message);
                if (class!=CLOSEWINDOW) {
                    /* if user hasn't closed the window, then wait forR
                    and get next message */
                    /*  This  absorbs the mouse button release message
                    Intuition fives after the user clicks the mouse */
                    Wait(1L<< CurrentWindow->UserPort->mp_SigBit);  /* wait
                    for message */
                 message=(struct IntuiMessage *)GetMsg(CurrentWindow->UserPort);
                    
                    ReplyMsg((struct Message *)message);
                    }
                } while (class!=CLOSEWINDOW && HumansMove<0);  /* repeat until user 
                selects close or enters a valis move */
                if (class ==CLOSEWINDOW)
                TimeToQuit=true;
            else {
                drawpiece(Human,HumansMove,NextFree[HumansMove]);
                AlterBoard(TheBoard,Human,HumansMove);
                
                /* let player know computer is thinking */
                SetAPen(rp,4); /* set pen colur */
                Move(rp,283,18);
                Text(rp,"My move  ",9);
                
    ComputersMove = BestMove(TheBoard,Computer,LookAhead,&ComputersScore);
                drawpiece(Computer,ComputersMove,NextFree[ComputersMove]);
                AlterBoard(TheBoard,Computer,ComputersMove);
                }
             } while (TimeToQuit==false);  /* repeat until user asks to
             close the window */
             }
             
             void main(void)
             {
                PlayGame();
                ReleaseResources();
                }
Toki is offline  
 
Page generated in 0.04530 seconds with 11 queries