0

King Move

The program receives the input of four numbers from 1 to 8, each specifying the column and row number, first two - for the first cell, and then the last two - for the second cell. The program should output YES if a king can go from the first cell to the second in one move, or NO otherwise. can anyone plz explain to me what equation to use but don't give me an answer please!

31st Jan 2021, 10:20 PM
Ailana
Ailana - avatar
2 ответов
+ 1
you need to determine if both cells are direct neighboors of each others (|dx|==1 or |dy|==1)
31st Jan 2021, 10:29 PM
visph
visph - avatar
0
Thanks! :D
31st Jan 2021, 10:41 PM
Ailana
Ailana - avatar