Checkmate - MATLAB Cody - MATLAB Central

Problem 45238. Checkmate

Difficulty:Rate
  • The positions of different chess pieces are given in a cell p .
  • The position of the king is given as x

Determine if the opponent king is in check for individual scenerios.

  • x='Kg7'
  • p={'Qe5','Qg5','Qb5','Qa7'}

output= [1,1,0,1]

N.b.any invalid position should produce 0. u may imagine p as the white pieces and x as the black king for clarity.

Solution Stats

52.94% Correct | 47.06% Incorrect
Last Solution submitted on Jan 24, 2025

Problem Comments

Solution Comments

Show comments

Group

Guess the Logic! Image
Guess the Logic!
  • 17 Problems
  • 241 Finishers

Problem Recent Solvers9

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page