In continuation with the problem-45236 ... In the previous problem, it was assumed that there were no other chess pieces on the board... Now lets assume there is a number of king present on the board whose location is given in an array p . Now, check for the validity of Queen's moves.
- x={'Qd1','Qh1','Qh8','Qd5','Qg5','Qc5','Qa7','Qf2','Qe7','Qh7'}
- p={'Kd4','Ke5','Kh7','Ke7'}
output=[1,1,0,1,0,1,1,0,0,0]
kindly see this problem for understanding https://www.mathworks.com/matlabcentral/cody/problems/45236-queen-s-move
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers8
Suggested Problems
-
248 Solvers
-
Flag largest magnitude swings as they occur
689 Solvers
-
How many trades represent all the profit?
615 Solvers
-
Removing rows from a matrix is easy - but what about inserting rows?
263 Solvers
-
Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
253 Solvers
More from this Author174
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
This problem claims to be a continuation of problem 45236. Still, it does not assume the first position is always valid, nor is there a default position if the first is invalid.
Rafael, here you also have to check if there is an overlap in the position of the pieces. Two pieces on one position is not allowed and therefore the validity of that piece will be invalid.
You can see this in the example stated in the problem statement.