kayabot 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/kayabot.gemspec +1 -1
  2. data/lib/gg.rb +6 -4
  3. metadata +1 -1
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "kayabot"
3
- s.version = "0.1.4"
3
+ s.version = "0.1.6"
4
4
  s.summary = "Interface to run Go Bots on Kaya"
5
5
  s.description = "This is an interface to run GTP compliant Go Bots on Kaya."
6
6
  s.authors = ["Gabriel Benmergui"]
data/lib/gg.rb CHANGED
@@ -130,9 +130,11 @@ def convert_move(move, size=19)
130
130
  elsif move == "resign"
131
131
  return 'resign'
132
132
  else
133
- h = move[0].ord
134
- v = (@size.to_i - move[1,2].to_i + 65)
135
- sgf_move = [h, v].map {|x| if x > 73 then (x - 1).chr else x.chr end}
136
- return sgf_move.join.downcase
133
+
134
+ alphabet = "ABCDEFGHIJKLMNOPQRS"[0..size.to_i - 1]
135
+
136
+ sgf_alphabet = "ABCDEFGHJKLMNOPQRST"[0..size.to_i - 1]
137
+
138
+ return alphabet["ABCDEFGHJKLMNOPQRST".index(move[0])].downcase + alphabet.reverse[(move[1].to_s + move[2].to_s).to_i - 1].downcase
137
139
  end
138
140
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kayabot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: