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

Username:   Password: 
 RegisterRegister   
 Turing Help Please !
Index -> Programming, General Programming -> Functional Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
kevin_zullu@hotmail.com




PostPosted: Fri Nov 19, 2010 6:58 pm   Post subject: Turing Help Please !

Im trying to finish guessing game for turing this is what i have so far


import GUI
var num : int
var count2 : int := 0
var guess1 : int
var count : int := 0
var players : int
var guess2 : int
var answer : string
var count3 : int := 0
var count4 : int := 0
var picID: int
var ok : int
loop
setscreen ("graphics")
const message := "GUESSING GAME OMFG!!"
for i : 1 .. length (message)
color (i mod maxcolor + 48)
put message (i) ..
end for
delay (35)
end loop
put "Instructions:The goal of the game is for a player to guess the random number in the least amount of tries.When playing two players its a fight to whoever can guess it first HAVE FUN!"
procedure hello
cls
randint (num, 1, 20)

loop
put " Guess a number from 1 to 20 "
get guess1
if guess1 < 1 then
put "Invalid"
end if
if guess1 > 20 then
put "Invalid"
end if
if num = guess1 then
put "Game Over You Win!"
put "OMG"
delay (1000)
put " YOU JUST WON! "
delay (2000)
put " MUSIC TIME !"
Music.Play ("8<d>>def+f+ed adef+f+edgef+gdc+c+ef+ggf+ef+def+")
end if
count := count + 1
if num = guess1 then
put "it took you ", count, " tries !"
put " Would you like to play again?"
get answer
if answer = "yes" then
cls
randint (num, 1, 20)
count := count - count
end if
if answer = "no" then
exit
end if
end if
end loop
end hello


procedure hi
randint (num, 1, 20)
cls
loop
count3 := count3 + 1
count4 := count4 + 1
put " Player 1 Guess a number from 1 to 20 "
get guess1
if guess1 < 1 then
put "Invalid"
end if
if guess1 > 20 then
put "Invalid"
end if
if num = guess1 then
put "Game Over You Win!"
put "OMG"
delay (1000)
put " YOU JUST WON! "
delay (2000)
put " MUSIC TIME !"
put " PLAYER 1 WINS "
put "It took player one ", count3, " Tries and player two ", count4-1, " tries"
Music.Play ("8<d>>def+
f+ed adef+f+edgef+gdc+c+ef+ggf+ef+def+")
put " Would you like to play again?"
get answer
if answer = "yes" then
cls
randint (num, 1, 20)
count3 := count3 - count3
count4 := count4 - count4
end if
if answer = "no" then
exit
end if
end if


put " Player 2 Guess a number from 1 to 20 "
get guess2
if guess2 < 1 then
put "Invalid"
end if
if guess2 > 20 then
put "Invalid"
end if
if num = guess2 then
put "Game Over You Win!"
put "OMG"
delay (1000)
put " YOU JUST WON! "
delay (2000)
put " MUSIC TIME !"
put " PLAYER 2 WINS "
put "It took player one ", count3, " Tries and player two ", count4-1, " tries"
Music.Play ("8<d>>def+
f+ed adef+f+edgef+gdc+c+ef+ggf+ef+def+")
put " Would you like to play again?"
get answer
if answer = "yes" then
cls
randint (num, 1, 20)
count4 := count4 - count4
count3 := count3 - count3
end if
if answer = "no" then
exit
end if
end if

end loop
end hi


var button1 : int := GUI.CreateButton (250, 250, 10, "1 Player", hello)
var button2 : int := GUI.CreateButton (350, 250, 00, "2 Player", hi)

loop
exit when GUI.ProcessEvent
end loop




Now all i want to do is make it so the loop at the very start
loop
setscreen ("graphics")
const message := "GUESSING GAME OMFG!!"
for i : 1 .. length (message)
color (i mod maxcolor + 48)
put message (i) ..
end for
delay (35)
end loop


ends after a certain amount of seconds using the "time" command but i dont know how to use it . Can someone please post what im supposed to do and maybe even just finish that little part for me i would greatly appreciate that
Sponsor
Sponsor
Sponsor
sponsor
goroyoshi




PostPosted: Sun Feb 26, 2012 11:37 am   Post subject: RE:Turing Help Please !

there is a turing forum, you should be posting there.
[Gandalf]




PostPosted: Sun Feb 26, 2012 11:56 am   Post subject: Re: Turing Help Please !

You're right, but this post is two years old, and you just resurrected it for no reason. Locked.
Display posts from previous:   
   Index -> Programming, General Programming -> Functional Programming
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: