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

Username:   Password: 
 RegisterRegister   
 Number Guessing Game
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
didsbub




PostPosted: Thu Dec 08, 2005 5:11 pm   Post subject: Number Guessing Game

A simple number guessing game


Number Guessing Game.t
 Description:

Download
 Filename:  Number Guessing Game.t
 Filesize:  1.39 KB
 Downloaded:  180 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Wed Jan 11, 2006 8:27 pm   Post subject: (No subject)

your program has a simple problem with it, if you choose to play again after playing once, your random number does not reset to another random number so someone can play until the cows come home inputting the same number over and over again always winning i also suggest some character graphics to make it more interesting Cool
yoink78




PostPosted: Sun Jan 15, 2006 11:52 am   Post subject: (No subject)

That's a simple fix. After the line:
code:
loop
make a line that says:
code:
number := Rand.Int (1,50)
that way a new number is chosen each time the for loop is executed.
cool dude




PostPosted: Sun Jan 15, 2006 1:56 pm   Post subject: (No subject)

error proofing is good too. if u enter a letter your program crashes. also when it says would u like to play again and u enter any letter it will play again, but wat u should have instead is if they enter somethin other than yes or no then it should prompt the user saying invalid answer or somthin like that. for error proofing check out the turing tutorial.
Clayton




PostPosted: Mon Jan 16, 2006 2:26 am   Post subject: (No subject)

cool dude wrote:
error proofing is good too. if u enter a letter your program crashes. also when it says would u like to play again and u enter any letter it will play again, but wat u should have instead is if they enter somethin other than yes or no then it should prompt the user saying invalid answer or somthin like that. for error proofing check out the turing tutorial.


a simple way to program that little problem is this
code:

%this will just keep going until an appropriate input has been made
loop
     get answer
     exit when answer = "y" or answer = "Y" or answer = "n" or answer = "N"
end loop
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: