tic_tac_toe_vj 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3790c471193ac46e14077ce32db0854d34fbfee1d7109ade0a430cf2c796438d
4
- data.tar.gz: '09cfe835c06322566feacbfd099eacd702538a1257aed4a890f340f6dcb13aa4'
3
+ metadata.gz: 2bf7524f8d18e01bcd910204ce5b4e2adf4d8566f9ebf9fe98b8e046a1688d4c
4
+ data.tar.gz: 2ee010ab5568b000171a7ccdfded67154cb00639a7dfd08aefea4cd8f4832563
5
5
  SHA512:
6
- metadata.gz: 67b82d45f7c09264a72af6a4e34c5b98622510ceef7e1748f47acee589d6791dca04fa110a350ea39d8dbf92082e760ed6e0fcfccf09c59e3a1b9e4f7b2d0b4c
7
- data.tar.gz: 47969150802662b56479f720a2c5c10402b0fade5a07c99057f64aef91bdd40cd3d0d3a38587d2957c4eae19c596cf69986d7ffa69104da2c094c8f34c677190
6
+ metadata.gz: fbd1d9a3ff0fc41acea6888765d52eda5ae1f669e83aedb16ee4316d30594755a6a25f3c7deffee541c5811a0e2b73409508b204cfb91666131e17215027a42d
7
+ data.tar.gz: 839edcdbd0bc95ea4addc45f0e4be8ba6134574e1bba6a344e86ead4022bf9b9303e0c206ca9389e95cfb1051f7cd22f7cf2479b73a36efda277671a92048974
@@ -5,11 +5,11 @@ require 'tic_tac_toe_vj/player'
5
5
  require 'tic_tac_toe_vj/location'
6
6
  require 'tic_tac_toe_vj/game_status'
7
7
 
8
- class TicTakToeController
8
+ class TicTakToe
9
9
  include TicTacToeVj
10
10
  include GameStatus
11
11
 
12
- def initialize(player1_name="Vijay", player2_name="Ajay")
12
+ def initialize(player1_name="player1", player2_name="player2")
13
13
  @board = Board.new
14
14
  @tile_location = Location.new(0,0)
15
15
  @player1 = Player.new(player1_name, :O)
@@ -20,7 +20,7 @@ class TicTakToeController
20
20
  def start
21
21
  puts "Tic tak toe is starting -------------"
22
22
  sleep(1)
23
- puts "terns should be write as row coma column ex 1,1 this will Enter your Symbol in the middle"
23
+ puts "turns should be write as row coma column ex 1,1 this will Enter your Symbol in the middle"
24
24
  sleep(0.5)
25
25
  user_play_move
26
26
  end
@@ -50,7 +50,7 @@ class TicTakToeController
50
50
  def update_game_after_move(gamestatus)
51
51
  case gamestatus
52
52
  when GameStatus::NEXT_MOVE
53
- puts "your tern #{@game.current_player.name}"
53
+ puts "your turn #{@game.current_player.name}"
54
54
  user_play_move
55
55
  when GameStatus::DRAW
56
56
  puts "its a draw"
@@ -68,8 +68,14 @@ class TicTakToeController
68
68
  end
69
69
 
70
70
  def user_play_move
71
- puts "#{@board.tile}"
72
- puts "Enter your tern #{@game.current_player.name}"
71
+ @board.tile.each do |row|
72
+ row.each do |column|
73
+ print " #{column} "
74
+ end
75
+ puts " "
76
+ end
77
+
78
+ puts "Enter your turn #{@game.current_player.name}"
73
79
  location = gets.chomp
74
80
  if validate_input?(location)
75
81
  move_locations = location.split(",")
@@ -78,7 +84,7 @@ class TicTakToeController
78
84
  @board.mark_tile(@tile_location, @game.current_player.symbol)
79
85
  @game.play_move(@tile_location)
80
86
  else
81
- puts "location is already marked please do terns again"
87
+ puts "location is already marked please do turns again"
82
88
  user_play_move
83
89
  end
84
90
  else
@@ -7,7 +7,7 @@ class Board
7
7
 
8
8
  def initialize()
9
9
  @number_of_tiles_marked = 0
10
- @tile = Array.new(BOARD_SIZE) {Array.new(BOARD_SIZE)}
10
+ @tile = Array.new(BOARD_SIZE) {Array.new(BOARD_SIZE, '_')}
11
11
  end
12
12
 
13
13
  def mark_tile(location, mark)
@@ -18,7 +18,7 @@ class Board
18
18
  end
19
19
 
20
20
  def is_tile_not_marked?(location)
21
- return @tile[location.row][location.column].nil?
21
+ return @tile[location.row][location.column] == "_"
22
22
  end
23
23
 
24
24
  def number_of_terns
@@ -1,3 +1,3 @@
1
1
  module TicTacToeVj
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tic_tac_toe_vj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vijay Pratap Singh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-20 00:00:00.000000000 Z
11
+ date: 2018-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler