5 kyu

Chess Fun #9: Bishops And Rooks

219 of 416myjinxin2015

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 array chessboard

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

Stats:

CreatedFeb 15, 2017
PublishedFeb 15, 2017
Warriors Trained1397
Total Skips92
Total Code Submissions1727
Total Times Completed416
JavaScript Completions113
C# Completions65
Python Completions219
C Completions34
D Completions4
Rust Completions18
COBOL Completions3
Lua Completions8
Total Stars42
% of votes with a positive feedback rating95% of 111
Total "Very Satisfied" Votes102
Total "Somewhat Satisfied" Votes8
Total "Not Satisfied" Votes1
Total Rank Assessments5
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • Blind4Basics Avatar
  • hobovsky Avatar
  • trashy_incel Avatar
  • akar-0 Avatar
  • 4500zenja1 Avatar
  • PetitLu117 Avatar
Ad