Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining Stable discs in Othello

I'm trying to determine which discs of an Othello board are stable ones (those that can't be flipped for the rest of the game).

I've read that the disc needs to be stable in all four directions (horizontally, vertically and both diagonals). For it to be stable in any direction, either the direction is full of discs so that no more can be placed in that direction, it is on the edge of the board, or it is adjacent to a stable disc of the same color.

I understand the first two parts, but is there a specific order in which I need to evaluate the stability of discs, because there could be a chain reaction that induces stability.

like image 594
Matthew Fennell Avatar asked Jan 04 '17 02:01

Matthew Fennell


People also ask

Is it better to go first or second in Othello?

Playing the GameBlack always goes first in Othello, and the less experienced player should take this color. If the players are equal in skill level, then you may flip a coin to see who gets to be black, or allow the player who lost the last game to be black.

What is a valid move in Othello?

Valid MovesA move is made by placing a disc of the player's color on the board in a position that "out-flanks" one or more of the opponent's discs. A disc or row of discs is outflanked when it is surrounded at the ends by discs of the opposite color.

Can you place pieces anywhere in Othello?

They must place a piece with the black side up on the board in such a position that there exists at least one straight (horizontal, vertical, or diagonal) occupied line between the new piece and another black piece. One or more contiguous white pieces have to be between them.


1 Answers

The simple approach is to iterate until nothing changes. Start with all the discs marked as unstable. Then make a pass through the discs to see if any of them meet the criteria for stability. Change the disc state from unstable to stable for every disc that meets the criteria.

If none of the discs change state during a pass, then you're done. If all of the discs are marked as stable at the end of a pass, then you're done. Worst case case is 64 passes, since at least one disc has to change states on each pass.

like image 143
user3386109 Avatar answered Sep 19 '22 17:09

user3386109