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

Username:   Password: 
 RegisterRegister   
 cards help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jamonathin




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Thu Mar 03, 2005 12:02 am   Post subject: (No 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.
jamonathin




PostPosted: Thu Mar 03, 2005 6:44 am   Post subject: (No subject)

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




PostPosted: Thu Mar 03, 2005 12:15 pm   Post subject: (No 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.
jamonathin




PostPosted: Thu Mar 03, 2005 2:16 pm   Post subject: (No 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.
Carino




PostPosted: Thu Mar 03, 2005 3:21 pm   Post subject: (No subject)

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




PostPosted: Fri Mar 04, 2005 6:41 am   Post subject: (No 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.
Carino




PostPosted: Fri Mar 04, 2005 3:18 pm   Post subject: (No subject)

Sounds like fun. I imagine that regular euchre would be really hard to program.
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: