 
 #myPiece = new Pawn
 #console.log myPiece.pointValue()
+
+# deibTest
+console.log("---------------")
+deibGame = new Game
+deibGame.deibTest()
+deibGame.log()

	value: 3
	blackSymbol: "\u265D"
	whiteSymbol: "\u2657"

class Rook extends Piece
	name: "Rook"

	get: (x, y) ->
		return @board[x][y]

	inClearDiagonal: (x1, y1, x2, y2) ->
		if (x1 == x2) and (y1 == y2)
			return false
		# Check if a 45-degree diagonal exists.
		if Math.abs( x1 - x2 ) != Math.abs( y1 - y2 )
			return false

		xMove = 0
		yMove = 0
		if ( x1 < x2 ) then xMove = 1 else xMove = -1
		if ( y1 < y2 ) then yMove = 1 else yMove = -1

		i = x1 + xMove
		j = y1 + yMove
		while not (i==x1 and j==y1) and not (i==x2 and j==y2)
			if not (@get( i, j ) instanceof BlankPiece)
				return false
			i += xMove
			j += yMove

		return true


	inClearStraight: (x1, y1, x2, y2) ->
		# Two tiles are not in straight lines if they are the same tile or
		# if not one of the coordinates is the same
		if (x1 == x2 and y1 == y2) or (x1 != x2 and y1 != y2)
			return false

		
		xMove = 0
		yMove = 0
		if x1 == x2
			if y1 < y2 then yMove = 1 else yMove = -1
		else
			if x1 < x2 then xMove = 1 else xMove = -1

		i = x1 + xMove
		j = y1 + yMove
		while not (i==x1 and j==y1) and not (i==x2 and j==y2)
			if not (@get( i, j ) instanceof BlankPiece)
				return false
			i += xMove
			j += yMove

		return true


	# move 1 to 2
	move: (x1, y1, x2, y2) ->
		# TODO capture logic / points
