Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Restarting game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
anywho_ya




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Paul




PostPosted: Thu May 06, 2004 2:30 pm   Post subject: (No 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
Martin




PostPosted: Mon May 10, 2004 12:58 am   Post subject: (No 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: