World Conquest Chronicles

World Conquest Chronicles

go-atari-models, v1.6

The library that implements checking and generating of Atari Go moves.

Encoding of positions in ASCII.

Change Log

  • encoding of positions in ASCII:
    • parsing;
    • serialization.

Features

  • representing the board as an associative array of stones with their positions as keys;
  • immutable applicating moves to the board via copying the latter;
  • checkings of moves:
    • taking into account self-capture;
  • generating of moves via filtering from all possible ones:
    • pseudolegal moves;
    • legal moves (with additional checking for captures);
  • encoding of positions in ASCII:
    • parsing;
    • serialization.

Examples

ascii.DecodePoint():

package main

import (
    "fmt"

    "github.com/thewizardplusplus/go-atari-models/encoding/ascii"
)

func main() {
    point, _ := ascii.DecodePoint("e3")
    fmt.Printf("%+v\n", point)

    // Output: {Column:4 Row:2}
}

ascii.EncodePoint():

package main

import (
    "fmt"

    models "github.com/thewizardplusplus/go-atari-models"
    "github.com/thewizardplusplus/go-atari-models/encoding/ascii"
)

func main() {
    point := ascii.EncodePoint(models.Point{Column: 4, Row: 2})
    fmt.Printf("%s\n", point)

    // Output: e3
}

Repository

Link: https://github.com/thewizardplusplus/go-atari-models/tree/v1.6.

Content: code.

License: MIT.