- Kifu files can include the following comment for Fischer Time
Control:
- "'Increment:<n>"
+ * [shogi-server] Fix some lint warnings.
2015-12-13 Daigo Moriwaki <daigo at debian dot org>
board = Board.new
begin
board.set_from_moves(moves_array)
- rescue => err
+ rescue
# it will never happen since moves have already been checked
log_error "Failed to set up a buoy game: #{moves}"
return :continue
# found two players: p1 and p2
log_info("Starting a buoy game: %s with %s and %s" % [@game_name, p1.name, p2.name])
buoy.decrement_count(buoy_game)
- game = Game::new(@game_name, p1, p2, board)
+ Game::new(@game_name, p1, p2, board)
return :continue
rescue WrongMoves => e
return false # time isn't expired. players aren't swapped. continue game
else
t = @time_clock.process_time(@current_player, @start_time, @end_time)
+ log_info(sprintf("+++ DEBUG %s consumed %d sec. remain %d sec",
+ @current_player.name, t, @current_player.mytime))
move_status = @board.handle_one_move(str, @sente == @current_player)
# log_debug("move_status: %s for %s's %s" % [move_status, @sente == @current_player ? "BLACK" : "WHITE", str])
@@mutex.synchronize do
records = @records.reverse
end
- rc = records.find do |rc|
+ ret = records.find do |rc|
rc[:winner] &&
rc[:loser] &&
(rc[:black] == player_id || rc[:white] == player_id)
end
- return rc
+ return ret
end
def win_games(player_id)
@@mutex.synchronize do
records = @records.reverse
end
- rc = records.find_all do |rc|
+ ret = records.find_all do |rc|
rc[:winner] == player_id && rc[:loser]
end
- return rc
+ return ret
end
def loss_games(player_id)
@@mutex.synchronize do
records = @records.reverse
end
- rc = records.find_all do |rc|
+ ret = records.find_all do |rc|
rc[:winner] && rc[:loser] == player_id
end
- return rc
+ return ret
end
end # class History
{:game_name => prev.game_name, :next_time => prev.next_time,
:pairing_factory => prev.pairing_factory, :sacrifice => prev.sacrifice,
:max_moves => prev.max_moves, :least_time_per_move => prev.least_time_per_move})
+ floodgate
end
floodgate_reload_log(leagues)
return leagues
floodgate = next_league(leagues)
next if wait_next_floodgate(floodgate)
- next_instances = leagues.collect do |floodgate|
- unless (floodgate.next_time - Time.now) > 0
- start_games(floodgate)
- floodgate.charge # updates next_time
+ next_instances = leagues.collect do |fg|
+ unless (fg.next_time - Time.now) > 0
+ start_games(fg)
+ fg.charge # updates next_time
end
- floodgate
+ fg
end
reload_shogi_server
end
def Login.factory(str, player)
- (login, player.name, password, ext) = str.chomp.split
+ (_, player.name, password, ext) = str.chomp.split
if ext
return Loginx1.new(player, password)
else
cmd = ShogiServer::Command.factory("should_be_error", @p)
assert_instance_of(ShogiServer::ErrorCommand, cmd)
cmd.call
- assert_match /unknown command: should_be_error/, cmd.msg
+ assert_match(/unknown command: should_be_error/, cmd.msg)
end
def test_error_login
cmd = ShogiServer::Command.factory("LOGIN hoge foo", @p)
assert_instance_of(ShogiServer::ErrorCommand, cmd)
cmd.call
- assert_no_match /unknown command: LOGIN hoge foo/, cmd.msg
+ assert_no_match( /unknown command: LOGIN hoge foo/, cmd.msg)
cmd = ShogiServer::Command.factory("LOGin hoge foo", @p)
assert_instance_of(ShogiServer::ErrorCommand, cmd)
cmd.call
- assert_no_match /unknown command: LOGIN hoge foo/, cmd.msg
+ assert_no_match(/unknown command: LOGIN hoge foo/, cmd.msg)
cmd = ShogiServer::Command.factory("LOGIN hoge foo", @p)
assert_instance_of(ShogiServer::ErrorCommand, cmd)
cmd.call
- assert_no_match /unknown command: LOGIN hoge foo/, cmd.msg
+ assert_no_match(/unknown command: LOGIN hoge foo/, cmd.msg)
cmd = ShogiServer::Command.factory("LOGINhoge foo", @p)
assert_instance_of(ShogiServer::ErrorCommand, cmd)
cmd.call
- assert_no_match /unknown command: LOGIN hoge foo/, cmd.msg
+ assert_no_match(/unknown command: LOGIN hoge foo/, cmd.msg)
end
end