Commit e736a263 authored by Colomban Wendling's avatar Colomban Wendling
Browse files

Bot: place pawns

parent 98c6e5b1
......@@ -96,9 +96,18 @@ public class Bot : OVCCClient.Client
});
}));
/* we should place a pawn? let's do so */
sigqueue.add (this, place_pawn.connect ((tile) => {
sigqueue.add (this, place_pawn.connect ((pos) => {
debug ("We're asked to place a pawn!");
var tile = game.board.get_tile (pos);
if (tile == null) {
critical ("We were asked to place a pawn somewhere there is no tile");
return;
}
foreach (var o in tile.objects) {
if (player.place_pawn (OVCC.PawnKind.NORMAL, o, pos)) {
debug ("Placed pawn at %d %d", pos.x, pos.y);
break;
}
/* we guess all pawns can go anywhere another can -- which isn't true
* using some extensions, but it doesn't matter that much. */
/* FIXME: this should probably also be asynchronous... */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment