Created
November 10, 2014 14:28
-
-
Save allcentury/618b90ffa1dec3bffde0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
class Queens | |
attr_reader :white, :black | |
def initialize | |
@board = build_board | |
@black = current_position('w') | |
@white = current_position('b') | |
end | |
def build_board | |
board = Array.new(8, Array.new(8)) | |
board[0][3] = 'w' | |
board[7][3] = 'b' | |
board | |
end | |
def current_position(color) | |
@board.each_with_index do |row, i| | |
row.each_with_index do |col, j| | |
if col == color | |
binding.pry | |
end | |
end | |
end | |
end | |
end | |
Queens.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment