
-----------------------------------
Otaku1211
Sat Jan 21, 2012 3:30 pm

Help me on my card game plox &lt;3
-----------------------------------
What is it you are trying to achieve?
Trying to finish this card game by sunday night :/ i'm not very good at turing and only in grade 10, this game is called 66 and for those who dont know what it is basically you just need to get 66 points before the other player. You play with 20 cards (aces, kings, queens, jacks, 10s). Ace=11points, 10=10points, King=4,queen=3,jack=2. so you play a card and the player 2 plays one whoever has the higher card gets both cards and the points. Ace>10>King>Queen>Jack is the order of the card then the suit order is the same; spade>hearts>clubs>diamonds.


What is the problem you are having?
I dont know how to get the gameplay part


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)



    var WelcomeTo : array 1 .. 10 of string := init ("W", "e", "l", "c", "o", "m", "e", " ", "T", "o")
    var exitinstructions := 0
    var PlayRow : int := 0
    var PlayColumn : int := 0
    var PlayCounter : int := 0
    var PlayCounter2 : int := 0
    var ReplayRow : int := 0
    var ReplayColumn : int := 0
    var ReplayCounter : int := 0
    var ReplayCounter2 : int := 0
    var Replay : int := 0
    var playbutton : int := 0
    var CardCounter : string
    var CardCounter2 : string
    var CardBack : int := 0

    %play and instructions buttons
    setscreen ("Graphics")
    colorback (black)
    loop
        Draw.Text (WelcomeTo (1), maxx div 2 - 100, maxy div 2, Font.New ("ComicSans:30:bold"), brightred)
        delay (100)
        Draw.Text (WelcomeTo (2), maxx div 2 - 65, maxy div 2, Font.New ("ComicSans:30:bold"), brightred)
        delay (100)
        Draw.Text (WelcomeTo (3), maxx div 2 - 45, maxy div 2, Font.New ("ComicSans:30:bold"), brightred)
        delay (100)
        Draw.Text (WelcomeTo (4), maxx div 2 - 35, maxy div 2, Font.New ("ComicSans:30:bold"), brightred)
        delay (100)
        Draw.Text (WelcomeTo (5), maxx div 2 - 15, maxy div 2, Font.New ("ComicSans:30:bold"), brightred)
        delay (100)
        Draw.Text (WelcomeTo (6), maxx div 2 + 10, maxy div 2, Font.New ("ComicSans:30:bold"), brightred)
        delay (100)
        Draw.Text (WelcomeTo (7), maxx div 2 + 45, maxy div 2, Font.New ("ComicSans:30:bold"), brightred)
        delay (100)
        Draw.Text (WelcomeTo (8), maxx div 2 + 60, maxy div 2, Font.New ("ComicSans:30:bold"), brightred)
        delay (100)
        Draw.Text (WelcomeTo (9), maxx div 2 + 80, maxy div 2, Font.New ("ComicSans:30:bold"), brightred)
        delay (100)
        Draw.Text (WelcomeTo (10), maxx div 2 + 95, maxy div 2, Font.New ("ComicSans:30:bold"), brightred)
        delay (250)
        locate (40, 35) %Run window must be set to max row 40

        delay (100)
        %play and instructions buttons
        for text : 1 .. 25
            Draw.Text ("66 (Schnapsen)", maxx div 2 - 175, maxy div 2 - 100, Font.New ("ComicSans:40:bold"), Rand.Int (1, maxcolour))
            delay (200)
        end for
        Draw.Text ("66 (Schnapsen", maxx div 2 - 175, maxy div 2 - 100, Font.New ("ComicSans:40:bold"), black)
        colourback (white)
        put "By: Anon"
        drawbox (100, 140, 274, 200, black)
        Draw.Text ("Play", 140, 160, Font.New ("ComicSans:30:bold"), brightred)
        drawbox (350, 140, 654, 200, black)
        Draw.Text ("Instructions", 390, 160, Font.New ("ComicSans:30:bold"), brightred)
        exitinstructions := 0
        loop
            if Mouse.ButtonMoved ("down") then
                Mouse.ButtonWait ("down", PlayRow, PlayColumn, PlayCounter, PlayCounter2)
                if PlayRow >= 350 and PlayRow = 140 and PlayColumn = 350 and PlayRow = 140 and PlayColumn = 100 and PlayRow = 140 and PlayColumn  5 then
                RandomCard := RandomCard - 5
                CardPic := CardPic + 1
            end if
            exit when RandomCard < 6
        end loop
        if CardPic = 0 then
            CardPicture := "Diamond"
        elsif CardPic = 1 then
            CardPicture := "Clubs"
        elsif CardPic = 2 then
            CardPicture := "Heart"
        elsif CardPic = 3 then
            CardPicture := "Spade"
        end if
        if count = 1 then
            %Player One Card One
            PlayerOneCardOneCardNumber := RandomCard
            PlayerOneCardOnePicture := CardPicture
        elsif count = 2 then
            %Player One Card Two
            PlayerOneCardTwoCardNumber := RandomCard
            PlayerOneCardTwoPicture := CardPicture
        elsif count = 3 then
            %Player One Card Three
            PlayerOneCardThreeCardNumber := RandomCard
            PlayerOneCardThreePicture := CardPicture
        elsif count = 4 then
            %Player One Card Four
            PlayerOneCardFourCardNumber := RandomCard
            PlayerOneCardFourPicture := CardPicture
        elsif count = 5 then
            %Player One Card Five
            PlayerOneCardFiveCardNumber := RandomCard
            PlayerOneCardFivePicture := CardPicture
        elsif count = 6 then
            %Player One Card Six
            PlayerOneCardSixCardNumber := RandomCard
            PlayerOneCardSixPicture := CardPicture
            %-----------------------------------------------------------------------
        elsif count = 7 then
            %Player Two Card One
            PlayerTwoCardOneCardNumber := RandomCard
            PlayerTwoCardOnePicture := CardPicture
        elsif count = 8 then
            %Player Two Card Two
            PlayerTwoCardTwoCardNumber := RandomCard
            PlayerTwoCardTwoPicture := CardPicture
        elsif count = 9 then
            %Player Two Card Three
            PlayerTwoCardThreeCardNumber := RandomCard
            PlayerTwoCardThreePicture := CardPicture
        elsif count = 10 then
            %Player Two Card Four
            PlayerTwoCardFourCardNumber := RandomCard
            PlayerTwoCardFourPicture := CardPicture
        elsif count = 11 then
            %Player Two Card Five
            PlayerTwoCardFiveCardNumber := RandomCard
            PlayerTwoCardFivePicture := CardPicture
        elsif count = 12 then
            %Player Two Card Six
            PlayerTwoCardSixCardNumber := RandomCard
            PlayerTwoCardSixPicture := CardPicture
        end if
    end for
    put "Player One Cards"
    put PlayerOneCardOneCardNumber, " of ", PlayerOneCardOnePicture
    put PlayerOneCardTwoCardNumber, " of ", PlayerOneCardTwoPicture
    put PlayerOneCardThreeCardNumber, " of ", PlayerOneCardThreePicture
    put PlayerOneCardFourCardNumber, " of ", PlayerOneCardFourPicture
    put PlayerOneCardFiveCardNumber, " of ", PlayerOneCardFivePicture
    put PlayerOneCardSixCardNumber, " of ", PlayerOneCardSixPicture


    put "Player Two Cards"
    put PlayerTwoCardOneCardNumber, " of ", PlayerTwoCardOnePicture
    put PlayerTwoCardTwoCardNumber, " of ", PlayerTwoCardTwoPicture
    put PlayerTwoCardThreeCardNumber, " of ", PlayerTwoCardThreePicture
    put PlayerTwoCardFourCardNumber, " of ", PlayerTwoCardFourPicture
    put PlayerTwoCardFiveCardNumber, " of ", PlayerTwoCardFivePicture
    put PlayerTwoCardSixCardNumber, " of ", PlayerTwoCardSixPicture

    %Gameplay
    
    %Drawing a Card
    
    procedure draw
        var DrawCardNumber : int := 0
        var DrawCardPicture : string

        for DeckRestore : 1 .. 20
            DeckCheck (DeckRestore) := true
        end for

        CardPic := 0
        loop
            RandomCard := Rand.Int (1, 20)
            exit when DeckCheck (RandomCard) = true
        end loop
        DeckCheck (RandomCard) := false
        loop
            if RandomCard > 5 then
                RandomCard := RandomCard - 5
                CardPic := CardPic + 1
            end if
            exit when RandomCard < 6
        end loop
        if CardPic = 0 then
            CardPicture := "Diamond"
        elsif CardPic = 1 then
            CardPicture := "Clubs"
        elsif CardPic = 2 then
            CardPicture := "Heart"
        elsif CardPic = 3 then
            CardPicture := "Spade"
        end if

        DrawCardNumber := RandomCard
        DrawCardPicture := CardPicture

        put "You have drawn the ", DrawCardNumber, " of ", DrawCardPicture

    end draw

    %play again
    Draw.Text ("Play again?", 260, 560, Font.New ("ComicSans:30:bold"), brightred)
    drawbox (100, 140, 274, 200, black)
    Draw.Text ("Yes", 140, 160, Font.New ("ComicSans:30:bold"), brightred)
    drawbox (400, 140, 554, 200, black)
    Draw.Text ("No", 450, 160, Font.New ("ComicSans:30:bold"), brightred)
    loop
        if Mouse.ButtonMoved ("down") then
            Mouse.ButtonWait ("down", ReplayRow, ReplayColumn, ReplayCounter, ReplayCounter2)
            if ReplayRow >= 100 and ReplayRow = 140 and ReplayColumn = 400 and ReplayRow = 140 and ReplayColumn  player card
