Allowing daemon export
[cartagena.git] / lib / random-move.rb
1 #!/usr/bin/ruby
2 #
3 # == Synopsis
4 #
5 # Play one move of a Cartagena game
6 #
7 # == Usage
8 # clockwise-p1
9 # Game state file read on STDIN
10 # Move produced on STDOUT
11 #
12 # == Author
13 # Neil Smith
14
15 #
16 # To change this template, choose Tools | Templates
17 # and open the template in the editor.
18
19
20 require 'libcartagena'
21 require 'rdoc/usage'
22
23 gamelines = readlines
24 game, moves = Game.read_game(gamelines)
25 possibles = game.possible_moves
26 move = possibles[rand(possibles.length)]
27 puts move.format(game.board, true)