Submitted by: Mohammad Sajid Anwar
You are given coordinates, a string that represents the coordinates of a square of the chessboard as shown below:
Write a script to return true if the square is white, and false if the square is black.
Input: $coordinates = "d3"
Output: true
Input: $coordinates = "g5"
Output: false
Input: $coordinates = "e6"
Output: true
Submitted by: Peter Campbell Smith
A knight in chess can move from its current position to any square two rows or columns plus one column or row away. So in the diagram below, if it starts a S
, it can move to any of the squares marked E
.
Write a script which takes a starting position and an ending position and calculates the least number of moves required.
Input: $start = 'g2', $end = 'a8'
Ouput: 4
g2 -> e3 -> d5 -> c7 -> a8
Input: $start = 'g2', $end = 'h2'
Ouput: 3
g2 -> e3 -> f1 -> h2
Last date to submit the solution 23:59 (UK Time) Sunday 11th August 2024.