taka_tic_tac_toe 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,57 +2,23 @@ module TakaTicTacToe
2
2
  class Game
3
3
 
4
4
  attr_accessor :human, :board, :computer
5
- attr_writer :output, :input
6
5
 
7
6
 
8
7
  def initialize
9
8
  @human = Human.new('X')
10
9
  @board = Board.new
11
10
  @computer = Computer.new('O', @human.mark)
12
- @output = STDOUT
13
- @input = STDIN
14
- end
15
-
16
- def ask_difficulty
17
- @output.puts "Enter computer difficulty: (e)asy, (m)edium, (i)mpossible"
18
- difficulty = @input.gets.chomp.upcase
19
- @computer.difficulty = "ImpossibleAi" if difficulty == "I"
20
- @computer.difficulty = "EasyAi" if difficulty == "E"
21
- end
22
-
23
- def play
24
- @output.puts "Welcome to Tic Tac Toe!"
25
- print_board
26
- end
27
-
28
- def ask_move
29
- @output.puts "Enter your move: "
30
11
  end
31
12
 
32
13
  def make_moves(move)
33
14
  choose_move(get_human_mark, move)
34
15
  choose_move(get_computer_mark, computer_move) if !is_over?
35
- print_board
36
16
  end
37
17
 
38
18
  def reset_board
39
19
  @board.reset
40
20
  end
41
21
 
42
- def ask_mark
43
- @output.puts "Enter a letter for your mark"
44
- @human.ask_for_mark
45
- end
46
-
47
- def continue?
48
- @output.puts "Play again? y/n"
49
- @input.gets.chomp.upcase == 'Y'
50
- end
51
-
52
- def print_board
53
- @output.puts @board.print_slots
54
- end
55
-
56
22
  def get_human_mark
57
23
  @human.mark
58
24
  end
@@ -72,9 +38,5 @@ module TakaTicTacToe
72
38
  def choose_move(mark, index)
73
39
  @board.set_move(mark, index)
74
40
  end
75
-
76
- def finished
77
- @output.puts "End of game, good bye!"
78
- end
79
41
  end
80
42
  end
@@ -5,9 +5,5 @@ module TakaTicTacToe
5
5
  def initialize(mark)
6
6
  @mark = mark
7
7
  end
8
-
9
- def ask_for_mark
10
- @mark = gets.chomp.upcase
11
- end
12
8
  end
13
9
  end
@@ -1,5 +1,4 @@
1
1
  require 'taka_tic_tac_toe/player'
2
- require 'taka_tic_tac_toe/console'
3
2
  require 'taka_tic_tac_toe/game'
4
3
  require 'taka_tic_tac_toe/board'
5
4
  require 'taka_tic_tac_toe/human'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taka_tic_tac_toe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -24,7 +24,6 @@ files:
24
24
  - lib/taka_tic_tac_toe/ai_difficulty/medium_ai.rb
25
25
  - lib/taka_tic_tac_toe/board.rb
26
26
  - lib/taka_tic_tac_toe/computer.rb
27
- - lib/taka_tic_tac_toe/console.rb
28
27
  - lib/taka_tic_tac_toe/game.rb
29
28
  - lib/taka_tic_tac_toe/human.rb
30
29
  - lib/taka_tic_tac_toe/player.rb
@@ -1,13 +0,0 @@
1
- class ConsoleTTT
2
- def self.start_game
3
- $stdout.puts "Welcome to Tic Tac Toe!"
4
- end
5
-
6
- def self.input
7
- $stdin
8
- end
9
-
10
- def self.ask_for_move
11
- input.gets.chomp
12
- end
13
- end