jbcden_ttt 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jbcden_ttt/board.rb +10 -0
- data/lib/jbcden_ttt/computer.rb +0 -5
- data/lib/jbcden_ttt/version.rb +1 -1
- 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: 653b7ee3e363afa9843027b90e635ded6cf45aee
|
4
|
+
data.tar.gz: 524cad18f026ae9631e87d782742ebcb35c3a161
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a868944d7f3aa21a552186b04dcb1228fc20999df633ebf11fc864374e580e3531312ac1aa43adee7381d43b3a99c2602cb08add5f742815d9cb6afdf44e195a
|
7
|
+
data.tar.gz: d74c60b61a3d602af67af4fbe1f7cb5c0f1f79ad0b4825a35b90f179f78e5601cbaed615f2a82bc4d12912c854455da0afacf8f42e0ee6481b02176bd55f08f3
|
data/lib/jbcden_ttt/board.rb
CHANGED
@@ -19,6 +19,16 @@ module JbcdenTtt
|
|
19
19
|
DisplayBoard.call(board)
|
20
20
|
end
|
21
21
|
|
22
|
+
def dup
|
23
|
+
# copy board class and deep copy the inner board array
|
24
|
+
# Marshal is necessary b/c board array does not contain
|
25
|
+
# Plain Old Ruby Objects
|
26
|
+
super.tap do
|
27
|
+
temp_board = Marshal.load(Marshal.dump(board))
|
28
|
+
self.board = temp_board
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
def_delegators :@board, :[], :[]=, :each, :first, :size, :last
|
23
33
|
private
|
24
34
|
|
data/lib/jbcden_ttt/computer.rb
CHANGED
@@ -87,12 +87,7 @@ module JbcdenTtt
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def get_new_state(tile, game, current_player)
|
90
|
-
# copy board class and deep copy the inner board array
|
91
|
-
# Marshal is necessary b/c board array does not contain
|
92
|
-
# Plain Old Ruby Objects
|
93
90
|
temp_board = game.board.dup
|
94
|
-
board_array = Marshal.load(Marshal.dump(game.board.board))
|
95
|
-
temp_board.board = board_array
|
96
91
|
|
97
92
|
temp_board[tile.xval][tile.yval].mark(current_player)
|
98
93
|
|
data/lib/jbcden_ttt/version.rb
CHANGED