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

Username:   Password: 
 RegisterRegister   
 Simple Turing Number Game #2
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xSavage




PostPosted: Thu Oct 29, 2015 3:50 pm   Post subject: Simple Turing Number Game #2

What is it you are trying to achieve?
Alright so this is my second question on the same topic, my last question has been answered and now i have a new one. For those of you who don't know, my program is supposed to make a random number and then the user has 10 guesses to try and find the number.


What is the problem you are having?
OK, what I've been trying to do is display the comments in a row going from top to bottom in the middle of the screen. What I mean by comments is when the user inputs a number and the computer outputs "Higher.", "Lower." and "Invalid number".

Describe what you have tried to solve this problem
So far what i cant do is get the comments to go lower and lower. What happens is they stay in the same spot and start overlapping each other. I know how to locate them in a certain spot but not how to get them to lower.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




Turing:


var num : int
var guess : int
var font1 := Font.New ("Comicsans:14:bold,italic")
var i : int := 0
var continuegame: string


Font.Draw ("Welcome to the Number Game!", 200, 300, font1, red)
locate(9,20) color (green)
put "Instructions: The point of the game is to correctly"
locate(10,22)
put "guess the number generated by the computer."
locate(11,22)
put "You have a total of 10 guesses, good luck!"
locate(13,35)
put "Creator: Marko Medic"
locate(25,1)
put "Press any key to begin!"

Input.Pause()
cls

loop

randint (num, 1, 1000)

loop

put "Please put in a number"
get guess

i := i+1

if guess>1000 or guess<0 then
put "Sorry, invalid answer. Remember, a number between 1 and 1000."
elsif guess>num then
put "Lower."
elsif guess<num then
put "Higher."
elsif guess=num then
put "Correct!"

end if

exit when guess=num or i=10
end loop

if guess=num then
  put "Congratulations. You won the game!"
else
 put "Sorry. You ran out of tries."
end if 

put "Would you like to play again?"
get continuegame

exit when ((continuegame not= 'Y') and (continuegame not= 'y'))
cls

end loop
cls



Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Thu Oct 29, 2015 5:08 pm   Post subject: RE:Simple Turing Number Game #2

I don't experience this on my computer. Using this exact, code, it scrolls down the page just fine.
xSavage




PostPosted: Thu Oct 29, 2015 7:47 pm   Post subject: Re: RE:Simple Turing Number Game #2

Insectoid @ Thu Oct 29, 2015 5:08 pm wrote:
I don't experience this on my computer. Using this exact, code, it scrolls down the page just fine.


No, i know that it works but what I'm trying to get it to do is display the exact same thing but in the middle. I tried moving the location so it shows in the middle of the page, but what
happened was when there was a second "Higher" they started to overlap.
Insectoid




PostPosted: Fri Oct 30, 2015 6:00 am   Post subject: RE:Simple Turing Number Game #2

Oh, well you could just insert a bunch of spaces instead of using locate().
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  [ 4 Posts ]
Jump to:   


Style:  
Search: