def knightsjump(square): Knights Jump Knights can jump across the board. Knights in…
- User
def knights_jump(square):
Knights Jump Knights can jump across the board.
Knights in Chess
Create a function that takes a square where a knight jumps from as a string and returns all the possible squares the knight can land on as a string. Ignore capturing and further Chess rules. Be aware of the sides of the board. Knights don't go over the edge, obviously.
Examples knights_jump("F4") ➞ "E2,G2,D3,H3,D5,H5,E6,G6"
knights_jump("A1") ➞ "C2,B3"
knights_jump("E2") ➞ "C1,G1,C3,G3,D4,F4" Notes The input is always a valid square on the board. The order of the return string is 1 ➞ 8, A ➞ H. in python
Assistant
python
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.