opponent points+= opponent card + player card

vice versa for player

if opponent card= player card
if opponent suite> player suite... yeah you should get it now :P

-----------------------------------
Otaku1211
Sat Jan 21, 2012 3:57 pm

RE:Help me on my card game plox &lt;3
-----------------------------------
:c i didnt know i could repost on that one :/ lol im still very new to this so sorryy!! D:

and thank you soo much!! it really helped me :D but now it says there's a problem with my procedure :/ like it says "may only be declared at a program, module or monitor level

-----------------------------------
Alex C.
Sat Jan 21, 2012 4:24 pm

RE:Help me on my card game plox &lt;3
-----------------------------------
um don't put the procedure in aloop, it will glitch out...

a programs format should be soemthing like this:

1) All your varaibles
2) Processes and stuff
3) your main program

-----------------------------------
Otaku1211
Sat Jan 21, 2012 4:35 pm

RE:Help me on my card game plox &lt;3
-----------------------------------
okay thanks man, really helping out :) uh last question (hopefully) 

so if i want to make player one hand do i use array?

so like 

var hand1: array 1..6 of ... (and so)
if i do use array, how do i put 

(these are the player on cards)
put "Player One Cards"
    put PlayerOneCardOneCardNumber, " of ", PlayerOneCardOnePicture
    put PlayerOneCardTwoCardNumber, " of ", PlayerOneCardTwoPicture
    put PlayerOneCardThreeCardNumber, " of ", PlayerOneCardThreePicture
    put PlayerOneCardFourCardNumber, " of ", PlayerOneCardFourPicture
    put PlayerOneCardFiveCardNumber, " of ", PlayerOneCardFivePicture
    put PlayerOneCardSixCardNumber, " of ", PlayerOneCardSixPicture 
 
