[Resolved] Breadth first search on a chessboard

Hi,

Im trying to create a chessboard where i want to search all squares one step away from every piece on the board and return the free squares. But i dont want to search the diagonal squares.

Something like this: Where [_] is a free square and X is the piece
…[_]
[_] X [_]
…[_]

Im pretty sure its some kind of breadth first search but i have no idee how to do it.

How should I create that function? [import]uid: 126729 topic_id: 29468 reply_id: 329468[/import]

This has nothing to do with a breadth first search. That’s really a concept for much larger datasets.

I don’t think anybody can write this function for you. If your program were built to the point where it would make sense, the solution would be trivial. [import]uid: 157797 topic_id: 29468 reply_id: 118719[/import]

I solved it right after I posted the thread.
You were right, the solution was much simpler than i first imagined. :slight_smile:

[import]uid: 126729 topic_id: 29468 reply_id: 118724[/import]