-
Notifications
You must be signed in to change notification settings - Fork 3
Pieces
The Khet game has 6 types of Pieces
It is the main Piece if it is Destroyed the Game Ends
It can be hit in any direction
this piece cannot move and this piece fires the laser for the player
It cannot be destroyed by laser
It reflects laser by 90 degrees thus can never be destroyed
It can swap itself with any of its adjacent pieces
It can be hit from any direction and gets destroyed
The rotation of this piece doesn't matter cuz it symmetrical about 2 axes
It can be hit in 2 directions and reflects ray in other 2 directions
It can be hit in 3 sides and cannot be hit in its face side and the laser won't pass through if it hits the face side.
All the 6 types have 3 arguments which are passed to its's base class.
playerId, position and rotation
All pieces are sub classes of this Piece Class
it has 4 arguments
it tells about the type of piece
it tells about the owner of this piece
it tells about the current position of the piece
it tells about the amount of rotation is the piece's north from the north of the board
moves the piece to the specified position
rotates the piece by amount
it calculates whether the ray hits the piece or reflects from the piece, if Reflects tells the direction of exit based on board's north
it tells whether or not the piece can Replace other pieces to its position