mjai 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mjai/mjai_command.rb +23 -6
- data/lib/mjai/player.rb +1 -1
- metadata +2 -2
data/lib/mjai/mjai_command.rb
CHANGED
@@ -22,21 +22,29 @@ module Mjai
|
|
22
22
|
action = argv.shift()
|
23
23
|
opts = OptionParser.getopts(argv, "",
|
24
24
|
"port:11600", "host:127.0.0.1", "room:default", "game_type:one_kyoku",
|
25
|
-
"games:
|
25
|
+
"games:auto", "repeat", "log_dir:")
|
26
26
|
case action
|
27
27
|
when "server"
|
28
28
|
$stdout.sync = true
|
29
|
+
player_commands = argv
|
29
30
|
if opts["repeat"]
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
$stderr.puts("--repeat is deprecated. Use --games=inifinite instead.")
|
32
|
+
exit(1)
|
33
|
+
end
|
34
|
+
case opts["games"]
|
35
|
+
when "auto"
|
36
|
+
num_games = player_commands.size == 4 ? 1 : 1.0/0.0
|
37
|
+
when "infinite"
|
38
|
+
num_games = 1.0/0.0
|
39
|
+
else
|
40
|
+
num_games = opts["games"].to_i()
|
33
41
|
end
|
34
42
|
server = TCPActiveGameServer.new({
|
35
43
|
:host => opts["host"],
|
36
44
|
:port => opts["port"].to_i(),
|
37
45
|
:room => opts["room"],
|
38
46
|
:game_type => opts["game_type"].intern,
|
39
|
-
:player_commands =>
|
47
|
+
:player_commands => player_commands,
|
40
48
|
:num_games => num_games,
|
41
49
|
:log_dir => opts["log_dir"],
|
42
50
|
})
|
@@ -47,13 +55,22 @@ module Mjai
|
|
47
55
|
GameStats.print(argv)
|
48
56
|
else
|
49
57
|
$stderr.puts(
|
50
|
-
"Usage:\n" +
|
58
|
+
"Basic Usage:\n" +
|
51
59
|
" #{$PROGRAM_NAME} server --port=PORT\n" +
|
52
60
|
" #{$PROGRAM_NAME} server --port=PORT " +
|
53
61
|
"[PLAYER1_COMMAND] [PLAYER2_COMMAND] [...]\n" +
|
54
62
|
" #{$PROGRAM_NAME} stats 1.mjson [2.mjson] [...]\n" +
|
55
63
|
" #{$PROGRAM_NAME} convert hoge.mjson hoge.html\n" +
|
56
64
|
" #{$PROGRAM_NAME} convert hoge.mjlog hoge.mjson\n\n" +
|
65
|
+
"Complete usage:\n" +
|
66
|
+
" #{$PROGRAM_NAME} server \\\n" +
|
67
|
+
" --host=IP_ADDRESS \\\n" +
|
68
|
+
" --port=PORT \\\n" +
|
69
|
+
" --room=ROOM_NAME \\\n" +
|
70
|
+
" --game_type={one_kyoku|tonpu|tonnan} \\\n" +
|
71
|
+
" --games={NUM_GAMES|infinite} \\\n" +
|
72
|
+
" --log_dir=LOG_DIR_PATH \\\n" +
|
73
|
+
" [PLAYER1_COMMAND] [PLAYER2_COMMAND] [...]\n\n" +
|
57
74
|
"See here for details:\n" +
|
58
75
|
"http://gimite.net/pukiwiki/index.php?" +
|
59
76
|
"Mjai%20%CB%E3%BF%FDAI%C2%D0%C0%EF%A5%B5%A1%BC%A5%D0\n")
|
data/lib/mjai/player.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mjai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|