10-06-2020, 04:32 AM
Currently I have some code that selects all spaces and decides what piece to play based on the criterion of how many of each player's pieces are at the same distance as the nearest piece from the targeted empty location. It is very slow, and it fails when there are selected locations that do not meet the criterion. (The program is showing them as choices for selection, even though there is no subsequent board action)
To solve that I need to select for just the sites I actually want to place on, instead of filtering at the end. But to do this requires procedural steps within the select construct. (and probably nested forEach Site constructs)
Thus, I would appreciate a ludeme for finding the distance to the nearest piece from a site in any grid direction, (w/ options for limiting it to other directions.)
An option for (count ...) for counting components of a particular type at a particular distance and a particular set of directions would also be much appreciated.
To solve that I need to select for just the sites I actually want to place on, instead of filtering at the end. But to do this requires procedural steps within the select construct. (and probably nested forEach Site constructs)
Thus, I would appreciate a ludeme for finding the distance to the nearest piece from a site in any grid direction, (w/ options for limiting it to other directions.)
An option for (count ...) for counting components of a particular type at a particular distance and a particular set of directions would also be much appreciated.