taka_tic_tac_toe 1.2.0 → 1.3.0
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.
data/lib/taka_tic_tac_toe.rb
CHANGED
@@ -25,7 +25,7 @@ module TakaTicTacToe
|
|
25
25
|
|
26
26
|
mark = color == 1 ? @mark : @opponent_mark
|
27
27
|
|
28
|
-
return check_game_state(board, (mark)) if board.has_winner || board.is_tie || depth ==
|
28
|
+
return check_game_state(board, (mark)) if board.has_winner || board.is_tie || depth == 4
|
29
29
|
|
30
30
|
board.empty_slots.each do |slots|
|
31
31
|
board.set_move(mark, slots)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module TakaTicTacToe
|
2
|
+
class PlayerFactory
|
3
|
+
def create(input)
|
4
|
+
if input[:type] == :computer
|
5
|
+
player = Computer.new(input[:mark], input[:opponent_mark])
|
6
|
+
player.difficulty = input[:difficulty]
|
7
|
+
elsif input[:type] == :human
|
8
|
+
player = Human.new(input[:mark])
|
9
|
+
else
|
10
|
+
raise "unknown player type"
|
11
|
+
end
|
12
|
+
player
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taka_tic_tac_toe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
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: 2013-04-
|
12
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: tic tac toe engine
|
15
15
|
email: tak.yuki@gmail.com
|
@@ -24,8 +24,8 @@ files:
|
|
24
24
|
- lib/taka_tic_tac_toe/ai_difficulty/medium_ai.rb
|
25
25
|
- lib/taka_tic_tac_toe/board.rb
|
26
26
|
- lib/taka_tic_tac_toe/computer.rb
|
27
|
+
- lib/taka_tic_tac_toe/computer_factory.rb
|
27
28
|
- lib/taka_tic_tac_toe/human.rb
|
28
|
-
- lib/taka_tic_tac_toe/player.rb
|
29
29
|
- lib/taka_tic_tac_toe.rb
|
30
30
|
homepage:
|
31
31
|
licenses: []
|