Author |
Message |
implosion
|
Posted: Wed Jun 10, 2009 4:52 pm Post subject: Going back to the beginning of a deck |
|
|
What is it you are trying to achieve?
when reaching end of array (The deck) going back to the beginning
What is the problem you are having?
keep getting an array out of bound error
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing: |
var CARD := Card
var Game_Over_Check : flexible array 1 .. 0 of int
var Game_Over : boolean := true
for i : 1 .. upper (FirstPlayer )
new Game_Over_Check, i
if FirstPlayer (i ) = - 1 then
Game_Over_Check (i ) := - 1
else
Game_Over_Check (i ) := 0
end if
end for
for j : 1 .. upper (Game_Over_Check )
if Game_Over_Check (j ) not= - 1 then
Game_Over := false
end if
end for
if Game_Over = false then
if CARD > upper (FirstPlayer ) then
CARD := 1
elsif CARD = upper (FirstPlayer ) then
if FirstPlayer (CARD ) = - 1 then
CARD := 1
else
|
Please specify what version of Turing you are using
4.1
i'm also attaching the zip folder of it all
Description: |
|
 Download |
Filename: |
Guess.zip |
Filesize: |
310.96 KB |
Downloaded: |
101 Time(s) |
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Tony

|
Posted: Wed Jun 10, 2009 5:42 pm Post subject: RE:Going back to the beginning of a deck |
|
|
well you know where you are trying to access the array (index) and how large the array is (upper).
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
implosion
|
Posted: Wed Jun 10, 2009 7:17 pm Post subject: RE:Going back to the beginning of a deck |
|
|
i understand how i would do this if i wasn't making this game object oriented... its weird because i am passing my counter variable into my object but i don't know how to send an integer back from SHUFFLE into MAIN telling it to go to the start. i have a set deck size, but the hands of each player are flexible... oh and ever since i tried to put this method in of checking to see if a player has no cards it won't show the pictures of a card on the main screen to see if your hand is higher or lower... not sure why.. i know the delay is (1) but that was just to quickly go through the game
|
|
|
|
|
 |
implosion
|
Posted: Sun Jun 14, 2009 8:25 pm Post subject: Re: Going back to the beginning of a deck |
|
|
I've worked on my game some more... i keep going over all my bases to see if everything is right... i've read over everything and i can't find the problem... what the game is trying to do is you try and get all the cards... if you guess right i add the opponents card to your hand and then give the value of what the computer had to -1 and vise vera if you guess wrong. Attached is the updated folder. On the cheat it shows you the value of your card / oppenents card... for some reason i see -1... and if i'm right i should... any help would be appreciated... this is due tomorrow. (n)
edit : in the 2 functions ignore the boolean variable . i forgot to get rid of it.
Description: |
|
 Download |
Filename: |
Final Card Project.zip |
Filesize: |
350.17 KB |
Downloaded: |
97 Time(s) |
|
|
|
|
|
 |
|