I'm using the book DarkBASIC Programming for the Absolute Beginner by Jerry Lee Ford, Jr. and I've typed in t he Tic tac Toe game and I keep getting this error on compile.
"Cannot perform 'string' cast on type '&Play_A_Round' at line 36."
I'm posting a snippet of code. If you want more code, just ask. I'm stumped.
[CODE]
`Define the game`s global variable and assigb ibitial values
GLOBAL Player$ AS STRING = "X" `represebnts current player
GLOBAL Winnert$ AS STRING = " " `used to store game results
GLOBAL NoMove AS INTEGER = 0 `keeps count of number of moves made
GLOBAL Message$ AS STRING = " " `used for diplay of indtructions
GLOBAL Choice$ AS STRING = " " `contrls main loop
`variables of the squares on the board
GLOBAL a1$,a2$,a3$,b1$,b2$,b3$,c1$,c2$,c3$ AS STRING
Welcome_Screen()
SET TEXT FONT "Courier" `Set the font type to Courier
SET TEXT SIZE 24 `Set the font size to 24 points
SET TEXT TO BOLD `Set text to display in bold print
ForegroundColor = RGB( 0, 0, 160) `Set foreground color to blue
BackgroundColor = RGB( 255, 255, 255) `Set background color to white
INK ForegroundColor, BackgroundColor `Apply color settings
DO `Loop forever
`Call the function that prompts player for permission to start the game
Choice$ = Play_A_Round()
IF Choice$ = "PLAY" `The player has elected to play a round
Reset_Board() `Call the function that prepares the game board
Play() `Call the function that controls game play
ELSE `The player wants to end the game
Closing_Screen() `Call the function that displays the closing screen
EXIT `Terminate the loop`s execution
ENDIF
LOOP
END `Terminate the execution of this application[/CODE[\
[/CODE]
And here's the function
[CODE]
`This function prompts the player for permission to play a new game
FUNCTION Play_A_Round()
DO `Loop forever
CLS RGB( 255, 255, 255) `Set background color to white
PRINT : PRINT : PRINT : PRINT : PRINT `Print five blank lines
`Prompt the player for permission to start a new round of play
INPUT " Type PLAY to start a new game or QUIT to end game. ",
Reply$,
Reply$ = Upper$( Reply$) `Convert the player`s input to uppercase
`Determine if valid input was provided
IF Reply$ = "PLAY" or Reply$ = "QUIT"
EXIT `Exit the function
ENDIF
LOOP
ENDFUNCTION Reply$
[/CODE]
Nick Z.