Posted: Sat Jan 21, 2012 3:30 pm Post subject: Help me on my card game plox <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)
Turing:
var WelcomeTo :array1.. 10ofstring:=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
delay(100) %play and instructions buttons for text :1.. 25 Draw.Text("66 (Schnapsen)",maxxdiv2 - 175, maxydiv2 - 100, Font.New("ComicSans:40:bold"), Rand.Int (1, maxcolour)) delay(200) endfor Draw.Text("66 (Schnapsen",maxxdiv2 - 175, maxydiv2 - 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 ifMouse.ButtonMoved("down")then Mouse.ButtonWait("down", PlayRow, PlayColumn, PlayCounter, PlayCounter2) if PlayRow >= 350and PlayRow <= 654and PlayColumn >= 140and PlayColumn <= 200then cls put"1. If you have not so, please drag the media file out to the dexktop and re-run" put"this program" put"" put"2. Press 'Play' to start the game" put"" put"3. Cards will be dealt to both players" put"" put"4. You must get 66 points before the computer to win points" put"" put"5. Scores are not recorded" put"" put"6. This is a point-trick game" put"" put"7. If the winner's opponent has taken 33+ points, winner gets 1 point; " put" If winner's opponent has taken 1-32 points, winner gets 2 points; " put" If the winner's opponents has taken 0 points, winner gets 3 points " put"" put"8. Once you have 7 points, you win" drawbox(350, 140, 564, 200, black) Draw.Text("Back",390, 160, Font.New("ComicSans:30:bold"),brightred) loop ifMouse.ButtonMoved("down")then Mouse.ButtonWait("down", PlayRow, PlayColumn, PlayCounter, PlayCounter2) if PlayRow >= 350and PlayRow <= 564and PlayColumn >= 140and PlayColumn <= 200then
exitinstructions :=1 exit endif endif endloop elsif PlayRow >= 100and PlayRow <= 274and PlayColumn >= 140and PlayColumn <= 200then
playbutton :=1 exit endif endif if exitinstructions =1then exit endif endloop cls if playbutton =1then exit endif endloop
%DEALING CARDS(FINAL)
var DeckCheck :array1.. 20ofboolean var RandomCard :int:=0 var CardPic :int:=0 var CardPicture :string %Player One Card Number var PlayerOneCardOneCardNumber :int:=0 var PlayerOneCardTwoCardNumber :int:=0 var PlayerOneCardThreeCardNumber :int:=0 var PlayerOneCardFourCardNumber :int:=0 var PlayerOneCardFiveCardNumber :int:=0 var PlayerOneCardSixCardNumber :int:=0 %Player One Card Picture var PlayerOneCardOnePicture :string var PlayerOneCardTwoPicture :string var PlayerOneCardThreePicture :string var PlayerOneCardFourPicture :string var PlayerOneCardFivePicture :string var PlayerOneCardSixPicture :string %Player One Card Number var PlayerTwoCardOneCardNumber :int:=0 var PlayerTwoCardTwoCardNumber :int:=0 var PlayerTwoCardThreeCardNumber :int:=0 var PlayerTwoCardFourCardNumber :int:=0 var PlayerTwoCardFiveCardNumber :int:=0 var PlayerTwoCardSixCardNumber :int:=0 %Player One Card Picture var PlayerTwoCardOnePicture :string var PlayerTwoCardTwoPicture :string var PlayerTwoCardThreePicture :string var PlayerTwoCardFourPicture :string var PlayerTwoCardFivePicture :string var PlayerTwoCardSixPicture :string %------------------------------------ %Deck Restore for DeckRestore :1.. 20
DeckCheck (DeckRestore):=true endfor %Dealing Cards for count :1.. 12 loop
CardPic :=0
RandomCard := Rand.Int (1, 20) exitwhen DeckCheck (RandomCard)=true endloop
DeckCheck (RandomCard):=false loop if RandomCard > 5then
RandomCard := RandomCard - 5
CardPic := CardPic + 1 endif exitwhen RandomCard < 6 endloop if CardPic =0then
CardPicture :="Diamond" elsif CardPic =1then
CardPicture :="Clubs" elsif CardPic =2then
CardPicture :="Heart" elsif CardPic =3then
CardPicture :="Spade" endif if count =1then %Player One Card One
PlayerOneCardOneCardNumber := RandomCard
PlayerOneCardOnePicture := CardPicture
elsif count =2then %Player One Card Two
PlayerOneCardTwoCardNumber := RandomCard
PlayerOneCardTwoPicture := CardPicture
elsif count =3then %Player One Card Three
PlayerOneCardThreeCardNumber := RandomCard
PlayerOneCardThreePicture := CardPicture
elsif count =4then %Player One Card Four
PlayerOneCardFourCardNumber := RandomCard
PlayerOneCardFourPicture := CardPicture
elsif count =5then %Player One Card Five
PlayerOneCardFiveCardNumber := RandomCard
PlayerOneCardFivePicture := CardPicture
elsif count =6then %Player One Card Six
PlayerOneCardSixCardNumber := RandomCard
PlayerOneCardSixPicture := CardPicture
%----------------------------------------------------------------------- elsif count =7then %Player Two Card One
PlayerTwoCardOneCardNumber := RandomCard
PlayerTwoCardOnePicture := CardPicture
elsif count =8then %Player Two Card Two
PlayerTwoCardTwoCardNumber := RandomCard
PlayerTwoCardTwoPicture := CardPicture
elsif count =9then %Player Two Card Three
PlayerTwoCardThreeCardNumber := RandomCard
PlayerTwoCardThreePicture := CardPicture
elsif count =10then %Player Two Card Four
PlayerTwoCardFourCardNumber := RandomCard
PlayerTwoCardFourPicture := CardPicture
elsif count =11then %Player Two Card Five
PlayerTwoCardFiveCardNumber := RandomCard
PlayerTwoCardFivePicture := CardPicture
elsif count =12then %Player Two Card Six
PlayerTwoCardSixCardNumber := RandomCard
PlayerTwoCardSixPicture := CardPicture
endif endfor 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 endfor
Please specify what version of Turing you are using
4.1.1a
Sponsor Sponsor
Alex C.
Posted: Sat Jan 21, 2012 3:37 pm Post subject: RE:Help me on my card game plox <3
oh hi, it's a double post
um why didn't you post on your old one, it would pop in the same place...
anyways, try randint for the opponents cards (randint: 1 ..total cards in hand) and once you get the players card...
if opponent card > 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
Otaku1211
Posted: Sat Jan 21, 2012 3:57 pm Post subject: RE:Help me on my card game plox <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 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.
Posted: Sat Jan 21, 2012 4:24 pm Post subject: RE:Help me on my card game plox <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
Posted: Sat Jan 21, 2012 4:35 pm Post subject: RE:Help me on my card game plox <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.
Posted: Sat Jan 21, 2012 5:36 pm Post subject: RE:Help me on my card game plox <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
Posted: Sat Jan 21, 2012 8:48 pm Post subject: RE:Help me on my card game plox <3
yeah i've got how to do it now thanks alex! 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.
Posted: Sat Jan 21, 2012 10:09 pm Post subject: Re: Help me on my card game plox <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... :
Sponsor Sponsor
Otaku1211
Posted: Sun Jan 22, 2012 5:55 pm Post subject: Re: Help me on my card game plox <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 ):
Posted: Sun Jan 22, 2012 6:45 pm Post subject: RE:Help me on my card game plox <3
nice so far ,
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
Posted: Sun Jan 22, 2012 7:11 pm Post subject: RE:Help me on my card game plox <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 thanks!
Alex C.
Posted: Sun Jan 22, 2012 7:48 pm Post subject: RE:Help me on my card game plox <3
... try a rand.int within a loop to check random cards until it chooses one that hasn't been played yet
Otaku1211
Posted: Sun Jan 22, 2012 8:01 pm Post subject: RE:Help me on my card game plox <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.
Posted: Sun Jan 22, 2012 8:17 pm Post subject: Re: Help me on my card game plox <3
for blablabl
if cardused (blah)= true
card (blah):= new card
end for
...try something like that
Otaku1211
Posted: Sun Jan 22, 2012 10:11 pm Post subject: RE:Help me on my card game plox <3
Woot I got it to work, but used a different way, but yours helped me think of the new way SO THANK YOU VERY MUCH ALEX! I'm almost done now!
just got to fix up a few bugs and add a few more parts then i can go sleep! thank you so much for your assistance alex! really helped me out on this project!