ruby-go 0.0.1 → 0.0.2

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/game.rb +1 -1
  3. data/test/go_test.rb +27 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f71d9446113f48a82b1390f44a05e0f9cad75efb
4
- data.tar.gz: 5d2ed3d8d0d501032dc46833e7addf8539b6a203
3
+ metadata.gz: 8f24b07ee968e8a121f825d7c64e615649b8379e
4
+ data.tar.gz: 647b951b33b4394a657ddb1a749b8677ad6497c7
5
5
  SHA512:
6
- metadata.gz: 6e1382c7fe4da73aed73367a0c33d2029c1aa213d41fc59dc85a408ee51a592f7a58c6e2ace9f655152d19df153ebd1a40b4121abe5dddcdf289508fdd72d01a
7
- data.tar.gz: e5b1274ff292487691c3d4b19a3df14f4c7d66a82c7370dff22fd6e2bd7de11f4cf2442010ece3f080333bc742358477cf8c083080d6f348649940f308d171dc
6
+ metadata.gz: 365788568b669d24207f3e52c604cf218f5c4e6228ec1316b5847a8e9ceadfd25f2f03807cfba0fc5793c79e88fbceffc3559b471e69c9762c43a7382ca401bb
7
+ data.tar.gz: b0c4e34d1cf9482e68322dcc3e9f6bc7b47ae1a6952baa4c7ac47b047599082ccddd05e677f3ec4fd62aa12bf76a4f52e21a8dbbd3b390fd59f80fecc475bf43
data/lib/game.rb CHANGED
@@ -75,7 +75,7 @@ class Game
75
75
  captures = @moves[-2][:captures]
76
76
  stone = @moves.last[:stone]
77
77
 
78
- if captures.include?(stone)
78
+ if captures == [stone]
79
79
  undo
80
80
  raise IllegalMove,
81
81
  "You cannot capture the ko, play a ko threat first"
data/test/go_test.rb CHANGED
@@ -130,6 +130,32 @@ class GoTest < Minitest::Test
130
130
  game.white(4,3)
131
131
  end
132
132
  end
133
- end
134
133
 
134
+ def big_capture_area_game
135
+ game = Game.new
136
+ game.black(0,0)
137
+ game.white(1,1)
138
+ game.black(0,1)
139
+ game.white(0,2)
140
+ game.black(1,0)
141
+ game.white(2,0)
142
+ game
143
+ end
135
144
 
145
+ def test_can_play_in_previous_capture_area_that_is_not_a_ko
146
+ game = big_capture_area_game
147
+ assert_equal Liberty.new(0,0), game.board.at(0,0)
148
+ game.black(0,0)
149
+ assert_equal BlackStone.new(0,0), game.board.at(0,0)
150
+
151
+ game = big_capture_area_game
152
+ assert_equal Liberty.new(0,1), game.board.at(0,1)
153
+ game.black(0,1)
154
+ assert_equal BlackStone.new(0,1), game.board.at(0,1)
155
+
156
+ game = big_capture_area_game
157
+ assert_equal Liberty.new(1,0), game.board.at(1,0)
158
+ game.black(1,0)
159
+ assert_equal BlackStone.new(1,0), game.board.at(1,0)
160
+ end
161
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-go
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jphager2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-07 00:00:00.000000000 Z
11
+ date: 2016-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: SgfParser
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  version: '0'
63
63
  requirements: []
64
64
  rubyforge_project:
65
- rubygems_version: 2.2.2
65
+ rubygems_version: 2.4.6
66
66
  signing_key:
67
67
  specification_version: 4
68
68
  summary: The game of Go, writen in Ruby