King Move | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita

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 - avatar
2 Respuestas
+ 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 - avatar
Thanks! :D
31st Jan 2021, 10:41 PM
Ailana - avatar