In this problem I am going to make an 11 x 11 chess board out of cartesian plane.The positions on the board will be coordinates (x,y) where
0<= x <= 10
0 <= y <=10,and
x,y are integers
We will consider two different chess pieces: rooks and bishops.
A rook may move either horizontally or vertically.It may move any no of the spaces in a straight line,so long as it does not run into another piece on the board.Each location that the rook can move to is considered 'under control'. A bishop is similar ,except that it moves diagonally, instead of horizonaly and vertically.Similarly the places that a bishop can move to is considered "under control".
I am trying to code a program which will calculate the no of positions collectively "under control"
The following should be the input:
A string array consisting of [1-50] elements of the form 'xyL" where L is either Rook of Bishop and x & y indicate the row and coloumn positions respectively.
Example:
{"0 0 Rook"}
Returns:
20
a rook in the lower corner controls 20 squares.Each controlled square has the form (0,y) or (x,0) with exception of (0,0) ,which is the position of the rook.
{"0 0 Bishop"," 1 1 Rook"}
Returns:20
The Rook blocks the path of the bishop
Now I am considering a n x n chessboard. and specify the position of rook and bishop accordingly. The program will show the corrosponding blocking state between them
:hap2:
0<= x <= 10
0 <= y <=10,and
x,y are integers
We will consider two different chess pieces: rooks and bishops.
A rook may move either horizontally or vertically.It may move any no of the spaces in a straight line,so long as it does not run into another piece on the board.Each location that the rook can move to is considered 'under control'. A bishop is similar ,except that it moves diagonally, instead of horizonaly and vertically.Similarly the places that a bishop can move to is considered "under control".
I am trying to code a program which will calculate the no of positions collectively "under control"
The following should be the input:
A string array consisting of [1-50] elements of the form 'xyL" where L is either Rook of Bishop and x & y indicate the row and coloumn positions respectively.
Example:
{"0 0 Rook"}
Returns:
20
a rook in the lower corner controls 20 squares.Each controlled square has the form (0,y) or (x,0) with exception of (0,0) ,which is the position of the rook.
{"0 0 Bishop"," 1 1 Rook"}
Returns:20
The Rook blocks the path of the bishop
Now I am considering a n x n chessboard. and specify the position of rook and bishop accordingly. The program will show the corrosponding blocking state between them
:hap2: