OwlTest
CodeSkulptor
Submit your code for testing

Provide either

Solitaire Mancala grading page

Machine tests for the SolitaireMancala class. This class should support the following methods:

  • __init__(self): Create a SolitaireMancala object whose configuration consists of a board with an empty store and no houses (i.e; the configuration [0]).
  • set_board(self, configuration): Set the board to be a copy of the supplied configuration (to avoiding referencing issues). The configuration will be a list of integers in the form described above.
  • __str__(self): Return a string corresponding to the current configuration of the Mancala board. This string is formatted as a list with the store appearing in the rightmost (last) entry. Consecutive entries should be separated by a comma and blank (as done by Python when converting a list to a string).
  • get_num_seeds(self, house_num): Return the number of seeds in the house with index house_num. Note that house 0 corresponds to the store.
  • is_legal_move(self, house_num): Return True if moving the seeds from house house_num is legal. Otherwise, return False. If house_num is zero, is_legal_move should return False.
  • apply_move(self, house_num): Apply a legal move for house house_num to the board.
  • choose_move(self): Return the index for the legal move whose house is closest to the store. If no legal move is available, return 0.
  • is_game_won(self): Return True if all houses contain no seeds. Return False otherwise.
  • plan_moves(self): Given a Mancala game, return a sequence (list) of legal moves based on the following heuristic: after each move, move the seeds in the house closest to the store when given a choice of legal moves. Note that this method should not update the current configuration of the game.

A series of automatic tests will be run for each method. Also, note Pylint will be used to test that your code conforms to the class coding style guidelines.

Total score: 100 pts

Results

No results yet...

    The CodeSkulptor Unit Tester was built by Stephen Wong.