swttt-gem 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/minimax_computer.rb +2 -2
- data/spec/minimax_computer_spec.rb +2 -2
- data/swttt-gem.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/minimax_computer.rb
CHANGED
@@ -9,7 +9,7 @@ class MinimaxComputer
|
|
9
9
|
@my_player_value = @game_board.player_value
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def move(iteration = 0)
|
13
13
|
if first_move?
|
14
14
|
move = first_move
|
15
15
|
return @game_board.move(move.row, move.column)
|
@@ -55,7 +55,7 @@ private
|
|
55
55
|
|
56
56
|
def path_score(row, column, iteration)
|
57
57
|
@game_board.move(row, column)
|
58
|
-
score =
|
58
|
+
score = move(iteration + 1)
|
59
59
|
@game_board.undo_move
|
60
60
|
return score
|
61
61
|
end
|
@@ -16,11 +16,11 @@ describe MinimaxComputer do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "has a move" do
|
19
|
-
@computer.
|
19
|
+
@computer.move.nil?.should be_false
|
20
20
|
end
|
21
21
|
|
22
22
|
it "always end in a cats game" do
|
23
|
-
(0...9).each { @computer.
|
23
|
+
(0...9).each { @computer.move }
|
24
24
|
@observer.game_over?.should be_true
|
25
25
|
@observer.has_winner?.should be_false
|
26
26
|
end
|
data/swttt-gem.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swttt-gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stephen Walker
|