
-----------------------------------
Biohazzrd
Wed Apr 05, 2006 6:09 pm

help with my blackjack game
-----------------------------------
ok you know in blackjack ach card can only be dealt once but on the computr with random integers it picks the same one over and over. I know I need a boolean variable for each card do decide wether they have been use. But I don't know how to set it up to record that.

-----------------------------------
Clayton
Wed Apr 05, 2006 6:18 pm


-----------------------------------
you could make a seperate array of booleans to match the one im assuming you are using for your cards, it could look something like this


var cards:array 1..52 of int
var dealt:array 1..52 of boolean
for x:1..52
       dealt(x):= false
end for
%pick the card you deal
if dealt(card#dealt)=false then
%deal card
else
%pick another card
end if

-----------------------------------
Clayton
Wed Apr 05, 2006 6:19 pm


-----------------------------------
oops got a little happy with the submit button, but anyways, use something like that and put it into your code and see if it works good luck

-----------------------------------
Cervantes
Wed Apr 05, 2006 7:35 pm


-----------------------------------
Arrgh! It's contagious!

Parallel arrays are not the way to go here. The next step up from parallel arrays is to use an array of a user defined data type. It's the same thing, in that you get both your int variable and your boolean variable, but the corresponding values are bound together. You don't have to trust that each of your two arrays stays in the same order for your data to be correct.


var cards : array 1 .. 52 of
    record
        value : int
        dealt : boolean
    end record


Alternatively, you can make a Edit: spelling.

-----------------------------------
TokenHerbz
Wed Apr 05, 2006 7:43 pm


-----------------------------------
i like cervantes way, but if im sure this would work too :S

its more sloppy, and probable more confusing, but i want to post it anyways:


var maxnum: int := 52    %%Enter here your max number
var number: int     %%This here is your number
var used: array 1 .. maxnum of boolean   %%this will tell you if the numbers used or not

for i : 1 .. maxnum  %%use a for statment to declare the array variable's
    used(i) := false        %%sets all the numbers NOT declared
end for
loop                    %%to keep the program going
    for i: 1 .. maxnum       %%use this for cause it holds the variables need'd (booleans)
        randint(number,1,maxnum)     %%randomizes your number
        if number = i then      %% if the random number = the one in the for
            if used(i) = false then     %%checks to see if the numbers been used
               put number, " " ..     %%puts the number
                used(i) := true     %%now marks the number as been used
            end if
        end if
    end for
end loop


i recommend doing it like cervantes said.

-----------------------------------
Biohazzrd
Wed Apr 05, 2006 7:51 pm


-----------------------------------
thanks but i'm just  wondering if this would workvar cardFind : array 1 .. 52 of boolean
for i : 1 .. 52
    cardFind (i) := false
end for
procedure card_Find
    var cardFind : array 1 .. 52 of boolean
    for i : 1 .. 52
        cardFind (i) := false
    end for
    if cardDeal = 1 then
        cardFind (1) := true
    elsif cardDeal = 2 then
        cardFind (2) := true
    elsif cardDeal = 3 then
        cardFind (3) := true
    elsif cardDeal = 4 then
        cardFind (4) := true
    elsif cardDeal = 5 then
        cardFind (5) := true
    elsif cardDeal = 6 then
        cardFind (6) := true
    elsif cardDeal = 7 then
        cardFind (7) := true
    elsif cardDeal = 8 then
        cardFind (8) := true
    elsif cardDeal = 9 then
        cardFind (9) := true
    elsif cardDeal = 10 then
        cardFind (10) := true
    elsif cardDeal = 11 then
        cardFind (11) := true
    elsif cardDeal = 12 then
        cardFind (12) := true
    elsif cardDeal = 13 then
        cardFind (13) := true
    elsif cardDeal = 14 then
        cardFind (14) := true
    elsif cardDeal = 15 then
        cardFind (15) := true
    elsif cardDeal = 16 then
        cardFind (16) := true
    elsif cardDeal = 17 then
        cardFind (17) := true
    elsif cardDeal = 18 then
        cardFind (18) := true
    elsif cardDeal = 19 then
        cardFind (19) := true
    elsif cardDeal = 20 then
        cardFind (20) := true
    elsif cardDeal = 21 then
        cardFind (21) := true
    elsif cardDeal = 22 then
        cardFind (22) := true
    elsif cardDeal = 23 then
        cardFind (23) := true
    elsif cardDeal = 24 then
        cardFind (24) := true
    elsif cardDeal = 25 then
        cardFind (25) := true
    elsif cardDeal = 26 then
        cardFind (26) := true
    elsif cardDeal = 27 then
        cardFind (27) := true
    elsif cardDeal = 28 then
        cardFind (28) := true
    elsif cardDeal = 29 then
        cardFind (29) := true
    elsif cardDeal = 30 then
        cardFind (30) := true
    elsif cardDeal = 31 then
        cardFind (31) := true
    elsif cardDeal = 32 then
        cardFind (32) := true
    elsif cardDeal = 33 then
        cardFind (33) := true
    elsif cardDeal = 34 then
        cardFind (34) := true
    elsif cardDeal = 35 then
        cardFind (35) := true
    elsif cardDeal = 36 then
        cardFind (36) := true
    elsif cardDeal = 37 then
        cardFind (37) := true
    elsif cardDeal = 38 then
        cardFind (38) := true
    elsif cardDeal = 39 then
        cardFind (39) := true
    elsif cardDeal = 40 then
        cardFind (40) := true
    elsif cardDeal = 41 then
        cardFind (41) := true
    elsif cardDeal = 42 then
        cardFind (42) := true
    elsif cardDeal = 43 then
        cardFind (43) := true
    elsif cardDeal = 44 then
        cardFind (44) := true
    elsif cardDeal = 45 then
        cardFind (45) := true
    elsif cardDeal = 46 then
        cardFind (46) := true
    elsif cardDeal = 47 then
        cardFind (47) := true
    elsif cardDeal = 48 then
        cardFind (48) := true
    elsif cardDeal = 49 then
        cardFind (49) := true
    elsif cardDeal = 50 then
        cardFind (50) := true
    elsif cardDeal = 51 then
        cardFind (51) := true
    elsif cardDeal = 52 then
        cardFind (52) := true
    end if
end card_Find


-----------------------------------
Biohazzrd
Wed Apr 05, 2006 7:55 pm


-----------------------------------
and the cardDeal variablee is part of my randint part and that works

-----------------------------------
Cervantes
Wed Apr 05, 2006 8:16 pm


-----------------------------------

    if cardDeal = 1 then
        cardFind (1) := true
    elsif cardDeal = 2 then
        cardFind (2) := true
    elsif cardDeal = 3 then
        cardFind (3) := true
    elsif cardDeal = 4 then
        cardFind (4) := true
    elsif cardDeal = 5 then
        cardFind (5) := true
    elsif cardDeal = 6 then
        cardFind (6) := true
    elsif cardDeal = 7 then
        cardFind (7) := true
    elsif cardDeal = 8 then
        cardFind (8) := true
    elsif cardDeal = 9 then
        cardFind (9) := true
    elsif cardDeal = 10 then
        cardFind (10) := true
    elsif cardDeal = 11 then
        cardFind (11) := true
    elsif cardDeal = 12 then
        cardFind (12) := true
    elsif cardDeal = 13 then
        cardFind (13) := true
    elsif cardDeal = 14 then
        cardFind (14) := true
    elsif cardDeal = 15 then
        cardFind (15) := true
    elsif cardDeal = 16 then
        cardFind (16) := true
    elsif cardDeal = 17 then
        cardFind (17) := true
    elsif cardDeal = 18 then
        cardFind (18) := true
    elsif cardDeal = 19 then
        cardFind (19) := true
    elsif cardDeal = 20 then
        cardFind (20) := true
    elsif cardDeal = 21 then
        cardFind (21) := true
    elsif cardDeal = 22 then
        cardFind (22) := true
    elsif cardDeal = 23 then
        cardFind (23) := true
    elsif cardDeal = 24 then
        cardFind (24) := true
    elsif cardDeal = 25 then
        cardFind (25) := true
    elsif cardDeal = 26 then
        cardFind (26) := true
    elsif cardDeal = 27 then
        cardFind (27) := true
    elsif cardDeal = 28 then
        cardFind (28) := true
    elsif cardDeal = 29 then
        cardFind (29) := true
    elsif cardDeal = 30 then
        cardFind (30) := true
    elsif cardDeal = 31 then
        cardFind (31) := true
    elsif cardDeal = 32 then
        cardFind (32) := true
    elsif cardDeal = 33 then
        cardFind (33) := true
    elsif cardDeal = 34 then
        cardFind (34) := true
    elsif cardDeal = 35 then
        cardFind (35) := true
    elsif cardDeal = 36 then
        cardFind (36) := true
    elsif cardDeal = 37 then
        cardFind (37) := true
    elsif cardDeal = 38 then
        cardFind (38) := true
    elsif cardDeal = 39 then
        cardFind (39) := true
    elsif cardDeal = 40 then
        cardFind (40) := true
    elsif cardDeal = 41 then
        cardFind (41) := true
    elsif cardDeal = 42 then
        cardFind (42) := true
    elsif cardDeal = 43 then
        cardFind (43) := true
    elsif cardDeal = 44 then
        cardFind (44) := true
    elsif cardDeal = 45 then
        cardFind (45) := true
    elsif cardDeal = 46 then
        cardFind (46) := true
    elsif cardDeal = 47 then
        cardFind (47) := true
    elsif cardDeal = 48 then
        cardFind (48) := true
    elsif cardDeal = 49 then
        cardFind (49) := true
    elsif cardDeal = 50 then
        cardFind (50) := true
    elsif cardDeal = 51 then
        cardFind (51) := true
    elsif cardDeal = 52 then
        cardFind (52) := true
    end if

Oh my... You didn't.

How about replacing those 104 lines with 1:
cardFind (cardDeal) := true

-----------------------------------
Clayton
Thu Apr 06, 2006 5:26 pm


-----------------------------------
ok i only gave him the idea for parallel arrays because it seemed like a simpler idea for a newer person at Turing

-----------------------------------
Biohazzrd
Sun Apr 09, 2006 10:00 pm


-----------------------------------
so cervantes ur saying that if i replace the code i showed u with that one lime then when ever a card gets played its corresponding boolean will turn to true

-----------------------------------
[Gandalf]
Sun Apr 09, 2006 10:10 pm


-----------------------------------
Yes.  Think about how the program would progress, step by step.  If cardDeal is 4, then you want cardFind (4) to equal true.  So therefore you need cardFind (cardDeal) to be true.

-----------------------------------
Biohazzrd
Sun Apr 09, 2006 10:26 pm


-----------------------------------
ok thanks 

and i have some hting else that doesnt seem to work
procedure cardCheck  

    loop
        delay (500)
          hit
        if cardDeal = 1 and dealtCard (1) = true then  % cardDealt is the    %cardFind variable just different name
            
            hit
        elsif cardDeal = 1 and dealtCard (1) = false then
            exit
        end if
        if cardDeal = 2 and dealtCard (2) = true then
            put "card played"
            hit
        elsif cardDeal = 2 and dealtCard (2) = false then
            exit
        end if
        if cardDeal = 3 and dealtCard (3) = true then
            put "card played"
            hit
        elsif cardDeal = 3 and dealtCard (3) = false then
            exit
        end if
        if cardDeal = 4 and dealtCard (4) = true then
            put "card played"
            hit
        elsif cardDeal = 4 and dealtCard (4) = false then
            exit
        end if
        if cardDeal = 5 and dealtCard (5) = true then
            put "card played"
            hit
        elsif cardDeal = 5 and dealtCard (5) = false then
            exit
        end if
        if cardDeal = 6 and dealtCard (6) = true then
            put "card played"
            hit
        elsif cardDeal = 6 and dealtCard (6) = false then
            exit
        end if
        if cardDeal = 7 and dealtCard (7) = true then
            put "card played"
            hit
        elsif cardDeal = 7 and dealtCard (7) = false then
            exit
        end if
        if cardDeal = 8 and dealtCard (8) = true then
            put "card played"
            hit
        elsif cardDeal = 8 and dealtCard (8) = false then
            exit
        end if
        if cardDeal = 9 and dealtCard (9) = true then
            put "card played"
            hit
        elsif cardDeal = 10 and dealtCard (10) = false then
            exit
        end if
        if cardDeal = 10 and dealtCard (10) = true then
            put "card played"
            hit
        elsif cardDeal = 10 and dealtCard (10) = false then
            exit
        end if
        if cardDeal = 11 and dealtCard (11) = true then
            put "card played"
            hit
        elsif cardDeal = 11 and dealtCard (11) = false then
            exit
        end if
        if cardDeal = 12 and dealtCard (12) = true then
            put "card played"
            hit
        elsif cardDeal = 12 and dealtCard (12) = false then
            exit
        end if
        if cardDeal = 13 and dealtCard (13) = true then
            put "card played"
            hit
        elsif cardDeal = 13 and dealtCard (13) = false then
            exit
        end if
        if cardDeal = 14 and dealtCard (14) = true then
            put "card played"
            hit
        elsif cardDeal = 14 and dealtCard (14) = false then
            exit
        end if
        if cardDeal = 15 and dealtCard (15) = true then
            put "card played"
            hit
        elsif cardDeal = 15 and dealtCard (15) = false then
            exit
        end if
        if cardDeal = 16 and dealtCard (16) = true then
            put "card played"
            hit
        elsif cardDeal = 16 and dealtCard (16) = false then
            exit
        end if
        if cardDeal = 17 and dealtCard (17) = true then
            put "card played"
            hit
        elsif cardDeal = 17 and dealtCard (17) = false then
            exit
        end if
        if cardDeal = 18 and dealtCard (18) = true then
            put "card played"
            hit
        elsif cardDeal = 18 and dealtCard (18) = false then
            exit
        end if
        if cardDeal = 19 and dealtCard (19) = true then
            put "card played"
            hit
        elsif cardDeal = 19 and dealtCard (19) = false then
            exit
        end if
        if cardDeal = 20 and dealtCard (20) = true then
            put "card played"
            hit
        elsif cardDeal = 20 and dealtCard (20) = false then
            exit
        end if
        if cardDeal = 21 and dealtCard (21) = true then
            put "card played"
            hit
        elsif cardDeal = 21 and dealtCard (21) = false then
            exit
        end if
        if cardDeal = 22 and dealtCard (22) = true then
            put "card played"
            hit
        elsif cardDeal = 22 and dealtCard (22) = false then
            exit
        end if
        if cardDeal = 23 and dealtCard (23) = true then
            put "card played"
            hit
        elsif cardDeal = 23 and dealtCard (23) = false then
            exit
        end if
        if cardDeal = 24 and dealtCard (24) = true then
            put "card played"
            hit
        elsif cardDeal = 25 and dealtCard (25) = false then
            exit
        end if
        if cardDeal = 26 and dealtCard (26) = true then
            put "card played"
            hit
        elsif cardDeal = 26 and dealtCard (26) = false then
            exit
        end if
        if cardDeal = 27 and dealtCard (27) = true then
            put "card played"
            hit
        elsif cardDeal = 27 and dealtCard (27) = false then
            exit
        end if
        if cardDeal = 28 and dealtCard (28) = true then
            put "card played"
            hit
        elsif cardDeal = 28 and dealtCard (28) = false then
            exit
        end if
        if cardDeal = 29 and dealtCard (29) = true then
            put "card played"
            hit
        elsif cardDeal = 29 and dealtCard (29) = false then
            exit
        end if
        if cardDeal = 30 and dealtCard (30) = true then
            put "card played"
            hit
        elsif cardDeal = 30 and dealtCard (30) = false then
            exit
        end if
        if cardDeal = 31 and dealtCard (31) = true then
            put "card played"
            hit
        elsif cardDeal = 31 and dealtCard (31) = false then
            exit
        end if
        if cardDeal = 32 and dealtCard (32) = true then
            put "card played"
            hit
        elsif cardDeal = 32 and dealtCard (32) = false then
            exit
        end if
        if cardDeal = 33 and dealtCard (33) = true then
            put " card played"
            hit
        elsif cardDeal = 33 and dealtCard (33) = false then
            exit
        end if
        if cardDeal = 34 and dealtCard (34) = true then
            put "card played"
            hit
        elsif cardDeal = 34 and dealtCard (34) = false then
            exit
        end if
        if cardDeal = 35 and dealtCard (35) = true then
            put "card played"
            hit
        elsif cardDeal = 35 and dealtCard (35) = false then
            exit
        end if
        if cardDeal = 36 and dealtCard (36) = true then
            put "card played"
            hit
        elsif cardDeal = 36 and dealtCard (36) = false then
            exit
        end if
        if cardDeal = 37 and dealtCard (37) = true then
            put "card played"
            hit
        elsif cardDeal = 37 and dealtCard (37) = false then
            exit
        end if
        if cardDeal = 38 and dealtCard (38) = true then
            put "card played"
            hit
        elsif cardDeal = 38 and dealtCard (38) = false then
            exit
        end if
        if cardDeal = 39 and dealtCard (39) = true then
            put "card played"
            hit
        elsif cardDeal = 39 and dealtCard (39) = false then
            exit
        end if
        if cardDeal = 40 and dealtCard (40) = true then
            put "card played"
            hit
        elsif cardDeal = 40 and dealtCard (40) = false then
            exit
        end if
        if cardDeal = 41 and dealtCard (41) = true then
            put "card played"
            hit
        elsif cardDeal = 41 and dealtCard (41) = false then
            exit
        end if
        if cardDeal = 42 and dealtCard (42) = true then
            put "card played"
            hit
        elsif cardDeal = 42 and dealtCard (42) = false then
            exit
        end if
        if cardDeal = 43 and dealtCard (43) = true then
            put "card played"
            hit
        elsif cardDeal = 43 and dealtCard (43) = false then
            exit
        end if
        if cardDeal = 44 and dealtCard (44) = true then
            put "card played"
            hit
        elsif cardDeal = 44 and dealtCard (44) = false then
            exit
        end if
        if cardDeal = 45 and dealtCard (45) = true then
            put "card played"
            hit
        elsif cardDeal = 45 and dealtCard (45) = false then
            exit
        end if
        if cardDeal = 46 and dealtCard (46) = true then
            put "card played"
            hit
        elsif cardDeal = 46 and dealtCard (46) = false then
            exit
        end if
        if cardDeal = 47 and dealtCard (47) = true then
            put "card played"
            hit
        elsif cardDeal = 47 and dealtCard (47) = false then
            exit
        end if
        if cardDeal = 48 and dealtCard (48) = true then
            put "card played"
            hit
        elsif cardDeal = 48 and dealtCard (48) = false then
            exit
        end if
        if cardDeal = 49 and dealtCard (49) = true then
            put "card played"
            hit
        elsif cardDeal = 49 and dealtCard (49) = false then
            exit
        end if
        if cardDeal = 50 and dealtCard (50) = true then
            put "card played"
            hit
        elsif cardDeal = 50 and dealtCard (50) = false then
            exit
        end if
        if cardDeal = 51 and dealtCard (51) = true then
            put "card played"
            hit
        elsif cardDeal = 51 and dealtCard (51) = false then
            exit
        end if
        if cardDeal = 52 and dealtCard (52) = true then
            put "card played"
            hit
        elsif cardDeal = 52 and dealtCard (52) = false then
            exit
        end if

    end loop
end cardCheck


-----------------------------------
Biohazzrd
Sun Apr 09, 2006 10:29 pm


-----------------------------------
this is supposed to make it hit until it picks a card that has not been played (or = true)

-----------------------------------
Clayton
Mon Apr 10, 2006 12:59 pm


-----------------------------------
ok thanks 

and i have some hting else that doesnt seem to work
procedure cardCheck  

    loop
        delay (500)
          hit
        if cardDeal = 1 and dealtCard (1) = true then  % cardDealt is the    %cardFind variable just different name
            
            hit
        elsif cardDeal = 1 and dealtCard (1) = false then
            exit
        end if
        if cardDeal = 2 and dealtCard (2) = true then
            put "card played"
            hit
        elsif cardDeal = 2 and dealtCard (2) = false then
            exit
        end if
        if cardDeal = 3 and dealtCard (3) = true then
            put "card played"
            hit
        elsif cardDeal = 3 and dealtCard (3) = false then
            exit
        end if
        if cardDeal = 4 and dealtCard (4) = true then
            put "card played"
            hit
        elsif cardDeal = 4 and dealtCard (4) = false then
            exit
        end if
        if cardDeal = 5 and dealtCard (5) = true then
            put "card played"
            hit
        elsif cardDeal = 5 and dealtCard (5) = false then
            exit
        end if
        if cardDeal = 6 and dealtCard (6) = true then
            put "card played"
            hit
        elsif cardDeal = 6 and dealtCard (6) = false then
            exit
        end if
        if cardDeal = 7 and dealtCard (7) = true then
            put "card played"
            hit
        elsif cardDeal = 7 and dealtCard (7) = false then
            exit
        end if
        if cardDeal = 8 and dealtCard (8) = true then
            put "card played"
            hit
        elsif cardDeal = 8 and dealtCard (8) = false then
            exit
        end if
        if cardDeal = 9 and dealtCard (9) = true then
            put "card played"
            hit
        elsif cardDeal = 10 and dealtCard (10) = false then
            exit
        end if
        if cardDeal = 10 and dealtCard (10) = true then
            put "card played"
            hit
        elsif cardDeal = 10 and dealtCard (10) = false then
            exit
        end if
        if cardDeal = 11 and dealtCard (11) = true then
            put "card played"
            hit
        elsif cardDeal = 11 and dealtCard (11) = false then
            exit
        end if
        if cardDeal = 12 and dealtCard (12) = true then
            put "card played"
            hit
        elsif cardDeal = 12 and dealtCard (12) = false then
            exit
        end if
        if cardDeal = 13 and dealtCard (13) = true then
            put "card played"
            hit
        elsif cardDeal = 13 and dealtCard (13) = false then
            exit
        end if
        if cardDeal = 14 and dealtCard (14) = true then
            put "card played"
            hit
        elsif cardDeal = 14 and dealtCard (14) = false then
            exit
        end if
        if cardDeal = 15 and dealtCard (15) = true then
            put "card played"
            hit
        elsif cardDeal = 15 and dealtCard (15) = false then
            exit
        end if
        if cardDeal = 16 and dealtCard (16) = true then
            put "card played"
            hit
        elsif cardDeal = 16 and dealtCard (16) = false then
            exit
        end if
        if cardDeal = 17 and dealtCard (17) = true then
            put "card played"
            hit
        elsif cardDeal = 17 and dealtCard (17) = false then
            exit
        end if
        if cardDeal = 18 and dealtCard (18) = true then
            put "card played"
            hit
        elsif cardDeal = 18 and dealtCard (18) = false then
            exit
        end if
        if cardDeal = 19 and dealtCard (19) = true then
            put "card played"
            hit
        elsif cardDeal = 19 and dealtCard (19) = false then
            exit
        end if
        if cardDeal = 20 and dealtCard (20) = true then
            put "card played"
            hit
        elsif cardDeal = 20 and dealtCard (20) = false then
            exit
        end if
        if cardDeal = 21 and dealtCard (21) = true then
            put "card played"
            hit
        elsif cardDeal = 21 and dealtCard (21) = false then
            exit
        end if
        if cardDeal = 22 and dealtCard (22) = true then
            put "card played"
            hit
        elsif cardDeal = 22 and dealtCard (22) = false then
            exit
        end if
        if cardDeal = 23 and dealtCard (23) = true then
            put "card played"
            hit
        elsif cardDeal = 23 and dealtCard (23) = false then
            exit
        end if
        if cardDeal = 24 and dealtCard (24) = true then
            put "card played"
            hit
        elsif cardDeal = 25 and dealtCard (25) = false then
            exit
        end if
        if cardDeal = 26 and dealtCard (26) = true then
            put "card played"
            hit
        elsif cardDeal = 26 and dealtCard (26) = false then
            exit
        end if
        if cardDeal = 27 and dealtCard (27) = true then
            put "card played"
            hit
        elsif cardDeal = 27 and dealtCard (27) = false then
            exit
        end if
        if cardDeal = 28 and dealtCard (28) = true then
            put "card played"
            hit
        elsif cardDeal = 28 and dealtCard (28) = false then
            exit
        end if
        if cardDeal = 29 and dealtCard (29) = true then
            put "card played"
            hit
        elsif cardDeal = 29 and dealtCard (29) = false then
            exit
        end if
        if cardDeal = 30 and dealtCard (30) = true then
            put "card played"
            hit
        elsif cardDeal = 30 and dealtCard (30) = false then
            exit
        end if
        if cardDeal = 31 and dealtCard (31) = true then
            put "card played"
            hit
        elsif cardDeal = 31 and dealtCard (31) = false then
            exit
        end if
        if cardDeal = 32 and dealtCard (32) = true then
            put "card played"
            hit
        elsif cardDeal = 32 and dealtCard (32) = false then
            exit
        end if
        if cardDeal = 33 and dealtCard (33) = true then
            put " card played"
            hit
        elsif cardDeal = 33 and dealtCard (33) = false then
            exit
        end if
        if cardDeal = 34 and dealtCard (34) = true then
            put "card played"
            hit
        elsif cardDeal = 34 and dealtCard (34) = false then
            exit
        end if
        if cardDeal = 35 and dealtCard (35) = true then
            put "card played"
            hit
        elsif cardDeal = 35 and dealtCard (35) = false then
            exit
        end if
        if cardDeal = 36 and dealtCard (36) = true then
            put "card played"
            hit
        elsif cardDeal = 36 and dealtCard (36) = false then
            exit
        end if
        if cardDeal = 37 and dealtCard (37) = true then
            put "card played"
            hit
        elsif cardDeal = 37 and dealtCard (37) = false then
            exit
        end if
        if cardDeal = 38 and dealtCard (38) = true then
            put "card played"
            hit
        elsif cardDeal = 38 and dealtCard (38) = false then
            exit
        end if
        if cardDeal = 39 and dealtCard (39) = true then
            put "card played"
            hit
        elsif cardDeal = 39 and dealtCard (39) = false then
            exit
        end if
        if cardDeal = 40 and dealtCard (40) = true then
            put "card played"
            hit
        elsif cardDeal = 40 and dealtCard (40) = false then
            exit
        end if
        if cardDeal = 41 and dealtCard (41) = true then
            put "card played"
            hit
        elsif cardDeal = 41 and dealtCard (41) = false then
            exit
        end if
        if cardDeal = 42 and dealtCard (42) = true then
            put "card played"
            hit
        elsif cardDeal = 42 and dealtCard (42) = false then
            exit
        end if
        if cardDeal = 43 and dealtCard (43) = true then
            put "card played"
            hit
        elsif cardDeal = 43 and dealtCard (43) = false then
            exit
        end if
        if cardDeal = 44 and dealtCard (44) = true then
            put "card played"
            hit
        elsif cardDeal = 44 and dealtCard (44) = false then
            exit
        end if
        if cardDeal = 45 and dealtCard (45) = true then
            put "card played"
            hit
        elsif cardDeal = 45 and dealtCard (45) = false then
            exit
        end if
        if cardDeal = 46 and dealtCard (46) = true then
            put "card played"
            hit
        elsif cardDeal = 46 and dealtCard (46) = false then
            exit
        end if
        if cardDeal = 47 and dealtCard (47) = true then
            put "card played"
            hit
        elsif cardDeal = 47 and dealtCard (47) = false then
            exit
        end if
        if cardDeal = 48 and dealtCard (48) = true then
            put "card played"
            hit
        elsif cardDeal = 48 and dealtCard (48) = false then
            exit
        end if
        if cardDeal = 49 and dealtCard (49) = true then
            put "card played"
            hit
        elsif cardDeal = 49 and dealtCard (49) = false then
            exit
        end if
        if cardDeal = 50 and dealtCard (50) = true then
            put "card played"
            hit
        elsif cardDeal = 50 and dealtCard (50) = false then
            exit
        end if
        if cardDeal = 51 and dealtCard (51) = true then
            put "card played"
            hit
        elsif cardDeal = 51 and dealtCard (51) = false then
            exit
        end if
        if cardDeal = 52 and dealtCard (52) = true then
            put "card played"
            hit
        elsif cardDeal = 52 and dealtCard (52) = false then
            exit
        end if

    end loop
end cardCheck

omg u didnt do that again, shorten it to something like this

for x:1..52
     if dealtCard(x)=true then
          ...
     elsif dealtCard(x)=false then
          exit
     end if
end for


-----------------------------------
codemage
Mon Apr 10, 2006 1:34 pm


-----------------------------------
You know, that actually hurts, physically, when you use redundant code like that.

Like how it hurts, physically, when you redundantly punch someone in the face.

It's the same pain. :oops:

-----------------------------------
Andy
Mon Apr 10, 2006 1:35 pm


-----------------------------------
lol.. i'd love to see the face his teacher makes after he hands in this code...

-----------------------------------
Delos
Mon Apr 10, 2006 4:10 pm


-----------------------------------

Oh my... You didn't.

How about replacing those 104 lines with 1:
Code:
cardFind (cardDeal) := true



omg u didnt do that again, shorten it to something like this

for x:1..52
     if dealtCard(x)=true then
          ...
     elsif dealtCard(x)=false then
          exit
     end if
end for


Doesn't seem to listen very well, does he?

-----------------------------------
MysticVegeta
Mon Apr 10, 2006 6:00 pm


-----------------------------------
lol.. i'd love to see the face his teacher makes after he hands in this code...
Dont worry he wont hand that in, yu guys are too good to let him hand in redundant code :)

