Ejemplo n.º 1
0
 private List<CardMove> movesFromDiscardPileToSuitStack(GameModelView pModel) {
   ArrayList<CardMove> moves = new ArrayList<CardMove>();
   if (!pModel.isEmptyDiscardPile()) {
     for (SuitStackIndex index : SuitStackIndex.values()) {
       if (pModel.isLegalMove(pModel.peekDiscardPile(), index)) {
         moves.add(new CardMove(pModel.peekDiscardPile(), index));
         if (pModel.isEmptySuitStack(index)) {
           break; // we take the first possible blank space
         }
       }
     }
   }
   return moves;
 }
Ejemplo n.º 2
0
 private List<CardMove> movesFromWorkingStacksToSuitStacks(GameModelView pModel) {
   ArrayList<CardMove> moves = new ArrayList<CardMove>();
   for (StackIndex index : StackIndex.values()) {
     CardView[] stack = pModel.getStack(index);
     if (stack.length > 0) {
       Card card = stack[stack.length - 1].getCard();
       for (SuitStackIndex index2 : SuitStackIndex.values()) {
         if (pModel.isLegalMove(card, index2)) {
           moves.add(new CardMove(card, index2));
           if (pModel.isEmptySuitStack(index2)) {
             break; // we take the first possible blank space
           }
         }
       }
     }
   }
   return moves;
 }