x_and_os 0.0.1 → 0.0.2
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/cla/tic_tac_toe/application.rb +4 -6
- data/lib/x_and_os/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: 26abf99b399b44f43e52de5048bf505d0ba28db0
|
4
|
+
data.tar.gz: 5f50b16285f9519b984be7590adbf5ac829c5001
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8ab4f63dcd2fbdfd5f8388a2f9aafd6897a6773c6d23e4fa13fceb14011c613aba05a10af180f95eaa233656dcd87ea57f25d6170ab6cc2121f36664c042159
|
7
|
+
data.tar.gz: 2a47b86dc429bfeaf25ef08a3c9caabb358d6a39e32d8e3e6c23d7dc7385f0ca417ce5a0b29cf49cab4d5d4f1d6e4799e11a987f93828c09363f6f501842602a
|
@@ -10,7 +10,7 @@ module TicTacToe
|
|
10
10
|
def start_app
|
11
11
|
UI.output
|
12
12
|
UI.output 'Welcome to TicTacToe'
|
13
|
-
UI.output 'Quick Game?'
|
13
|
+
UI.output 'Quick Game? (player vs computer : 3x3 board'
|
14
14
|
settings unless UI.receive =~ /^y/i
|
15
15
|
loop do
|
16
16
|
play
|
@@ -21,13 +21,11 @@ module TicTacToe
|
|
21
21
|
UI.output 'Change settings?'
|
22
22
|
settings if UI.receive =~ /^y/i
|
23
23
|
end
|
24
|
-
|
25
24
|
UI.output
|
26
25
|
UI.output 'Thank you for playing.'
|
27
26
|
end
|
28
27
|
|
29
28
|
private
|
30
|
-
|
31
29
|
def settings
|
32
30
|
choose_player
|
33
31
|
choose_board_size
|
@@ -41,7 +39,6 @@ module TicTacToe
|
|
41
39
|
UI.output
|
42
40
|
UI.output 'Player 1'
|
43
41
|
@player_one = player_type(UI.receive)
|
44
|
-
UI.output
|
45
42
|
UI.output 'Player 2'
|
46
43
|
@player_two = player_type(UI.receive)
|
47
44
|
UI.output
|
@@ -53,7 +50,6 @@ module TicTacToe
|
|
53
50
|
UI.output ' 3: 3x3'
|
54
51
|
UI.output ' 4: 4x4'
|
55
52
|
UI.output ' N: NxN'
|
56
|
-
UI.output
|
57
53
|
size = UI.receive
|
58
54
|
@board_size = (size.to_i >= 1) ? size : 3
|
59
55
|
UI.output
|
@@ -75,12 +71,14 @@ module TicTacToe
|
|
75
71
|
@board_size ||= 3
|
76
72
|
end
|
77
73
|
|
78
|
-
|
79
74
|
def player_type(player)
|
80
75
|
if player =~ /^p/i
|
81
76
|
HumanPlayer
|
82
77
|
elsif player =~ /^c/i
|
83
78
|
ComputerPlayer
|
79
|
+
else
|
80
|
+
UI.output ' Invalid player type, please try again.'
|
81
|
+
choose_player
|
84
82
|
end
|
85
83
|
end
|
86
84
|
|
data/lib/x_and_os/version.rb
CHANGED