Skip to content

This code is mainly copied from react official website and provide three games

Notifications You must be signed in to change notification settings

yoyodream2017/Go-Game

Repository files navigation

Go-Game

This code is mainly copied from react official website with some refactors. The React website provides a simple tic tac toe and we released the code in release one. Then we did some refactors and provided a gobang and a go game by extending the existing components.

Basic Operations

  • npm (run) start: open the app locally under eslint
  • npm (run) test: run test on src and see the test coverage
  • npm run stylefmt: do the style format
  • npm run stylelint: do the style lint

Go game training

Sequence

Black stone is placed first and then white, and each move one stone is placed. Our game uses "X" to represent black stone and "O" to white.

Capture

If a stone or group of stone is surrounded by the opponent or the side of the board on all orthogonally-adjacent points, in other words, losing last liberty, these stones should be removed from board.

Capture example one

Capture example
Capture example

Capture example two

Capture example
Capture example

Liberty and eye

The open points that stone bordering are called 'liberty'. Enclosed liberty is referred to as an 'eye'. Generally, single-point eye cannot be filled by opponent stones. For instance,

Eye example

Eye example
However, when capture occurs, such move is not forbidden.

Eye example: eye can be filled only when capture occurs.

Eye example
Eye example

  1. Real eye

An eye is enclosed by connected stones. A typical feature is that the eye can only be filled when all group of stones are surrounded by opponent stones.

Real eye example

Real eye example

Filling real eye example

Filling real eye example
Filling real eye example

  1. False eye

An eye can be filled when part of the enclosed stones are captured(not all).

False eye example

False eye example
False eye example
The difference between real eye and false eye includes whether enclosed stones are all connected or not and whether all enclosed stones can be captured one time or only part of them.

Alive or dead

If a stone group has at least two real eyes, it can be considered as alive. Otherwise, it can be considered as dead. In other words, alive stones cannot be captured by all means.

Alive example

Alive example

Dead example and capture dead group stones

Dead example
Dead example
Dead example
Dead example

Forbidden KO

One capture case is forbidden when black and white stone are mutually surrounded and repeat a previous position to fill a false eye to capture a single stone.
For example, first "X" can capture one "O", and then "X" can capture one "O". Then "X" can repeat to capture "O" and vice versa. This will lead to no end.

KO example

KO example
KO example
KO example
KO example
KO example
KO example

Seki

One special case is Seki. Seki is that both stones do not have enough eyes for life and cannot capture the opponent in the meanwhile. Look at the following example:

Seki example

Seki example

About

This code is mainly copied from react official website and provide three games

Resources

Stars

Watchers

Forks

Packages

No packages published