Write a bot for Reversi on a 6 by 6 board. "B" (black) moves first. The game starts with four
discs in the middle. A move places one of your discs on an empty cell so that, in at least one of
the eight directions, it closes an unbroken line of the opponent's discs with another disc of yours;
every such line is turned over to your colour. If you have no legal move you pass (the judge does
this for you); when neither player can move the game ends, and whoever has more discs wins.
move(board, me) gets the board (a list of 6 strings, the top row first, "." for an empty cell)
and your colour, "B" or "W". It is only called when you have a legal move, and returns it as a
tuple (row, col). An illegal move loses the game.
These helpers are available in your code: start_board(), flips(board, r, c, disc) (the cells
that would turn over, [] for an illegal move), legal_moves(board, disc) (every legal (row, col)
in reading order) and place(board, r, c, disc) (the new board). The tests run
play_reversi(move, games, seed): your bot plays the house bot, which takes a corner whenever it
can, avoids the cells next to an empty corner when it has another choice, and otherwise turns over
as many discs as possible (a random one among equals). The two bots take turns to start.
How this problem is scored
A result passes if your bot takes at least half of the points (a win is one point, a draw half a point). Its quality is the share of points you took, from 50 to 100. The note also shows the total disc margin over the games.
Examples
Input: play_reversi(move, 6, 1)
Output: {"wins": ..., "draws": ..., "losses": ..., "games": 6, "discs": ...}
passes with at least 3 points
Constraints
- A test plays 6 full games (about 16 moves each for your bot) and must finish within about a second in your browser, so keep each move to a few milliseconds: look one or two moves ahead, not to the end of the game.
- The result must not depend on the clock.
Goals
- Write an evaluation function that values stable cells over disc count
- Look ahead at the opponent's best reply before choosing a move
- Keep every move fast enough to play several full games per test