# How to I add numbers to the top of my tic tac toe program?

I wrote a tic-tac-toe program. The board I made looks like this:

```1  __|__|__
2  __|__|__
3    |  |
```

The way I have set up the coordinates is that the first box is (1,1), the second (1,2), the third (1,3), the forth (2,1) etc. I wrote the 1, 2, and 3 on the side to make that clear to the user. I would also like to add the 1, 2, 3 to the top of the board. I need some help on how to do this.

Here is my code:

```class Game

def initialize
@board=Array.new
@board="1  __|"
@board="__"
@board="|__"
@board="\n2  __|"
@board="__"
@board="|__"
@board="\n3    |"
@board="  "
@board="|  "
@turn="x"
@win_status = false
end

def turn
@turn
end

def show_board
@board.each do |i|
print i
end
puts ""
end

def set_turn #switches turns
if @turn == "x"
@turn = "o"
else @turn == "o"
@turn = "x"
end
end

def make_move
puts "Enter x coordinate"
x=gets.to_i
puts "Enter y coordinate"
y=gets.to_i
@board="1  _"+@turn+"|"   if y==1 && x==1
@board="_"+@turn    if y==2 && x==1
@board="|_"+@turn   if y==3 && x==1
@board="\n_"+@turn+"|" if y==1 && x==2
@board="_"+@turn    if y==2 && x==2
@board="|_"+@turn   if y==3 && x==2
@board="\n "+@turn+"|" if y==1 && x==3
@board=" "+@turn    if y==2 && x==3
@board="|"+@turn+" \n"    if y==3 && x==3
end
def win_combo
return [[@board + @board + @board], [@board + @board + @board], [@board + @board + @board],[@board + @board + @board], [@board + @board + @board], [@board + @board + @board], [@board + @board + @board], [@board + @board + @board]]
end

def check_win
#if some row or column or diagonal is "xxx" or "ooo" then set @win_status = true
self.win_combo.each do |arr|
str = arr.join
if str == "xxx" or str == "ooo"
return true
end
end
return false
end
end

g = Game.new
while g.check_win != true
g.show_board
g.set_turn
g.make_move
end
puts "won"
```

Either within your show_board function, you can print 1 2 3 there

```def show_board
puts "   1 2 3"
@board.each do |i|
print i
end
puts ""
```

or you can have it as part of the initialize and make_move blocks as

```@board="   1 2 3\n" + "1  __|"
```

Side note: within show_board function, instead of @board.each .. end block, you can use

```@board.each {|i| print i}
```

Since we are making suggestions why not change the make move method as well to something like this

``` def make_move(*coords)
case coords
when [1,1]
@board="1  _"+@turn+"|"
when [2,1]
@board="_"+@turn
when [3,1]
@board="|_"+@turn
#...... you get the point
end
```

Then move the puts to here

```g = Game.new
while g.check_win != true
g.show_board
g.set_turn
putc "Enter x coordinate: "
x=gets.to_i
putc "Enter y coordinate: "
y=gets.to_i
g.make_move(y,x)
end
```