Right then lets do a bit of recap
We have a card deck and a random card deck now
Now What?
Well lets talk about the game.
We have 4 players. 3 AI players and one person (you).
Its a blackjack (type) game so its first to 21 (or nearest to 21) without going over 21.
Each player starts with 2 cards.
Then each player decides whether they take (twist) another card. Its a risk, this is the important part of the game.
If a player has a 15 points of cards should they twist or should they twist.
In my game I use simple system
if aiplayersscore < 16
{
they get a card
}
Now the above IS NOT gmscript.
What we need first is a way of holding the totalvalue of each players hand
handvalue[1] = 0;
handvalue[2] = 0;
handvalue[3] = 0;
handvalue[4] = 0;
Each Players hand value is set to 0 at beginning, this will change each round, also handvalue is a global variable.
Also each player has a set of cards and we need to store it as well.
Player 1 gets 2 cards
Player 2 gets 2 cards
Player 3 gets 2 cards
Player 4 gets 2 cards
So at the beginning of round 8 cards are given out.
So lets put this in coding speak.
playercards[1] = deck[1];
playercards[2] = deck[2];
Playercards is the players(as in your) cards and we get first 2 cards from the deck (which remember is random card deck).
Then the 3 AI players get 2 cards each
AIplayercard[1,1] = deck[3];
AIplayercard[2,1] = deck[5];
AIplayercard[3,2] = deck[8];
I have missed some code here. What have I missed?
But in English AIplayer [aiplayernumber,cardnumber]
switch AIplayercard[aiplayernumber,cardnumber]
{
case "a" : Score[i,0] += 11;
break;
case "0" :
case "k" :
case "q" :
case "j" : Score[i,0] += 10;
break;
case "1" : Score[i,0] += 1; break;
case "2" : Score[i,0] += 2; break;
case "3" : Score[i,0] += 3; break;
case "4" : Score[i,0] += 4; break;
case "5" : Score[i,0] += 5; break;
case "6" : Score[i,0] += 6; break;
case "7" : Score[i,0] += 7; break;
case "8" : Score[i,0] += 8; break;
case "9" : Score[i,0] += 9; break;
}
No comments:
Post a Comment