TGC Codebase Backup



Simple Guessing Game by gimligandresch

18th Jan 2010 10:16
Summary

The computer thinks of a random number between 1 to 100! You must guess the number!



Description

The computer thinks of a random number between 1 to 100! You must guess the number!
There are diffrent difficultys - easy, medium or hard! The computer says yes, lower or higher! Have fun and comment! It's my first game I made in dbpro!



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    print "What's your name?"
input "> ";name$
print "Hello "+name$+"!"
print "We will play a little game! Here are the rules: "
print "I will think of a number between 1 and 100! You must guess the number!"
print "And then I will say: Yes, lower or higher! OK, let's go, "+name$
print "Easy(1), medium(2) or hard(3)?"
input "> ";difficulty
if difficulty=1 or difficulty=2 or difficulty=3
	if difficulty=1 then oppertunities=8
	if difficulty=2 then oppertunities=7
	if difficulty=3 then oppertunities=6
	print "You have "+str$(oppertunities)+" oppertunities!"
else
	print "This is an incorrect difficulty!"
	wait key
	end
endif
mynumber=rnd(99)+1
repeat
	print "Guess my number: "
	input "> ";myguess
	if myguess<101 and myguess>0
		if myguess>mynumber
			print "No! My number is lower...!"
			oppertunities=oppertunities-1
		endif
		if myguess<mynumber
			print "No! My number is higher...!"
			oppertunities=oppertunities-1
		endif
		if myguess=mynumber
			print "Yes, you are right! It's my number, "+name$+"!"
			wait key
			end
		endif
	else
		print "This is an incorrect number!"
		wait key
		end
	endif
until oppertunities=0
print "You have no oppertunities left... Try again!"
wait key
end