public static ArrayList<Move> king(Board b, int color) {
		ArrayList<Move> moves = new ArrayList<Move>();
		int piece = (color == Board.white) ? Board.whiteKing : Board.blackKing;
		ArrayList<Position> pieces = findPieces(b, piece);
		int opponentColor = Board.opponentColor(color);

		for (Position p : pieces) {
			// Move up
			Move possibleMove = new Move(p, new Position(p.rank - 1, p.file));
			handlePossibleMove(b, moves, possibleMove, opponentColor);
			// Move up/right
			possibleMove = new Move(p, new Position(p.rank - 1, p.file + 1));
			handlePossibleMove(b, moves, possibleMove, opponentColor);
			// Move right
			possibleMove = new Move(p, new Position(p.rank, p.file + 1));
			handlePossibleMove(b, moves, possibleMove, opponentColor);
			// Move down/right
			possibleMove = new Move(p, new Position(p.rank + 1, p.file + 1));
			handlePossibleMove(b, moves, possibleMove, opponentColor);
			// Move down
			possibleMove = new Move(p, new Position(p.rank + 1, p.file));
			handlePossibleMove(b, moves, possibleMove, opponentColor);
			// Move down/left
			possibleMove = new Move(p, new Position(p.rank + 1, p.file - 1));
			handlePossibleMove(b, moves, possibleMove, opponentColor);
			// Move left
			possibleMove = new Move(p, new Position(p.rank, p.file - 1));
			handlePossibleMove(b, moves, possibleMove, opponentColor);
			// Move up/left
			possibleMove = new Move(p, new Position(p.rank - 1, p.file - 1));
			handlePossibleMove(b, moves, possibleMove, opponentColor);
		}

		return moves;
	}