#!/usr/bin/ruby
#
# == Synopsis
#
# Play one move of a Cartagena game
# 
# == Usage
# clockwise-p1 
#  Game state file read on STDIN
#  Move produced on STDOUT
#
# == Author
# Neil Smith

# 
# To change this template, choose Tools | Templates
# and open the template in the editor.
 

require 'libcartagena'
require 'rdoc/usage'

gamelines = readlines
game, moves = Game.read_game(gamelines)
possibles = game.possible_moves
move = possibles[rand(possibles.length)]
puts move.format(game.board, true)