#!/usr/bin/ruby # # == Synopsis # # Play one move of a Trap the Cap game # # == Usage # clockwise-p1 # Game state file read on STDIN # Move produced on STDOUT # # == Author # Neil Smith require 'libttc' require 'libttc-pplayer' require 'rdoc/usage' # Get the current game state game_lines = readlines game, moves, next_roll = Game.read_game(game_lines) game.apply_moves! moves player = Potential_player.new({:friend_pull => 0.0, :enemy_pull => 0.0, :base_pull => 0.0, :safe_bonus => 10, :capture_bonus => 2}) best_move = player.best_move(game, next_roll) # return that move puts best_move