#go #Baduk #goban #Igo

goban

Library for go move generation and go ruling

26 releases

✓ Uses Rust 2018 edition

new 0.4.2 Mar 19, 2019
0.4.0 Mar 9, 2019
0.3.9 Mar 6, 2019
0.3.5 Feb 28, 2019
0.1.9 Dec 24, 2018

#7 in Games

Download history 54/week @ 2018-12-15 61/week @ 2018-12-22 14/week @ 2018-12-29 35/week @ 2019-01-05 21/week @ 2019-01-12 55/week @ 2019-01-19 13/week @ 2019-01-26 11/week @ 2019-02-02 23/week @ 2019-02-09 52/week @ 2019-02-16 14/week @ 2019-02-23 83/week @ 2019-03-02 93/week @ 2019-03-09

183 downloads per month

LGPL-3.0-only

33KB
787 lines

Goban

Library to play with a rusty goban

Channel : stable

Only contains move generation, and rules there is no IA, neither front-end.

Exemple :

let mut g = Game::new(GobanSizes::Nine, Rule::Chinese);
        let mut i = 35;
        while !g.legals().count() != 0 && i != 0 {
            g.play(
                &g.legals().map(|coord| Move::Play(coord.0, coord.1))
                    .choose(&mut rand::thread_rng())
                    .unwrap());
            i -= 1;
            println!("{}", g.goban().pretty_string());
        }
.........
.........
.........
.........
.........
.........
.................
.........


etc...

What works (or seem to works)

  • Capturing stones
  • Playing
  • Passing
  • Resigning
  • Naive implementation to count points
  • Printing an ugly ascii goban
  • Generate legals moves
  • Japanese Rules
  • Chinese Rules

In actual development

  • Documentation

What is not in point:

  • Complete end game
  • Seki handling

lib.rs:

Example

Get legals moves and plays some random.

    use crate::goban::rules::*;
    use crate::goban::rules::game::*;
    use rand::seq::IteratorRandom;

    let mut g = Game::new(GobanSizes::Nine, Rule::Chinese);
      let mut i = 35;
       while !g.legals().count() != 0 && i != 0 {
           g.play(
               &g.legals().map(|coord| Move::Play(coord.0, coord.1))
                   .choose(&mut rand::thread_rng())
                   .unwrap());
           i -= 1;
           println!("{}", g.goban().pretty_string());
       }

Dependencies

~1.5MB
~28K SLoC