into it? 

or if i don't use arrays, what do i use? :c

-----------------------------------
Alex C.
Sat Jan 21, 2012 5:36 pm

RE:Help me on my card game plox &lt;3
-----------------------------------
well 20 cards in total means that 10 cards per player right?

well there would be an array of 20 for the deck (which you would declare card names and suites and such) and 10 per player.

randint could decide the value for the players hands suppsedly (player1card:= jackhearts)

hopefully this helps

-----------------------------------
Otaku1211
Sat Jan 21, 2012 8:48 pm

RE:Help me on my card game plox &lt;3
-----------------------------------
yeah i've got how to do it now thanks alex! :D last question then i think i should be set

so for the array when i do this: 
var cards : flexible array 1 .. 20 of string := init ("ace of hearts", "ace of spades", "ace of diamonds",
    "ace of clubs", "king of hearts", "king of spades", "king of diamonds", "king of clubs",
    "queen of hearts", "queen of spades", "queen of diamonds", "queen of clubs",
    "jack of hearts", "jack of spades", "jack of diamonds", "jack of clubs",
    "ten of hearts", "ten of spades", "ten of diamonds", "ten of clubs",)

i get the array of cards and i then this: 
randint (random, 1, 20)

to get a random number and i've coded it so it responds do the array, but after i get the number and which card it is, is there a way to take it out of the array?

