before executing westPlayer.playACard(CArd dealCard);, CPU needs to determine which card to deal, hence the algorithm :
public Card whichCardToDeal(int currentSuit);
public Card whichCardToDeal(int currentSuit)
{
if (player can follow suit)
{
retrun card same with the current suit
}
else if (player leads the suit && heartBreak == false)
{
if (player can deal card other than HEART)
{
retrun a card which is NOT a HEART
}
else
{
this player can only deal HEARTS
deal a HEART
heartBreak = ture
}
else if (player leads the trick && heartBreak == true)
{
can deal any card
}
else
{
this player only follow suit
return any card
}
}
Keine Kommentare:
Kommentar veröffentlichen