def make_move puts "Enter x coordinate" x=gets.to_i puts "Enter y coordinate" y=gets.to_i if y==1 && x==1 && !@board[1].match(/[xy]/) @board[1]="1 _"+@turn+"|" elsif y==2 && x==1 && !@board[2].match(/[xy]/) @board[2]="_"+@turn elsif y==3 && x==1 && !@board[3].match(/[xy]/) @board[3]="|_"+@turn elsif y==1 && x==2 && !@board[4].match(/[xy]/) @board[4]="\n2 _"+@turn+"|" elsif y==2 && x==2 && !@board[5].match(/[xy]/) @board[5]="_"+@turn elsif y==3 && x==2 && !@board[6].match(/[xy]/) @board[6]="|_"+@turn elsif y==1 && x==3 && !@board[7].match(/[xy]/) @board[7]="\n3 "+@turn+"|" elsif y==2 && x==3 && !@board[8].match(/[xy]/) @board[8]=" "+@turn elsif y==3 && x==3 && !@board[9].match(/[xy]/) @board[9]="| "+@turn+" \n" else puts "You either entered an invalid coordinate or a a taken square. Please enter another coordinate" make_move end
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)