+2014-12-27 Daigo Moriwaki <daigo at debian dot org>
+
+ * [shogi-server]
+ - When a non-rated player participates in Floodgate, the following exception
+ was thrown and a Floodgate game would not start:
+ undefined method `[]' for nil:NilClass
+ ["/home/shogi-server/www/x/shogi_server/pairing.rb:499:in `block
+ in calculate_diff_with_penalty'"
+ This issue has been resolved. Only players who have player ID
+ (i.e. those who log in with valid password) are now allowed to
+ participate in Floodgate as the spec web page
+ [http://shogi-server.sourceforge.jp/rating.html] describes.
+
2014-12-23 Daigo Moriwaki <daigo at debian dot org>
* [shogi-server]
has now been fixed.
Thanks to Hiraoka-san for debugging.
+2014-11-30 Daigo Moriwaki <daigo at debian dot org>
+
+ * [mk_html]
+ - Corrected a url.
+
2014-11-24 Daigo Moriwaki <daigo at debian dot org>
* Ruby 2.0:
%>
<tr class="<%=player_decoration%>">
<td class="name">
- <a id="popup<%=popup_id+=1%>" href="http://wdoor.c.u-tokyo.ac.jp/shogi/tools/view/show-player.cgi?event=LATEST&filter=floodgate&show_self_play=1&user=<%=u key%>"><%= h yaml[key]['name'] %></a>
+ <a id="popup<%=popup_id+=1%>" href="http://wdoor.c.u-tokyo.ac.jp/shogi/view/show-player.cgi?event=LATEST&filter=floodgate&show_self_play=1&user=<%=u key%>"><%= h yaml[key]['name'] %></a>
<script type="text/javascript">
var tooltip<%=popup_id%> = new YAHOO.widget.Tooltip("myTooltip", {
context:"popup<%=popup_id%>",
end
end
- def match_game
- log_message("Starting Floodgate games...: %s, %s" % [@game_name, @options])
+ # Returns an array of players who are allowed to participate in this
+ # Floodgate match
+ #
+ def select_players
players = @league.find_all_players do |pl|
pl.status == "game_waiting" &&
game_name?(pl.game_name) &&
- pl.sente == nil
+ pl.sente == nil &&
+ pl.rated? # Only players who have player ID can participate in Floodgate (rating match)
end
+ return players
+ end
+
+ def match_game
+ log_message("Starting Floodgate games...: %s, %s" % [@game_name, @options])
logics = Pairing.send(@options[:pairing_factory], @options)
- Pairing.match(players, logics)
+ Pairing.match(select_players(), logics)
end
#
$topdir = File.expand_path File.dirname(__FILE__)
+class SimplePlayer < ShogiServer::BasicPlayer
+ attr_accessor :status
+ def initialize
+ super
+ @status = "game_waiting"
+ @game_name = "floodgate-900-0"
+ end
+end
+
class TestFloodgate < Test::Unit::TestCase
def setup
@fg = ShogiServer::League::Floodgate.new(nil)
assert(fg.game_name?("floodgate-3600-0"))
end
+ def test_select_players
+ league = ShogiServer::League.new(File.dirname(__FILE__))
+ league.event = "test"
+ league.setup_players_database
+
+ a = SimplePlayer.new
+ a.win = 1
+ a.loss = 2
+ a.rate = 0
+ a.name = "a"
+ a.player_id = "a+123"
+ b = SimplePlayer.new
+ b.win = 10
+ b.loss = 20
+ b.rate = 1500
+ b.name = "b"
+ b.player_id = "b+456"
+ c = SimplePlayer.new
+ c.win = 100
+ c.loss = 200
+ c.rate = 1000
+ c.name = "c"
+
+ league.add a
+ league.add b
+ league.add c
+
+ fg = ShogiServer::League::Floodgate.new(league, {:game_name => "floodgate-900-0"})
+
+ assert_equal([a,b], fg.select_players)
+ end
end
class TestDeleteMostPlayingPlayer < Test::Unit::TestCase