shogi-server source
リビジョン | 7a9b8f6315c13501a9936d89e66d93499c9e610b (tree) |
---|---|
日時 | 2013-11-04 13:35:02 |
作者 | Daigo Moriwaki <beatles@user...> |
コミッター | Daigo Moriwaki |
* [mk_rate] - Added a new option, --ignore, which is imported from mk_rate-from-grep.
@@ -1,3 +1,9 @@ | ||
1 | +2013-11-04 Daigo Moriwaki <daigo at debian dot org> | |
2 | + | |
3 | + * [mk_rate] | |
4 | + - Added a new option, --ignore, which is imported from | |
5 | + mk_rate-from-grep. | |
6 | + | |
1 | 7 | 2013-09-08 Daigo Moriwaki <daigo at debian dot org> |
2 | 8 | |
3 | 9 | * [shogi-server] |
@@ -49,6 +49,10 @@ | ||
49 | 49 | # m [days] (default 7) |
50 | 50 | # after m days, the half-life effect works |
51 | 51 | # |
52 | +# --ignore:: | |
53 | +# m [days] (default 365*2) | |
54 | +# old results will be ignored | |
55 | +# | |
52 | 56 | # --fixed-rate-player:: |
53 | 57 | # player whose rate is fixed at the rate |
54 | 58 | # |
@@ -664,6 +668,11 @@ def parse(line) | ||
664 | 668 | return if state == "abnormal" |
665 | 669 | time = Time.parse(time) |
666 | 670 | return if $options["base-date"] < time |
671 | + how_long_days = ($options["base-date"] - time)/(3600*24) | |
672 | + if (how_long_days > $options["ignore"]) | |
673 | + return | |
674 | + end | |
675 | + | |
667 | 676 | black_id = identify_id(black_id) |
668 | 677 | white_id = identify_id(white_id) |
669 | 678 |
@@ -701,6 +710,8 @@ OPTOINS: | ||
701 | 710 | --half-life n [days] (default 60) |
702 | 711 | --half-life-ignore m [days] (default 7) |
703 | 712 | after m days, half-life effect works |
713 | + --ignore n [days] (default 730 [=365*2]). | |
714 | + Results older than n days from the 'base-date' are ignored. | |
704 | 715 | --fixed-rate-player player whose rate is fixed at the rate |
705 | 716 | --fixed-rate rate |
706 | 717 | --skip-draw-games skip draw games. [default: draw games are counted in |
@@ -716,6 +727,7 @@ def main | ||
716 | 727 | ["--half-life", GetoptLong::REQUIRED_ARGUMENT], |
717 | 728 | ["--half-life-ignore", GetoptLong::REQUIRED_ARGUMENT], |
718 | 729 | ["--help", "-h", GetoptLong::NO_ARGUMENT], |
730 | + ["--ignore", GetoptLong::REQUIRED_ARGUMENT], | |
719 | 731 | ["--fixed-rate-player", GetoptLong::REQUIRED_ARGUMENT], |
720 | 732 | ["--fixed-rate", GetoptLong::REQUIRED_ARGUMENT], |
721 | 733 | ["--skip-draw-games", GetoptLong::NO_ARGUMENT]) |
@@ -748,6 +760,8 @@ def main | ||
748 | 760 | $options["half-life"] = $options["half-life"].to_i |
749 | 761 | $options["half-life-ignore"] ||= 7 |
750 | 762 | $options["half-life-ignore"] = $options["half-life-ignore"].to_i |
763 | + $options["ignore"] ||= 365*2 | |
764 | + $options["ignore"] = $options["ignore"].to_i | |
751 | 765 | $options["fixed-rate"] = $options["fixed-rate"].to_i if $options["fixed-rate"] |
752 | 766 | |
753 | 767 | if ARGV.empty? |