Initial commit
[trapthecap.git] / src / html-files / robots / 3 / runme.rb
1 #!/usr/bin/ruby
2 #
3 # == Synopsis
4 #
5 # Play one move of a Trap the Cap 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 require 'libttc'
17 require 'libttc-pplayer'
18 require 'rdoc/usage'
19
20
21 # Get the current game state
22 game_lines = readlines
23 game, moves, next_roll = Game.read_game(game_lines)
24 game.apply_moves! moves
25
26 player = Potential_player.new({:friend_pull => 0.0,
27 :enemy_pull => 0.0,
28 :base_pull => 0.0,
29 :safe_bonus => 10,
30 :capture_bonus => 2})
31
32 best_move = player.best_move(game, next_roll)
33
34 # return that move
35 puts best_move