Class: TttChido::TicTacToe

Inherits:
Object
  • Object
show all
Defined in:
lib/ttt_chido.rb

Instance Method Summary collapse

Constructor Details

#initializeTicTacToe

Returns a new instance of TicTacToe.



7
# File 'lib/ttt_chido.rb', line 7

def initialize;end

Instance Method Details

#startObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ttt_chido.rb', line 9

public def start
  @salir = true;
  @player = 1
    while @salir do
      system('clear')
        puts '========================= M E N U ================================='
        print '                   Press enter to start '
        gets.chomp
        system('clear')
        start  = Board.new(@player)
        @player = start.getLastPlayer
        case @player
        when 1
          @player+=1
        when 2
          @player-=1
        end
        puts ""
        print "Press enter to continue: "
        gets.chomp
        system('clear')
        puts 'Want to play again? true/false'
        answer = gets.chomp
         @salir = false if answer == 'false'
         system('clear')
    end
    puts "~~~~~~~~~~~~~~~~ Thanks for playing ~~~~~~~~~~~~~~~~~"
    puts "~~~~~~~~~~~~~ Gem created by rubiocanino ~~~~~~~~~~~~~"
    puts ""
end