ruby_ttt 0.3.0 → 0.3.1
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/game_setup.rb +11 -6
- metadata +1 -1
data/lib/game_setup.rb
CHANGED
@@ -4,7 +4,16 @@ AI_PLAYER = 'hard computer'
|
|
4
4
|
HARD_LEVEL = 'hard'
|
5
5
|
EASY_LEVEL = 'easy'
|
6
6
|
|
7
|
-
class GameSetup
|
7
|
+
class GameSetup
|
8
|
+
attr_accessor :ui
|
9
|
+
def initialize
|
10
|
+
@ui = UI.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_settings
|
14
|
+
{}
|
15
|
+
end
|
16
|
+
end
|
8
17
|
|
9
18
|
class CLIGameSetup < GameSetup
|
10
19
|
attr_accessor :ui
|
@@ -13,7 +22,7 @@ class CLIGameSetup < GameSetup
|
|
13
22
|
end
|
14
23
|
|
15
24
|
def get_settings
|
16
|
-
settings =
|
25
|
+
settings = super
|
17
26
|
begin
|
18
27
|
players = set_up_players
|
19
28
|
settings[:board] = get_board
|
@@ -88,10 +97,6 @@ class CLIGameSetup < GameSetup
|
|
88
97
|
end
|
89
98
|
|
90
99
|
class WebGameSetup < GameSetup
|
91
|
-
attr_accessor :ui
|
92
|
-
def initialize
|
93
|
-
@ui = UI.new
|
94
|
-
end
|
95
100
|
|
96
101
|
def set_up_players(player_one_type, player_two_type)
|
97
102
|
PlayerFactory.new(player_one_type, player_two_type)
|