tttazures 0.0.18 → 0.0.19
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.
- checksums.yaml +4 -4
- data/lib/computer_ai.rb +5 -8
- data/lib/human_player.rb +2 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5c249a9b5651b9b190b4e69920f0e7041688d8a
|
4
|
+
data.tar.gz: 6f7499d22d49bea2af861237f0cef94a3aee835d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1de391a2ba91bc3cbe68ebd6fa3d86fd7cfd302ff792039a50b27c921cb507d7790c03cd23407e26cc66e3584962f040f3b5d0716f82dc114c353abf9ac38c6b
|
7
|
+
data.tar.gz: 266d99bfee0af7250465ddf70f23c60623adc414285022b05538c1b1edfbc8a5c5049c205e5b1c1eb916b3c55c11d3e086d776ddcd2ed119f3e41afd4981ed24
|
data/lib/computer_ai.rb
CHANGED
@@ -4,19 +4,20 @@ class ComputerAI
|
|
4
4
|
MAX_BETA = 1.0/0
|
5
5
|
TOP_DEPTH = 0
|
6
6
|
|
7
|
-
attr_reader :
|
7
|
+
attr_reader :symbol, :threshold, :type
|
8
8
|
|
9
9
|
def initialize player, threshold
|
10
10
|
@threshold = threshold
|
11
|
-
@
|
11
|
+
@symbol = symbol
|
12
|
+
@type = :ai
|
12
13
|
end
|
13
14
|
|
14
15
|
def make_move board
|
15
16
|
update_depth_limit(board)
|
16
|
-
if use_mini_max? then best_options = mini_max_top(board, @
|
17
|
+
if use_mini_max? then best_options = mini_max_top(board, @symbol)
|
17
18
|
else best_options = make_random_move(board) end
|
18
19
|
choice = best_options.sample
|
19
|
-
board.record_choice(choice, @
|
20
|
+
board.record_choice(choice, @symbol)
|
20
21
|
choice
|
21
22
|
end
|
22
23
|
|
@@ -75,8 +76,4 @@ class ComputerAI
|
|
75
76
|
def opponent player
|
76
77
|
if player == :o then return :x else return :o end
|
77
78
|
end
|
78
|
-
|
79
|
-
def get_player_type
|
80
|
-
:ai
|
81
|
-
end
|
82
79
|
end
|
data/lib/human_player.rb
CHANGED