YINSH

A wasm-based version of the abstract board-game Yinsh, written in Rust using the macroquad library. The open source code is available on github.

How to play

Taken from Wikipedia

The goal of the game is to remove three of one's own rings from the game. Since this is the goal of the game, getting closer to winning necessitates weakening oneself, which considerably complicates strategy as a move which brings one closer to winning the game may end up being a very poor move.

The game starts with an empty board, and proceeds in two phases, placement followed by movement.

Placement

During the first phase the players, take turns placing one of their rings on the board on any unoccupied space, beginning with white. Once both players each have placed all five of their rings, this phase is over.

Movement

The second phase involves forming lines, defined as five adjacent markers in a straight line with a single color. Once a line is formed in one player's color (on either player's turn), that player removes the five markers, and also one of their rings. Once a player has removed three of their rings, they win the game.

A turn consists of the following:

  1. The player chooses one of their own rings to move.
  2. The player places a marker, with their own color face-up, in the middle of that ring on the space it occupies.
  3. The player then moves the ring to another unoccupied space, along a straight line from the originating node. The marker never moves. In general, there are six directions from any node, with exceptions along the perimeter of the game board.

When moving a ring, the following rules apply:

It is possible, and not uncommon, to make a move which results in the opposing player having a line of five markers in a row. When more than one line is made in the same turn, the player who just moved resolves their own lines (if any) first, and then the other player resolves their lines (if any) before making his next move. Lines are resolved one at a time, so if a single marker is shared by two lines, only one of those lines may be resolved (but the player chooses which).