• R/O
  • HTTP
  • SSH
  • HTTPS

shogi-server: Commit

shogi-server source


Commit MetaInfo

Revision7bf33b205c9ac67e399be4ee3c275dd9e9a70d73 (tree)
Time2018-04-07 15:17:46
AuthorDaigo Moriwaki <daigo@debi...>
CommiterDaigo Moriwaki

Log Message

Merge branch 'master' into wdoor-stable

Change Summary

Incremental Difference

--- a/Dockerfile
+++ b/Dockerfile
@@ -1,19 +1,21 @@
1-FROM debian
1+FROM debian:stretch-slim
22 MAINTAINER Daigo Moriwaki <daigo@debian.org>
33
44 RUN apt-get update && apt-get install -y \
5+ ca-certificates \
56 apt-utils \
67 ruby ruby-gsl
7-RUN gem install rgl
88
99 ENV EVENT local
1010 ENV PORT 4081
1111 ENV MAX_IDENTIFIER 32
1212
1313 WORKDIR /shogi-server
14+
1415 RUN mkdir /logs
16+RUN gem install rgl
1517
1618 COPY . ./
1719
18-CMD ./shogi-server --daemon /logs --pid-file shogi-server.pid --max-identifier $MAX_IDENTIFIER $EVENT $PORT && tail -F /logs/shogi-server.log
19-
20+EXPOSE $PORT
21+CMD ./shogi-server --player-log-dir ./player-logs --max-identifier $MAX_IDENTIFIER $EVENT $PORT
--- a/changelog
+++ b/changelog
@@ -1,3 +1,9 @@
1+2018-04-07 Daigo Moriwaki <daigo at debian dot org>
2+
3+ * [shogi-server] Give more penalty on assigning matches with same
4+ players.
5+ (Closes #38178)
6+
17 2017-09-03 Daigo Moriwaki <daigo at debian dot org>
28
39 * [shogi-server] Write game results in categorical files
--- a/shogi_server/pairing.rb
+++ b/shogi_server/pairing.rb
@@ -496,6 +496,11 @@ module ShogiServer
496496 (history.last_opponent(p1.player_id) == p2.player_id ||
497497 history.last_opponent(p2.player_id) == p1.player_id))
498498 ret += 400
499+ if p1.estimated_rate != 0 || p2.estimated_rate != 0
500+ # unrated players should make games with various players.
501+ very_large = 4000
502+ ret += very_large
503+ end
499504 end
500505
501506 # 2.2 Human vs Human
--- a/test/TC_pairing.rb
+++ b/test/TC_pairing.rb
@@ -424,6 +424,11 @@ class TestLeastDiff < Test::Unit::TestCase
424424 @abcdxyz.name = "abcdxyz"
425425 @abcdxyz.rate = 2300
426426
427+ @unrated = ShogiServer::BasicPlayer.new
428+ @unrated.player_id = "unrated"
429+ @unrated.name = "unrated"
430+ @unrated.estimated_rate = 450
431+
427432 $league.add(@a)
428433 $league.add(@b)
429434 $league.add(@c)
@@ -580,6 +585,32 @@ class TestLeastDiff < Test::Unit::TestCase
580585 assert_equal(@abcdefg2.rate - @abcdefg1.rate + 800, @pairing.calculate_diff_with_penalty(players,nil))
581586 end
582587
588+ def test_calculate_diff_with_unrated_player
589+ players = [@unrated, @a]
590+ dummy = nil
591+ def @history.make_record(game_result)
592+ {:game_id => "wdoor+floodgate-900-0-a-unrated-1",
593+ :black => "a", :white => "unrated",
594+ :winner => "unrated", :loser => "a"}
595+ end
596+ @history.update(dummy)
597+ assert_equal(4000 + 400 + (@a.rate - @unrated.estimated_rate).abs,
598+ @pairing.calculate_diff_with_penalty(players,@history))
599+ end
600+
601+ def test_calculate_diff_with_unrated_player_2
602+ players = [@a, @unrated]
603+ dummy = nil
604+ def @history.make_record(game_result)
605+ {:game_id => "wdoor+floodgate-900-0-a-unrated-1",
606+ :black => "a", :white => "unrated",
607+ :winner => "unrated", :loser => "a"}
608+ end
609+ @history.update(dummy)
610+ assert_equal(4000 + 400 + (@a.rate - @unrated.estimated_rate).abs,
611+ @pairing.calculate_diff_with_penalty(players,@history))
612+ end
613+
583614 def test_get_player_rate_0
584615 assert_equal(2150, @pairing.get_player_rate(@x, @history))
585616
Show on old repository browser