hearts-judge
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Judge script for our Hearts NPC Project
= Introduction

This is a simple judge script for our Hearts NPC project, written in Ruby. It also comes with sample player programs (Java / Ruby) and an IO specification.

It's not perfect yet, but all the basic stuff should work.


== Requirements

You will need Ruby for this. Get it here:
* Mac OS: it should comes with your OS install
* Linux: apt-get install ruby-full
* Windows: {Ruby one-click installer}[http://rubyinstaller.org/]
* Everything else and extra info, go to {Ruby's official website}[http://www.ruby-lang.org/en/downloads/]

Optionally, you can install {Git}[http://git-scm.com/download/] to help you stay up-to-date.

If you wanna learn some basic Ruby, then go to {Try Ruby}[http://tryruby.org/] and type help. Excellent tutorial there. This is not really necessary unless you wanna help me fix the script, but it's a really cool language to learn! :)


== Install

You can grab the script using either Git or direct download.

=== Using Git (Recommended)

  git clone git://github.com/godfreykfc/hearts-judge.git

=== Direct Download

{From GitHub download page}[http://github.com/godfreykfc/hearts-judge/downloads/]


== Update

=== Using Git

  git update

=== Direct Download

Download the new version from the {download page}[http://github.com/godfreykfc/hearts-judge/downloads/] and replace the stuff on your machine.


== Usage

=== Launch

  cd hearts-judge
  ruby judge.rb

There are several options that you can pass:

  Usage: ruby judge.rb [options] command0 command1 ...
      -s, --shuffle                    Shuffle the players' positions
      -v, --verbose                    Verbose mode
      -r, --replay                     Enable replaying of a set
      -d, --delay N                    Delay N seconds before killing clients
      -p, --points N                   Play until a player scored N points
      -h, --help                       Display this message  

Unless -s is passed as an option, command0 will be player 0, command1 will be player 1, and so on. All unfilled seats are filled with human players. If the command contains spaces, quote it (i.e. ruby judge.rb "some command" "another command").

To use a Java player program, you need to specify the class path (i.e. where to search for your .class file):
  ruby judge.rb "java -classpath ../java-example/ Player"

For Ruby:
  ruby judge.rb "ruby -C../ruby-example/ dummy.rb"

For Python (not sure, correct me if I am wrong):
  ruby judge.rb "python ../python-example/test.py"

If you wish to silent your program's STDERR output, add "2> /dev/null" at the end of your command (Linux/Unix), i.e.
  ruby judge.rb "java -classpath ../java-example/ Player 2> /dev/null"

=== Windows support

IMPORTANT: I have not tested the script on Windows, and it probably won't work. This is because I need to do some IO stream redirections with pipes that is probably not supported by Windows. I'd recommend testing your program on one of those CSIL machines (just SSH into it). I asked the administrators to install Ruby on all the Linux machines earlier this semester, so you should be able to run it just fine.


Copyright (c) 2010 Godfrey Chan, released under the MIT license

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。