0
How can i write 8×8 matrix chess with rooks in c#
How can i write a matrix of 0's and 1's (1's denoting a rook and there will be 8 rooks), the position of which is defermined by random numbers, where the rooks are placed that they dont attack each other.
2 Respostas
0
The queens problem is a fun one! One that you'll have to do by yourself unless you can provide some code. Its a project in python and Im sure its even more in c#
https://code.sololearn.com/cEJ1wk1pGXpm/?ref=app
0
It sounds like you want an 8 by 8 array of int.
Here is some pseudocode for an algorithm you could implement with c#:
Fill the array with 0's.
Then loop 8 iterations.
while true:
find a random x, y coordinate in range 0..7.
if the array[x, y] is not 1,
array[x, y] = 1
break while-loop.
I don't understand the "they dont each other." A word must be missing there. The above assumes you just mean to say overlap each other as in they have distinct positions.