-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchess.rb
37 lines (32 loc) · 976 Bytes
/
chess.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module Chess
require_relative 'chess/board.rb'
require_relative 'chess/piece.rb'
require_relative 'chess/game.rb'
PAWN=1
KNIGHT=2
BISHOP=3
ROOK=4
QUEEN=5
KING=6
#black is negative
START = [
[ROOK, KNIGHT, BISHOP, QUEEN, KING, BISHOP, KNIGHT, ROOK],
[PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN],
[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0],
[-PAWN, -PAWN, -PAWN, -PAWN, -PAWN, -PAWN, -PAWN, -PAWN],
[-ROOK, -KNIGHT, -BISHOP, -QUEEN, -KING, -BISHOP, -KNIGHT, -ROOK]
]
class ChessException < Exception
ERR_INVALID_INPUT = 'Invalid input!'
ERR_NO_PIECE_HERE = 'No piece at this location'
ERR_NOT_VALID_PIECE = 'Not a valid piece'
ERR_MOVE_OFF_BOARD = "Move is off the board."
ERR_MOVE_INVALID = "Not a valid move for this piece."
ERR_PIECE_NOT_IMPLEMENTED = 'This piece isnt defined yet =('
end
end
#g = Chess::Game.new
#g.play