OSDN Git Service
(root)
/
shogi-server
/
shogi-server.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[shogi-server] Enhance capability of Floodgate configuration file
[shogi-server/shogi-server.git]
/
shogi_server
/
pairing.rb
diff --git
a/shogi_server/pairing.rb
b/shogi_server/pairing.rb
index
946af2f
..
a38f929
100644
(file)
--- a/
shogi_server/pairing.rb
+++ b/
shogi_server/pairing.rb
@@
-69,14
+69,22
@@
module ShogiServer
StartGameWithoutHumans.new]
end
StartGameWithoutHumans.new]
end
- def match(players, logics)
+ def match(players, logics
, options
)
logics.inject(players) do |result, item|
logics.inject(players) do |result, item|
+ item.set_options(options)
item.match(result)
result
end
end
end # class << self
item.match(result)
result
end
end
end # class << self
+ def initialize
+ @options = {}
+ end
+
+ def set_options(options)
+ @options.merge!(options)
+ end
# Make matches among players.
# @param players an array of players, which should be updated destructively
# Make matches among players.
# @param players an array of players, which should be updated destructively
@@
-129,7
+137,7
@@
module ShogiServer
log_message("Floodgate: Starting a game: BLACK %s vs WHITE %s" % [p1.name, p2.name])
p1.sente = true
p2.sente = false
log_message("Floodgate: Starting a game: BLACK %s vs WHITE %s" % [p1.name, p2.name])
p1.sente = true
p2.sente = false
- board = Board.new
+ board = Board.new
(@options)
board.initial
Game.new(p1.game_name, p1, p2, board)
end
board.initial
Game.new(p1.game_name, p1, p2, board)
end
@@
-494,6
+502,13
@@
module ShogiServer
if p1.is_human? && p2.is_human?
ret += 800
end
if p1.is_human? && p2.is_human?
ret += 800
end
+
+ # 2.3 a match with likely kin players
+ if (p1.player_id[0..6] == p2.player_id[0..6])
+ ret += 800
+ elsif (p1.player_id[0..3] == p2.player_id[0..3])
+ ret += 400
+ end
end
ret
end
ret