5 kyu
Chess Fun #9: Bishops And Rooks
215 of 405myjinxin2015
Description:
Task
You are given a chessboard
with several rooks
and bishops
placed on some of its squares. How many unoccupied squares are there that are not under attack of any chess piece?
Here, the standard rules are applied: a square is under attack of a rook or a bishop only if all squares between the piece and the current square are unoccupied.
Input/Output
[input]
integer arraychessboard
matrix of size 8x8
containing numbers {-1, 0, 1}
which represents chess pieces placement:
-1 -> bishop, 0 -> empty square, 1 -> rook
[output]
an integer
number of safe squares on the board.
Puzzles
Similar Kata:
Stats:
Created | Feb 15, 2017 |
Published | Feb 15, 2017 |
Warriors Trained | 1366 |
Total Skips | 92 |
Total Code Submissions | 1706 |
Total Times Completed | 405 |
JavaScript Completions | 112 |
C# Completions | 64 |
Python Completions | 215 |
C Completions | 31 |
D Completions | 4 |
Rust Completions | 15 |
COBOL Completions | 3 |
Lua Completions | 8 |
Total Stars | 41 |
% of votes with a positive feedback rating | 96% of 108 |
Total "Very Satisfied" Votes | 100 |
Total "Somewhat Satisfied" Votes | 7 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 5 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |