Posted 07 May 2013 - 11:46 AM
hey guys!
just a little program for you guys i made in 10 minutes.
you have to type in a maximum number, and you will have to guess a random number between 1 and the maximum.
you will be given tips like:"Higher" and "Lower".
ass you get it the program will tell you how many tries you had
to get it in game type:
Challenge:
and try and get it in least as possible tries.
then post a screenshot (in a spoiler) at this topic, I will make a top 10 leaderboard.
my best is 18 tries (won't put it in the leaderboard)
Code:
Pastebin link:
Leaderboard:
2.
3.
4.
5.
6.
7.
8.
9.
10.
video:
just a little program for you guys i made in 10 minutes.
you have to type in a maximum number, and you will have to guess a random number between 1 and the maximum.
you will be given tips like:"Higher" and "Lower".
ass you get it the program will tell you how many tries you had
to get it in game type:
pastebin get BkcuBCB8 Guessnumber
Now I have a special challenge, check the spoiler!Challenge:
Spoiler
Use the maximum number 2000000 (2 million)and try and get it in least as possible tries.
then post a screenshot (in a spoiler) at this topic, I will make a top 10 leaderboard.
my best is 18 tries (won't put it in the leaderboard)
Code:
Spoiler
print[[
---------------------------------------------------
Welcome to Guess the number
---------------------------------------------------]]
print("")
print("You are going to have to type in a maximum number.")
print("You will have to guess the number between 1 and your input, it will say wheter you have to guess higher, or lower")
write("Maximum number : ")
z=0
p=read()
n=math.random(p)
print("Guess the number, it's between 1 and "..p)
repeat
z=z+1
k=tonumber(read())
if k<n then
print("Higher")
elseif k>n then
print("Lower")
end
until k==n
print("")
print("---------------------------------------------------")
print("You guessed the code!")
print("Your max number was: "..p)
write("And you did it in ")write(z)write(" attempts!")
print("---------------------------------------------------")
Pastebin link:
Spoiler
http://pastebin.com/BkcuBCB8Leaderboard:
Spoiler
1.2.
3.
4.
5.
6.
7.
8.
9.
10.
video: