Skip to content

Commit

Permalink
Merge pull request #228 from ujh/better-documentation
Browse files Browse the repository at this point in the history
Better documentation
  • Loading branch information
ujh committed Dec 1, 2015
2 parents c0611e3 + 66fd83c commit 00392bb
Show file tree
Hide file tree
Showing 15 changed files with 427 additions and 50 deletions.
71 changes: 30 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,47 @@
Iomrascálaí
===========

Iomrascálaí
(Gaelic for wrestler, [see here for the pronunciation](https://raw.githubusercontent.com/ujh/iomrascalai/master/pronunciation.mp4))
is an AI for the game of Go/Weiqi/Baduk written in Rust. Please note
that we're using the Rust nightly build and not stable!
Iomrascálaí (Gaelic for wrestler, [see here for the pronunciation](https://raw.githubusercontent.com/ujh/iomrascalai/master/pronunciation.mp4)) is an AI for the game of Go/Weiqi/Baduk written in [Rust](https://www.rust-lang.org).

Development
===========
Installation
------------

See the [issues](https://github.com/ujh/iomrascalai/issues) for
planned features and bugs and
[join the mailing list](https://groups.google.com/forum/#!forum/iomrascalai)
and [the chat](https://gitter.im/ujh/iomrascalai) for discussion.
If you just want to play a game against the engine you can download precompiled executables of the [releases](https://github.com/ujh/iomrascalai/releases) for Mac, Linux, and Windows. You will also need a graphical interface for playing games against the AI. We suggest downloading [GoGui](http://sourceforge.net/projects/gogui/).

Testing
=======
Compilation
------------

Iomrascálaí requires the latest unstable (also called nightly) Rust compiler as well as the latest Cargo. Both are generally installed when you download the installers from the [Rust homepage](https://www.rust-lang.org).

To play 10 games against GnuGo, install GoGui and run the
following command in the top level folder:
Playing games
-------------

``` sh
BLACK="gnugo --mode gtp --chinese-rules --positional-superko --capture-all-dead --score aftermath --play-out-aftermath"
WHITE="./target/release/iomrascalai"
gogui-twogtp -auto -black "$BLACK" -white "$WHITE" -size 9 -alternate -time 5m -games 100 -sgffile gnugo-test
```
Once you've installed the nightly Rust compiler, Cargo, and [GoGui](http://gogui.sourceforge.net/) you can use the following shell scripts to compile the program and play games. All these scripts play a game on a 9x9 board with a time limit of 5 minutes by default. You can also play games on 13x13 and 19x19 by passing 13 or 19 as an argument to the scripts.

To run a game against GnuGo and view it in GoGui in real time use the following command (add `-auto` if a new game should automatically be started when a game is finished):
* `bin/play` will compile the program and start a game in [GoGui](http://gogui.sourceforge.net/). By default it will assign black to Iomrascálaí. The defaults can be changed easily by editing some constants in the script.
* `bin/play-gnugo` will compile the program and start a game against GnuGo. It will assign black to [GnuGo](https://www.gnu.org/software/gnugo/) and the game can be observed in [GoGui](http://gogui.sourceforge.net/). Again, the defaults can be changed by editing the script.
* `bin/play-self` will compile the program and start a game between two copies of Iomrascálaí. Just like with the other scripts the game can be observed in [GoGui](http://gogui.sourceforge.net/) and the parameters can be adjusted by editing the script.

``` sh
BLACK="gnugo --mode gtp --chinese-rules --positional-superko --capture-all-dead --score aftermath --play-out-aftermath"
WHITE="./target/release/iomrascalai"
TWOGTP="gogui-twogtp -black \"$BLACK\" -white \"$WHITE\" -verbose -size 9"
gogui -computer-both -program "$TWOGTP" -size 9
```
Program parameters
------------------

Resources
=========
Many parameters of Iomrascálaí can be changed and those changes directly affect the program strength.

The following Go programs are available as source code and can serve
as inspiration:
You set the parameters by supplying a [TOML](https://github.com/toml-lang/toml) formatted configuration file when starting the program with either the `-c` or `--config` command line flag. A great way to get started is to capture the output of `-d` (or `--dump`) into a file and edit the variables. This is the default configuration and lists all possible variables with their default values. See the [api documentation](http://bettong.net/iomrascalai/) for details on what these variables do. Just use the search on top and enter the name of the configuration variable. It should take you to the page that lists the struct that defines it (e.g. [PriorsConfig](http://bettong.net/iomrascalai/api/iomrascalai/struct.PriorsConfig.html) for a variable in the `[priors]` block in the config file).

Development
===========

See the [issues](https://github.com/ujh/iomrascalai/issues) for
planned features and bugs and
[join the mailing list](https://groups.google.com/forum/#!forum/iomrascalai)
and [the chat](https://gitter.im/ujh/iomrascalai) for discussion. The internal documentation is available [here](http://bettong.net/iomrascalai). It can also be built locally using `cargo doc`.

* [HouseBot](https://github.com/ujh/HouseBot)
* [Pachi](http://pachi.or.cz/)
* [Orego](https://github.com/Orego/Orego)
* [libego](https://github.com/lukaszlew/libego)
* [Fuego](http://sourceforge.net/projects/fuego/)
* [oakfoam](http://oakfoam.com/)
* [GnuGo](https://www.gnu.org/software/gnugo/)
* [Brown](http://www.lysator.liu.se/~gunnar/gtp/brown-1.0.tar.gz)
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

License
=======

Iomrascálaí is licensed under GPL v3. See the
[LICENSE file](https://github.com/ujh/iomrascalai/blob/master/LICENSE)
for the complete license text.
Iomrascálaí is licensed under GPLv3. See the
[LICENSE](https://github.com/ujh/iomrascalai/blob/master/LICENSE)
file for the complete license text. The scripts in `bin/` and `misc/clop` are licensed under the MIT license.
25 changes: 23 additions & 2 deletions bin/benchmark
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
#!/bin/bash
#
# Copyright (c) 2015 Urban Hafner
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

set -e

THREADS=8
GAMES=300
GAMES=500

if [ $1 == "9" ]; then
TIME="5m"
Expand Down
51 changes: 51 additions & 0 deletions bin/play
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
#
# Copyright (c) 2015 Urban Hafner
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

set -e

if [ -z "$1" ]; then
SIZE="9"
else
SIZE=$1
fi

if [ $SIZE == "9" ]; then
TIME="5m"
elif [ $SIZE == "13" ]; then
TIME="10m"
elif [ $SIZE == "19" ]; then
TIME="20m"
else
echo "Size '$SIZE' isn't supported!"
exit 1
fi


cargo build --release

IOMRASCALAI="cargo run --release -q"

set -x

gogui -computer-black -program "$IOMRASCALAI" -size $SIZE
48 changes: 45 additions & 3 deletions bin/play-gnugo
Original file line number Diff line number Diff line change
@@ -1,13 +1,55 @@
#!/bin/bash
#
# Copyright (c) 2015 Urban Hafner
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

set -ex
set -e

if [ -z "$1" ]; then
SIZE="9"
else
SIZE=$1
fi

if [ $SIZE == "9" ]; then
TIME="5m"
elif [ $SIZE == "13" ]; then
TIME="10m"
elif [ $SIZE == "19" ]; then
TIME="20m"
else
echo "Size '$SIZE' isn't supported!"
exit 1
fi

cargo build --release

GNUGO="gnugo --mode gtp --level 0 --chinese-rules --positional-superko --capture-all-dead --score aftermath --play-out-aftermath"
IOMRASCALAI="cargo run --release"
SIZE=9
TIME="5m"


TWOGTP="gogui-twogtp -black \"$GNUGO\" -white \"$IOMRASCALAI\" -verbose -size $SIZE -time $TIME"


set -x

gogui -computer-both -program "$TWOGTP" -size $SIZE
46 changes: 43 additions & 3 deletions bin/play-self
Original file line number Diff line number Diff line change
@@ -1,12 +1,52 @@
#!/bin/bash
#
# Copyright (c) 2015 Urban Hafner
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

set -ex
set -e

if [ -z "$1" ]; then
SIZE="9"
else
SIZE=$1
fi

if [ $SIZE == "9" ]; then
TIME="5m"
elif [ $SIZE == "13" ]; then
TIME="10m"
elif [ $SIZE == "19" ]; then
TIME="20m"
else
echo "Size '$SIZE' isn't supported!"
exit 1
fi

cargo build --release

IOMRASCALAI="cargo run --release"
SIZE=9
TIME="5m"

TWOGTP="gogui-twogtp -black \"$IOMRASCALAI\" -white \"$IOMRASCALAI\" -verbose -size $SIZE -time $TIME"

set -x

gogui -computer-both -program "$TWOGTP" -size $SIZE
23 changes: 23 additions & 0 deletions bin/wins-from-benchmark-results.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Urban Hafner
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

def data(contents)
contents.each_line.find_all {|l| l !~ /^#/ }.map do |l|
l.split(/\s+/)[3]
Expand Down
50 changes: 50 additions & 0 deletions code_of_conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of
fostering an open and welcoming community, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating
documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free
experience for everyone, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

By adopting this Code of Conduct, project maintainers commit themselves to
fairly and consistently applying these principles to every aspect of managing
this project. Project maintainers who do not follow or enforce the Code of
Conduct may be permanently removed from the project team.

This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting a project maintainer at contact@urbanhafner.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. Maintainers are
obligated to maintain confidentiality with regard to the reporter of an
incident.


This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.3.0, available at
[http://contributor-covenant.org/version/1/3/0/][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/3/0/
23 changes: 23 additions & 0 deletions misc/clop/lib/analyze.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
#
# Copyright (c) 2015 Urban Hafner
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

def analyze(outfile:, playing_white:)
File.open("#{outfile}.dat", "r") do |f|
f.each_line do |line|
Expand Down

0 comments on commit 00392bb

Please sign in to comment.