11-30-2020, 02:42 PM
(This post was last modified: 11-30-2020, 02:45 PM by dale walton.)
1. When a single piece is placed, (in the corner or anywhere else ) placement of a hex should not be available on any line of sight from it. However when I place in the corner, I find that instead, that at a certain distance along the diagonal, sites become available for placement. Why is that? This is my main question. Is it a bug you will fix, or is my code incorrect? If my code is incorrect, what is wrong with it? (not how to simplify it)
2. The reason the code is as complicated as it is, is that in the rules of the game that it is part of, when multiple pieces are in play, Hexes can also be placed on lines of site from other pieces. -- But only if, one selects the first piece found along the site line in each direction, determines which is/are closest, and counts the ownership of those closest pieces to determine which player owns more of them, and the result is that those closest pieces are owned equally by both players.
ie iff the placement site is equidistant from the same number of enemies and friends along the lines of sight, where that common distance is equal to the distance to the closest piece.
3. In the actual game the other sites can receive a different type of piece, but I simplified the code for you so as to focus on the problem of the unexpected behavior that I found.
2. The reason the code is as complicated as it is, is that in the rules of the game that it is part of, when multiple pieces are in play, Hexes can also be placed on lines of site from other pieces. -- But only if, one selects the first piece found along the site line in each direction, determines which is/are closest, and counts the ownership of those closest pieces to determine which player owns more of them, and the result is that those closest pieces are owned equally by both players.
ie iff the placement site is equidistant from the same number of enemies and friends along the lines of sight, where that common distance is equal to the distance to the closest piece.
3. In the actual game the other sites can receive a different type of piece, but I simplified the code for you so as to focus on the problem of the unexpected behavior that I found.