Sorry for the re-post, but i need help with my program ASAP with multiple loops!
Author |
Message |
kavinda123
|
Posted: Sat Jan 18, 2014 4:56 pm Post subject: Sorry for the re-post, but i need help with my program ASAP with multiple loops! |
|
|
What is it you are trying to achieve?
i want to make a program with two loops running at the same time.
What is the problem you are having?
i need double loops in my program, but don't know how to use processes
Describe what you have tried to solve this problem
falsely trying to put a loop with a loop and trying to make a double loop work at the same time
Turing: |
% Program Variables
var x, y, button : int
var r : int := 0
var deck := "AAAA22223333444455556666777788889999TTTTJJJJQQQQKKKK"
var save : string
var messageTextNumber : int
var messageIdentifier : int
var font1 : int
font1 := Font.New ("couriernew:12")
% setscreen
setscreen ("graphics: max, max")
% Introduction
locate (1, 1)
put "Welcome to the Hockey Card Game!"
delay (3000)
locate (2, 1)
put "How to play: The players pick up the cards they are dealt, look at them, and play in turn. The first card is played by the non-dealer."
locate (3, 1)
put "A turn consists of playing one card from your hand face up to the centre of the table. "
locate (4, 1)
put "The cards played by both players are stacked in a single pile so that only the most recently played card is visible."
locate (5, 1)
put "If a card is played which matches the rank of the top card of the pile"
locate (6, 1)
put "(for example an 8 is played on an 8), this creates a breakaway for the person who played the matching card. "
locate (7, 1)
put "Also, any time that a Jack is played, this creates a breakaway for the player of the Jack. "
locate (8, 1)
put "If a player who creates a breakaway then matches the next card played by the opponent, the player scores a goal."
locate (9, 1)
put "A goal itself is not a breakaway. After a goal a new breakaway is needed before a new goal can be scored. "
locate (10, 1)
put "However, a breakaway can be created by matching the card used to score a goal. "
locate (11, 1)
delay (3000)
put "Ready to play?"
locate (12, 1)
delay (2000)
put "Press any button to continue..."
loop
exit when hasch
end loop
cls
put "Starting in 3..."
delay (1000)
cls
put "Starting in 2..."
delay (1000)
cls
put "Starting in 1..."
delay (1000)
cls
put "Starting in 0..."
delay (1000)
cls
% Main code
% Logic
% Shuffling
for i : 1 .. 10000
randint (r, 1, 20)
save := deck (1 .. r )
deck := deck (r + 1 .. *)
deck := deck (r + 1 .. *) + deck (1 .. r ) + save
end for
cls
put deck
% Graphics
% Layout
% Cards
% Player
% Player Card #1
Draw.Box (5, 25, 105, 175, black)
% Player Card #2
Draw.Box (125, 25, 225, 175, black)
% Player Card #3
Draw.Box (245, 25, 345, 175, black)
% Player Card #4
Draw.Box (365, 25, 465, 175, black)
% Player Card #5
Draw.Box (485, 25, 585, 175, black)
% Opponent
% Opponent Card #1
Draw.Box (5, 905, 105, 755, black)
Draw.Line (5, 905, 105, 755, black)
Draw.Line (5, 755, 105, 905, black)
% Opponent Card #2
Draw.Box (125, 905, 225, 755, black)
Draw.Line (125, 905, 225, 755, black)
Draw.Line (125, 755, 225, 905, black)
% Opponent Card #3
Draw.Box (245, 905, 345, 755, black)
Draw.Line (245, 905, 345, 755, black)
Draw.Line (245, 755, 345, 905, black)
% Opponent Card #4
Draw.Box (365, 905, 465, 755, black)
Draw.Line (365, 905, 465, 755, black)
Draw.Line (365, 755, 465, 905, black)
% Opponent Card #5
Draw.Box (485, 905, 585, 755, black)
Draw.Line (485, 905, 585, 755, black)
Draw.Line (485, 755, 585, 905, black)
% Random Message
Draw.Box (1020, 920, 1260, 660, black)
loop
Font.Draw ("Tip: ", 1025, 895, font1, black)
% Point system
% mousewhere
loop
mousewhere (x, y, button )
locate ((maxrow - 1), (maxcol- 25))
if button = 0 then
put x : 4, " ", y : 4, " button up"
else
put x : 4, " ", y : 4, " button down"
end if
% random message text
loop
randint (messageTextNumber, 1, 5)
if messageTextNumber = 1 then
locate (2, 133)
delay (100)
put "Did you know?"
locate (3, 129)
put " "
elsif messageTextNumber = 2 then
locate (2, 133)
delay (100)
put " "
locate (3, 129)
put " "
elsif messageTextNumber = 3 then
locate (2, 133)
delay (100)
put "fhgf "
locate (3, 129)
put " "
elsif messageTextNumber = 4 then
locate (2, 133)
delay (100)
put "uioipiopiop "
locate (3, 129)
put " "
elsif messageTextNumber = 5 then
locate (2, 133)
delay (100)
put "v dfgfthtukhkffserf "
locate (3, 129)
put " "
end if
end loop
end loop
end loop
|
Please specify what version of Turing you are using
4.1.1
<Answer Here> |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Raknarg
|
Posted: Sat Jan 18, 2014 5:15 pm Post subject: RE:Sorry for the re-post, but i need help with my program ASAP with multiple loops! |
|
|
Why do the loops need to run at the same time? |
|
|
|
|
|
|
|