tic_tac_toe_mchliakh 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 072bc656c41d95129bcefb107902672c8357cfa4
4
- data.tar.gz: 0c1c946da43fe2096163478d8b510165aa86e0b5
3
+ metadata.gz: 0180757d7d76b94a4b58bfc145f77ae2429e52c2
4
+ data.tar.gz: cb154e39260c4169fa6512fd6afaf75a6c8c3b0f
5
5
  SHA512:
6
- metadata.gz: 05551d2f509850f61d1fd3e5a00e95f71441b604dd1f846f43fa1f7b5a0de7ac67d06efab09ad2f60e8ba24c2475b8ae132b7b92f0b04dc7023a7d604216712e
7
- data.tar.gz: 725cf87c5ffe99fc19b099a6282bad7cd370072856e527e7f4d0b0d6703b4d3acae3d8aec47ff53d17ffe15577c70acbe74485f790df79ad327c57c839cde594
6
+ metadata.gz: 6fa4d611faaf58df31f2acc916d6afd2e3c40af8ba0ba0a33662501bb30c091a82dd53d21e6477c72d7920184906cb0591451b3d18d707bc3b5ed639a805dbc3
7
+ data.tar.gz: 75711418630a2c94d0efdfac6c2f03e52f19e95e29a046a690db803a0c56150d60deec6bc149a6c77e0e23dc458916473f5a82c51bed0775c7b86af03aff2df3
@@ -9,6 +9,7 @@ require 'tic_tac_toe_mchliakh/players/computer'
9
9
  module TicTacToeMchliakh
10
10
  def self.move(square, saved_board=nil)
11
11
  square = square.to_i
12
+ saved_board.map! {|s| s.to_i if s } if saved_board
12
13
 
13
14
  board = Board.new(saved_board)
14
15
  board.square(square).take(1)
@@ -1,3 +1,3 @@
1
1
  module TicTacToeMchliakh
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -7,11 +7,23 @@ module TicTacToeMchliakh
7
7
  .to eq([0, 1])
8
8
  end
9
9
 
10
- it 'accepts string input' do
10
+ it 'accepts string input for the square' do
11
11
  expect(TicTacToeMchliakh.move(' 1')[:board].compact.sort)
12
12
  .to eq([0, 1])
13
13
  end
14
14
 
15
+ it 'makes a move on a saved board' do
16
+ board = [nil, nil, nil, 1, 0, nil, nil, nil, nil]
17
+ expect(TicTacToeMchliakh.move(1, board)[:board].compact.sort)
18
+ .to eq([0, 0, 1, 1])
19
+ end
20
+
21
+ it 'makes accepts string input for the saved board' do
22
+ board = [nil, nil, nil, '1', '0', nil, nil, nil, nil]
23
+ expect(TicTacToeMchliakh.move(1, board)[:board].compact.sort)
24
+ .to eq([0, 0, 1, 1])
25
+ end
26
+
15
27
  it 'returns an error when desired square is taken' do
16
28
  expect(TicTacToeMchliakh.move(1, Array.new(9, 0)))
17
29
  .to have_key(:error)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tic_tac_toe_mchliakh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Chliakhovski