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. Note that while this library is functional, it is still in early development. That means that the API may change, there are likely to be bugs, and there may be performance issues. Please file an issue to report a bug or request a feature. Pull requests are welcome.
You can install this library from crates.io by adding the following to your Cargo.toml
:
ggp-rs = "*"
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 getname(&self) -> String { "RandomPlayer".tostring() }
fn select_move(&self, game: &Game) -> Move {
let state = game.get_current_state();
let role = game.get_role();
let mut moves = game.get_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.
You can find the API documentation here.