Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Done #275

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Done #275

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion bin/move
@@ -1,5 +1,12 @@
#!/usr/bin/env ruby

require_relative '../lib/move.rb'
# Code your CLI Here

# Code your CLI Here
puts "Welcome to Tic Tac Toe!"
puts "Where would you like to go?"
input = gets.chomp
index =input_to_index(input)
board = [" ", " ", " ", " ", " ", " ", " ", " ", " "]
move(board, index)
display_board(board)
16 changes: 16 additions & 0 deletions lib/move.rb
Expand Up @@ -6,4 +6,20 @@ def display_board(board)
puts " #{board[6]} | #{board[7]} | #{board[8]} "
end

def input_to_index(user_input)
number= user_input.to_i
index = number-1


end
# code your input_to_index and move method here!

board = ["","","","","","","","","",]
def update_array_at_with(array, index, value)
array[index] = value
end

def move(array,index,value="X")
update_array_at_with(array,index,value)
display_board(array)
end