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

Username:   Password: 
 RegisterRegister   
 Trying Not To Match User's Input When Computer Gives Random Numbers "Lotto Game". Please Help.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xBloodyHeartx




PostPosted: Sun Nov 04, 2012 10:34 am   Post subject: Trying Not To Match User's Input When Computer Gives Random Numbers "Lotto Game". Please Help.

What is it you are trying to achieve?
I AM TRYING TO GET THE USER TO INPUT PAST WINNING NUMBERS, THEN WHEN THE USER COMES OUT OF THAT WINDOW "OPTION 1" GOES TO "OPTION 6" TO GET NUMBERS COMPUTER GIVES THE USER THE USER DOESN'T WANT THE EXACT SAME LINES OR MATCH THAT THE USER INPUT IN "OPTION 1". BUT THE COMPUTER IS ABLE TO GIVE THE NUMBERS AGAIN JUST NOT SHOWING THE LINE IT SHOWS WHEN USER INPUTS. EXAMPLE: USER INPUTS "5, 10, 20, 35, 45, 15 =130" AND THE COMPUTER GIVES "20, 45, 10, 8, 40, 7 =130"


What is the problem you are having?
TRYING NOT TO MATCH EXACT LINE THE USER INPUTS WHEN THE COMPUTER GIVES RANDOM NUMBERS BUT IS STILL ABLE TO PICK THOSE NUMBERS


Describe what you have tried to solve this problem
TRIED TO SOLVE IT WITH 1 - 49 NUMBERS THEN TRIED IT SHORTER RANDOM NUMBER RANGE 1 - 2


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

loop
cls
var answer : int
color (40)
locate (33, 32)
put "LET'S PLAY"
locate (35, 30)
color (1)
put "1. Lotto 649"
locate (36, 30)
put "2. Lotto Max"
locate (37, 30)
put "3. Exit"
locate (38, 30)
put "Option:"
color (40)
locate (38, 38)
get answer

%Lotto 649 Menu
var lotto6491, lotto6492, lotto6493, lotto6494, lotto6495, lotto6496, total6491 : int := 0
var range1649 : int := 1
var range2649 : int := 4

loop
if answer = 1
then
cls
var answer649 : int
color (40)
locate (21, 32)
put "Lotto 649"
locate (23, 18)
color (1)
put "1. Input Past Winning Numbers"
locate (24, 18)

locate (25, 18)

locate (27, 16)
color (40)
put "******************************************"
locate (28, 16)
put "*"
locate (29, 16)
put "*"
locate (30, 16)
put "*"
locate (31, 16)
put "*"
locate (32, 16)
put "*"
locate (33, 16)
put "*"
locate (34, 16)
put "*"
locate (35, 16)
put "******************************************"
locate (28, 57)
put "*"
locate (29, 57)
put "*"
locate (30, 57)
put "*"
locate (31, 57)
put "*"
locate (32, 57)
put "*"
locate (33, 57)
put "*"
locate (34, 57)
put "*"
color (1)
locate (29, 20)

locate (29, 43)
color (40)

locate (29, 47)
color (1)
put "-"
color (40)
locate (29, 49)

color (40)
locate (29, 57)
put "*"
locate (31, 18)
color (1)

locate (31, 57)
color (40)
put "*"
locate (32, 18)
color (1)

locate (32, 57)
color (40)
put "*"
locate (33, 18)
color (1)
put "6. 6 Random Numbers Play"
locate (33, 57)
color (40)
put "*"
locate (37, 18)
color (1)
put "7. Exit Lotto 649, Back To Main Menu"
locate (39, 18)
put "Option:"
color (40)
locate (39, 26)
color (40)
get answer649

%Input Past Winning Numbers Lotto 649
if answer649 = 1
then
cls

color (1)
var line1649 : int
locate (13, 1)
put "How Many Lines Would You Like To Type In?"
locate (14, 1)
put "[If Entered Zero, Back To Main Menu]"
locate (15, 1)
put "="
locate (15, 3)
color (40)
get line1649
put ""
var o : array 0 .. line1649 of int
for i : 1 .. upper (o)
color (7)
locate (16 + i, 1)
get lotto6491
locate (16 + i, 4)
get lotto6492

total6491 := lotto6491 + lotto6492
locate (16 + i, 22)
put "=", total6491
end for
put ""
var ch : string (1)
color (1)
put "Back To The Menu, Hit Enter"
getch (ch)
end if


%6 Random Numbers Lotto 649
if answer649 = 6
then
cls

var line2649 : int
locate (13, 1)
color (1)
put "How Many Lines Would You Like?", " Sum Range "
locate (13, 42)
color (40)
put range1649
locate (13, 46)
color (1)
put "-"
locate (13, 48)
color (40)
put range2649
color (1)
locate (14, 1)
put "[If Entered Zero, Goes Back To Menu]"
locate (15, 1)
put "="
locate (15, 3)
color (40)
get line2649
put ""
color (7)
var lines649 : array 0 .. line2649 of int
var num6491, num6492, total649 : int
for linez649 : 1 .. upper (lines649)
loop
loop
num6491 := Rand.Int (1, 2)
num6492 := Rand.Int (1, 2)

if num6491 not= num6492
and num6492 not= num6491
then
exit
end if
end loop

total649 := num6491 + num6492
if total649 >= range1649 and total649 <= range2649 then
exit
end if

if (total649 = num6491 + num6492) not= (total6491 = lotto6491 + lotto6492)
then
exit
end if


end loop
put num6491, " ", num6492, " ", " =", total649
end for
put ""
color (1)
var ch : string (1)
put "Back To The Menu, Hit Enter"
getch (ch)
end if

%Exit Lotto 649 Menu
if answer649 = 7
then
exit
end if
end if
end loop

%Exit Main Menu
if answer = 3
then
exit
end if
end loop


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




PostPosted: Sun Nov 04, 2012 3:26 pm   Post subject: RE:Trying Not To Match User\'s Input When Computer Gives Random Numbers "Lotto Game". Please Help.

I didn't even bother to read this. Can you guess why?
chipanpriest




PostPosted: Mon Nov 05, 2012 1:06 pm   Post subject: Re: Trying Not To Match User's Input When Computer Gives Random Numbers "Lotto Game". Please Help.

STOP YELLING AT ME

Also,
Turing:

%Learn to use syntax
evildaddy911




PostPosted: Tue Nov 06, 2012 4:25 pm   Post subject: Re: Trying Not To Match User's Input When Computer Gives Random Numbers "Lotto Game". Please Help.

1. For crying out loud. take off the caps lock!
2. Use puctuation! I can't make heads or tails out of what you are trying to do
3. Use
___:
for short code blocks. Use file attachments for long ones
4. Clean up/comment your code! what in the world is the point of all this
Turing:
put "*"
locate (34, 16)
put "*"
locate (35, 16)
put "******************************************"
-
-
-
locate (29, 47)
color (1)
put "-"
color (40)
locate (29, 49)

color (40)
locate (29, 57)
put "*"
locate (31, 18)
color (1)

I suggest you try this post again. Use the above suggestions so that we may understand what it is you speak of. DO NOT make a new topic, just post the revised edition.
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: