Computer Science Canada

cards help

Author:  jamonathin [ Wed Mar 02, 2005 10:32 pm ]
Post subject:  cards help

I'm making a card game, and for some reason i cant get the deal right. Basically, i'm trying to make each one of these set of numbers different, but it wont work out.. p.l.e.h?
code:

setscreen ("graphics:550;400,nobuttonbar,position:center;center")
var font1, font2 : int := Font.New ("Jokerman:16:bold")
font2 := Font.New ("Jokerman:10:bold")
var card : array 1 .. 24 of
    record
        x, y, taken, suit, numb : int
    end record
for i : 1 .. 24
    card (i).suit := 0
    card (i).numb := 0
end for
colorback (2)
cls
drawfillbox (35, 35, maxx - 35, maxy - 35, 90)
drawbox (35, 35, maxx - 35, maxy - 35, black)
proc deal
    for i : 1 .. 24
        var done : boolean := false
        loop
            randint (card (i).suit, 1, 4)
            randint (card (i).numb, 1, 6)
            for q : 1 .. 24
                if card (i).suit = card (q).suit and card (i).numb = card (i).numb and done = false then
                    randint (card (i).suit, 1, 4)
                    randint (card (i).numb, 1, 6)
                else
                    done := true
                end if
            end for
            exit when done = true
        end loop
    end for
end deal
deal
for i : 1 .. 24
    locate (i, 1)
    put card (i).numb, "-", card (i).suit ..
end for

Author:  Delos [ Thu Mar 03, 2005 12:02 am ]
Post subject: 

Quote:

card (i).numb = card (i).numb


Just glancing through this...you may want to change one of those to a 'q'. Though that is somewhat of a brazen method...but a start nonetheless.

Author:  jamonathin [ Thu Mar 03, 2005 6:44 am ]
Post subject: 

Rolling Eyes oops, but even if i fixthat, it still doesn't work out right Confused

Author:  StarGateSG-1 [ Thu Mar 03, 2005 12:15 pm ]
Post subject: 

I like the idea behind your program but your problem with the dealing is that you should create a txt file to go with it and then add and remove cards from the list.

Or you could create a array with each card named in it then pick a card check if it has been taken , if not play card and repeat for as many cards.

Hint: crad games are hard to make unless you have pictures of cards get to confusing.

Also, don't satrt small get all 52 carsd working at once.

Author:  jamonathin [ Thu Mar 03, 2005 2:16 pm ]
Post subject: 

the game im making only requires 24 cards (9-ace), and i also want to make this game entirely in turing, no outside pics, cuz i haven't dont that since i made yahtzee and blackjack.

Author:  Carino [ Thu Mar 03, 2005 3:21 pm ]
Post subject: 

Im guessing your making Euchre? (9-ace needed)... great game.. have fun programming it tho.

Author:  jamonathin [ Fri Mar 04, 2005 6:41 am ]
Post subject: 

it's actually called mexican euchre, ita two player game where both players get 12 cards, and the person who isn't the dealer has to call it no matter what, it's hard to explain on here, but it'd be easier to make than normal euchre.

Author:  Carino [ Fri Mar 04, 2005 3:18 pm ]
Post subject: 

Sounds like fun. I imagine that regular euchre would be really hard to program.


: