haive.games.go.go_engine¶

Simple Go engine wrapper using sgfmill instead of sente.

This module provides a compatibility layer to replace sente with sgfmill, which is compatible with Python 3.12.

Classes¶

GoGame

Simple Go game wrapper using sgfmill.

sgf

SGF compatibility wrapper.

Functions¶

Game([board_size])

Create a new Go game.

dumps_sgf(game)

Convert game to SGF string.

loads_sgf(sgf_string)

Load a game from SGF string.

Module Contents¶

class haive.games.go.go_engine.GoGame(board_size=19)[source]¶

Simple Go game wrapper using sgfmill.

Init .

Parameters:

board_size (int) – [TODO: Add description]

play_move(color, move)[source]¶

Play a move on the board.

Parameters:
  • color (str) – ‘b’ for black, ‘w’ for white

  • move (tuple[int, int] | None) – (row, col) tuple or None for pass

to_sgf()[source]¶

Convert game to SGF format.

Return type:

str

turn()[source]¶

Get current player to move.

Return type:

str

class haive.games.go.go_engine.sgf[source]¶

SGF compatibility wrapper.

static dumps(game)[source]¶

Save game to SGF.

static loads(sgf_string)[source]¶

Load game from SGF.

Parameters:

sgf_string (str)

haive.games.go.go_engine.Game(board_size=19)[source]¶

Create a new Go game.

Parameters:

board_size (int)

Return type:

GoGame

haive.games.go.go_engine.dumps_sgf(game)[source]¶

Convert game to SGF string.

Parameters:

game (GoGame)

Return type:

str

haive.games.go.go_engine.loads_sgf(sgf_string)[source]¶

Load a game from SGF string.

Parameters:

sgf_string (str)

Return type:

GoGame