Professional Documents
Culture Documents
Cardgametorsdag 1 Oktobar 2015
Cardgametorsdag 1 Oktobar 2015
This game is easy played with the pace. The aim is to collect 7 cards of a
suit. Dealer distributes seven cards to each player face down. The remaining
cards are placed outside the table. Player decide which suit they have to
collect and can change their choice anytime. Game is played with the giving
a card to player on the left and receiving card from the player to his right.
The first player to have all seven cards of same suit wins the game.
http://www.gamblers007.com/18-amazing-fun-card-games-to-play-withfriends-and-family/
Vad har vi fr klasser/objekt?
Vilka metoder och variabler behvs?
Implementing this card game, I have to following classes, methods and
variable.
Classes/Object:
ShipSailsCardGame
PlayGame
Methods:
dealOutCard
leftPlayer
rightPlayer
checkWinner
Variables:
numberOfCards
numberOfPlayers
sevenCards
playerName
rightPlayerCard
leftPlayerCard
leftPlayerCardTotal
rightPlayerCardTotal
counter
playedCard
leftPlayerCard = rightPlayerCard;
rightPlayerCardTotal decrease by one;
leftPlayerCardTotal increment by one;
playedCard = playedCard +leftPlayerCard;
checkWinner(playedCard);
}
checkWinner(playedCard){
counter;
for 1 to 52{
if playedCard = sameSuit {
counter++;
}
}
if counter = 7{
we have a winner;
}
}