-----------------------------------
Cervantes
Mon Apr 10, 2006 6:11 pm


-----------------------------------
Is this some sort of joke? Should we move it to the Evidence forum? Really: I can understand how someone might start down that path, but I can't believe that someone would type out over a hundred lines of the same thing and not see a pattern.

Oh, and by the way:


for x:1..52
     if dealtCard(x)=true then
          ...
     elsif dealtCard(x)=false then
          exit
     end if
end for 


That's equivalent to the following:

for x : 1 .. 52
    if dealtCard (x) then
        ...
    else
        exit
    end if
end for

If it was not true when the initial condition was evaluated, it has to be false.

-----------------------------------
Clayton
Mon Apr 10, 2006 6:11 pm


-----------------------------------
Biohazzard, the whole point we are trying to help you with is condensing your code. not only would your code have taken forever, but it is pointless, why hardcode everything when you can make something much more dynamic. if you are having trouble with condensing your code, look through the Turing Walkthrough to check some things out. remember, if you are copying or pasting more than 2 times(and only a couple lines of code), find a shorter way to code it.

-----------------------------------
Clayton
Mon Apr 10, 2006 6:13 pm


-----------------------------------
Is this some sort of joke? Should we move it to the Evidence forum? Really: I can understand how someone might start down that path, but I can't believe that someone would type out over a hundred lines of the same thing and not see a pattern.

Oh, and by the way:


for x:1..52
     if dealtCard(x)=true then
          ...
     elsif dealtCard(x)=false then
          exit
     end if
end for 


That's equivalent to the following:

for x : 1 .. 52
    if dealtCard (x) then
        ...
    else
        exit
    end if
end for

If it was not true when the initial condition was evaluated, it has to be false.
ya i know i was just kind of in a hurry when i typed that up (it was a 10 minute break at school lol) btw the double post happened cuz u posted while i was posting

-----------------------------------
Biohazzrd
Mon Apr 10, 2006 6:26 pm


-----------------------------------
ya ok i've learned i got like 300 lines into 16 lines it pulls out a random card, puts that random card if it hasent been played and adds the cards value to the player total
