game15/src/main/java/com/sample/game15/logic/GameBoard.java
public void movePile(final Pile pileToMove) throws GameException {

		Set<Pile> moves = this.eligibleMoves();
		if (moves.contains(pileToMove)) {
			
			int pileIdx = this.pileIndex(pileToMove);
			if (pileIdx == -1) {
				throw new IllegalArgumentException("Unknown pile:" + pileToMove);
			}
			
			int emptyPileIdx = this.pileIndex(Pile.EMPTY_PILE);
			
			doMove(pileIdx, emptyPileIdx);
			
		} else {
			throw new MoveNotAllowedException("Move is not allowed: " + pileToMove);
		}	
	}
// since all Pile's values are unique we can take advantage of this in the implementation below
since all Pile's values are unique we can take advantage of this in the implementation below
since all Pile ' s values are unique we can take advantage of this in the implementation below
public void movePile(final Pile pileToMove) throws GameException {
		Set<Pile> moves = this.eligibleMoves();
		if (moves.contains(pileToMove)) {
			int pileIdx = this.pileIndex(pileToMove);
			if (pileIdx == -1) {
				throw new IllegalArgumentException("Unknown pile:" + pileToMove);
			}
			int emptyPileIdx = this.pileIndex(Pile.EMPTY_PILE);
			doMove(pileIdx, emptyPileIdx);
		} else {
			throw new MoveNotAllowedException("Move is not allowed: " + pileToMove);
		}	
	}
public void movePile ( final Pile pileToMove ) throws GameException { Set < Pile > moves = this . eligibleMoves ( ) ; if ( moves . contains ( pileToMove ) ) { int pileIdx = this . pileIndex ( pileToMove ) ; if ( pileIdx == - 1 ) { throw new IllegalArgumentException ( "Unknown pile:" + pileToMove ) ; } int emptyPileIdx = this . pileIndex ( Pile . EMPTY_PILE ) ; doMove ( pileIdx , emptyPileIdx ) ; } else { throw new MoveNotAllowedException ( "Move is not allowed: " + pileToMove ) ; } }
since all Pile's values are unique we can take advantage of this in the implementation below
since all Pile ' s values are unique we can take advantage of this in the implementation below