kayabot 0.1.3 → 0.1.4

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.
@@ -5,7 +5,7 @@ Feel free to expand the gem to allow other bots with GTP interface, should work
5
5
 
6
6
  Requirements:
7
7
 
8
- gnugo
8
+ gnugo or fuego
9
9
  ruby 1.9.2
10
10
  rubygems
11
11
 
@@ -19,16 +19,13 @@ To run:
19
19
 
20
20
  The configuration yaml must look like this:
21
21
 
22
- url : "http://alpha.kaya.gs:9292"
23
- user : "MyBot"
24
- pass : "MyBot's password"
22
+ url : "http://alpha.kaya.gs:9292"
23
+ user : "MyBot"
24
+ pass : "MyBot's password"
25
25
  title : "my title"
26
- size : (9,13 or 19 only)
26
+ size : (9,13 or 19 only)
27
+ bot : ("gnugo" or "fuego")
27
28
 
28
29
  Ask for a bot account at info@kaya.gs to run it!
29
30
 
30
31
  You can get a personalized bot account and if you run many games you can get a collaborator account.
31
-
32
-
33
-
34
-
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "kayabot"
3
- s.version = "0.1.3"
3
+ s.version = "0.1.4"
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
@@ -4,8 +4,7 @@ class GTP
4
4
  if bot_type == 'gnugo'
5
5
  new(IO.popen("gnugo --mode gtp", "r+"), &command)
6
6
  elsif bot_type == 'fuego'
7
- raise "not supported yet"
8
- # new(IO.popen("fuego --config #{RAILS_ROOT}/public/fuego.gtp", "r+"), &command)
7
+ new(IO.popen("fuego", "r+"), &command)
9
8
  end
10
9
  end
11
10
 
@@ -110,14 +109,10 @@ def ai_move(game_id, game_sgf, color)
110
109
  f.write game_sgf
111
110
  end
112
111
 
113
- #why this?
114
- if color == 'black' || color == 'white'
115
- game_bot = 'gnugo'
116
- end
117
112
  size = 19
118
- GTP.run(game_bot) do |gtp|
113
+ GTP.run(@bot || "gnugo") do |gtp|
119
114
  gtp.loadsgf filepath
120
- size = gtp.send_command(:query_boardsize)
115
+ size = @master_node.match(/SZ\[(\d+)\]/)[1]
121
116
  re = gtp.genmove color
122
117
  end
123
118
  p re
@@ -136,8 +131,8 @@ def convert_move(move, size=19)
136
131
  return 'resign'
137
132
  else
138
133
  h = move[0].ord
139
- v = (size.to_i - move[1,2].to_i + 65)
134
+ v = (@size.to_i - move[1,2].to_i + 65)
140
135
  sgf_move = [h, v].map {|x| if x > 73 then (x - 1).chr else x.chr end}
141
- return sgf_move.downcase
136
+ return sgf_move.join.downcase
142
137
  end
143
138
  end
@@ -22,6 +22,7 @@ class KayaBot
22
22
  @pass = config["pass"]
23
23
  @size = config["size"]
24
24
  @title = config["title"]
25
+ @bot = config["bot"]
25
26
  @agent = Mechanize.new
26
27
  @status
27
28
  @sgf
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.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-26 00:00:00.000000000 Z
12
+ date: 2012-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize