#player #game #playing #general #prover #move #ggp

ggp-rs

A library for creating General Game Playing (GGP) players

6 releases

Uses old Rust 2015

0.1.2 May 9, 2015
0.1.1 May 7, 2015
0.0.3 Apr 14, 2015

#682 in Games

MIT license

105KB
2.5K SLoC

ggp-rs Build Status

ggp-rs is a library for creating GGP (general game playing) players in Rust that is based off of GGP Base. While GGP Base allows the creation of players backed by a propositional network or a logic prover, this library currently only supports logic prover based players. The performance of this logic prover is comparable to the one in GGP Base.

Please file an issue to report a bug or request a feature. Pull requests are welcome.

Installation

You can install this library from crates.io by adding the following to your Cargo.toml:

ggp-rs = "*"

Example

Here is an example of a player that plays random legal moves (this example can be found in the examples folder):

extern crate rand;
extern crate ggp_rs;

use ggp_rs::{Player, Game, Move};
use std::net::Ipv4Addr;

struct RandomPlayer;

impl Player for RandomPlayer {
    fn name(&self) -> String {
        "RandomPlayer".to_string()
    }

    fn select_move(&mut self, game: &Game) -> Move {
        let state = game.current_state();
        let role = game.role();
        let mut moves = game.legal_moves(state, role);
        let r = rand::random::<usize>() % moves.len();
        moves.swap_remove(r)
    }
}

fn main() {
    ggp_rs::run((Ipv4Addr::new(0,0,0,0), 9147), RandomPlayer);
}

To test the player you can use the Server application in GGP Base or make an account on Tiltyard and add your player. Note that you should run your player with cargo run --release or your player may not be fast enough for most games.

More examples and players can be found in src/player.

Note that ggp-rs outputs logging information that you might find useful. It is recommend to set the log level to at least warnings and higher, and this can be increased to info (or debug, but debug is not recommended) for more information. To set the log levels to warning, initialize an env_logger and run cargo with the RUST_LOG variable, i.e. RUST_LOG=ggp_rs=warn cargo run --release.

Documentation

You can find the API documentation here.

License

MIT

Dependencies

~7–9MB
~155K SLoC