 #console.log xyToan 1, 8
 
 myBoard = new Board
-myBoard.set("a2", new Knight true)
-myBoard.set(1,1, new Knight false)
+#myBoard.set("a2", new Knight true)
+#myBoard.set(1,1, new Knight false)
+#myBoard.set(1,3, "f")
 
+#myBoard.importFEN( "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" )
+myBoard.setup("classic")
 myBoard.log()
 
 #console.log myBoard.get(1,2)

xyToan = (x,y) ->
	return (String.fromCharCode (x+96)) + y



# Board is from white's perspective.
class Board
	# fill in with peices
	board =
	for x in [0..7]
		for y in [0..7]
			# if x+y % 2 == 0 then it's a white square
			new BlankPiece (x + y) % 2 == 0

	# these work with either algebraic notation or x,y coordinates
	set: (pos..., to) ->
		# convert if we are in algebraic notation
		if pos.length == 1
			pos = anToxy pos[0]

		x = pos[0]
		y = pos[1]

		board[x][y] = to

	get: (pos...) ->


		return board[x][y]

	# fills an 8x8 board array
	visual: ->
		for y in [0..7]
			for x in [0..7]
				@get(x,y).symbol

	# draw the board to the console