-----------------------------------
Alex C.
Sat Jan 21, 2012 10:09 pm

Re: Help me on my card game plox &lt;3
-----------------------------------
...you could reset it to no value ( := 0 or another value ) and put something in your code that completely ignores that card if it has that card in a players hand i guesss... : :think:  :pray:

-----------------------------------
Otaku1211
Sun Jan 22, 2012 5:55 pm

Re: Help me on my card game plox &lt;3
-----------------------------------
Ok so i did a little work but i'm kind of stuck again now

when i play a card and then draw another card I need the draw card to replace the card used :/ please help me!! it's due tomorrow ):

I attached my new code, please help me!

-----------------------------------
Alex C.
Sun Jan 22, 2012 6:45 pm

RE:Help me on my card game plox &lt;3
-----------------------------------
nice so far :D,

first off, whats the locate (40,35) for? it sorta screws it up cause of the window size

also oddly, when player 1 won  around against 2p, he won no points (p1=13 and p2 card= 1)

finally, idiot proof the program (if card= 7 put you don't have that card)

-----------------------------------
Otaku1211
Sun Jan 22, 2012 7:11 pm

RE:Help me on my card game plox &lt;3
-----------------------------------
well the (40,35) is where I put my name like by:_____ ______ and yeah i'm not done the point system yet 

I still need to find a way to replace the card the player uses with the card the player draws :/

and good idea for the idiot proof part :D thanks!

-----------------------------------
Alex C.
Sun Jan 22, 2012 7:48 pm

RE:Help me on my card game plox &lt;3
-----------------------------------
... try a rand.int within a loop to check random cards until it chooses one that hasn't been played yet

-----------------------------------
Otaku1211
Sun Jan 22, 2012 8:01 pm

RE:Help me on my card game plox &lt;3
-----------------------------------
no i mean like i draw a card then when both players are done their turn, i cls then retype the new hand for both players with the card played last turn replaced with the new card which they drew but i can't get that into code :/

-----------------------------------
Alex C.
Sun Jan 22, 2012 8:17 pm

Re: Help me on my card game plox &lt;3
-----------------------------------
:eh: for blablabl
if cardused (blah)= true
card (blah):= new card
end for

...try something like that :think:

-----------------------------------
Otaku1211
Sun Jan 22, 2012 10:11 pm

RE:Help me on my card game plox &lt;3
-----------------------------------
Woot I got it to work, but used a different way, but yours helped me think of the new way :D SO THANK YOU VERY MUCH ALEX! :D I'm almost done now! 

just got to fix up a few bugs and add a few more parts then i can go sleep! :D thank you so much for your assistance alex! really helped me out on this project!

-----------------------------------
Alex C.
Sun Jan 22, 2012 11:09 pm

RE:Help me on my card game plox &lt;3
-----------------------------------
no prob, just want to play it when it's done lol :lol:
