Computer Science Canada

Restarting game

Author:  anywho_ya [ Thu May 06, 2004 12:47 pm ]
Post subject:  Restarting game

How do i re-start the game. For example if they lose how do i create something to let them have the choice to try again

Author:  Paul [ Thu May 06, 2004 2:30 pm ]
Post subject: 

code:

var choice: string(1)
loop
program

put "Start again? (Y/N)"
getch (choice)
if choice = "N" or choice = "n" then
exit
end if
end loop

Author:  Martin [ Mon May 10, 2004 12:58 am ]
Post subject: 

To restart a game, you have to reset all of the variables to their default value. For example
code:
loop
 if n = 1 then
   resetvars // reset all of the variables; this is a procedure
   newgame // this is a procedure, so once it is done it can be assumed that the game is finished
 elsif n = 2 then
  exit
 end if
end loop


: