Amazon Telephonic Question-1st Round
Anonymous User
431
    // 8x8 grid. The playing pieces are stones of opposing colors,
    // each player using only one color for their stones.
     
    // The only legal move for a player is to place a stone of
    // their own color in an empty square, such that there exists 
    // at least one straight (horizontal, vertical, or diagonal)
    // line of stones between the new piece and another piece of
    // the same color, with one or more stones of the opposite
    // color between them, and no empty spaces.
     
    // Examples of legal and illegal moves:
     
    // Given              Legal              Illegal
     
     
    // . . . . . . . .    . . . . . . . .    . . . . . . . .
    // . . . O X . . .    . . X O X . . .    . . . O X X . .
    // . . . . . . . .    . . . . . . . .    . . . . . . . .
     
     
    // . . . . X . . .    . . . . X . . .    . . . . X . . .
    // . . . O . . . .    . . . O . . . .    . . . O . . . .
    // . . . . . . . .    . . X . . . . .    . . . . X . . .
     
     
    // . . . . . . . .    . . . . . . . .    . . . . . . . .
    // . O . O O X . .    . O X O O X . .    X O . O O X . .
    // . . . . . . . .    . . . . . . . .    . . . . . . . .
     
     
    // . . . O X . . .    . . X O X . . .    . . . O X . . .
    // . . . O . . . .    . . . O . . . .    . . . O X . . .
    // . . . . X . . .    . . . . X . . .    . . . . X . . .
     
     
    // Design an *interface* (no implementation needed) for a
    // data structure to represent the board. Implement a method
    // that takes a location of the board and a player color as
    // input, and returns true if the move is a legal move, and
    // false otherwise
Comments (1)