Re: Earwax

@153, Oh, oopsy, I missed that.
Okay, so now that I have a bit more time, I'll address your questions as to the boards. The way I see it, you're doubling up on the information in the class. You have the points and tiles. I could easily do this:

for row in range(board.size.x):
    for column in range(board.size.y):
        #I can do one more loop for z, but I would just access the tiles like so: board.tiles[x][y][z?]

This is, in fact, what your get_tile function does, it just accepts a point as a parameter. It never uses populated_points beyond instantiation and extension when new tiles are added. I see little use for this, but perhaps you can elaborate on this? Why wouldn't the tiles work for snakes and ladders?
Re, updating the board. If a tile is empty or has been moved to a new side of the board, the point with the old coordinates will be invalid, hence the need for double update.
Regarding a call to populate. I honestly would remove the call in __attrs_post_init__ as it causes confusion. An example of this is as follows (Guess how I know about this?):

#In some class:
self.total_tile_count: int = 0
self.max_tiles: int = 0
def __attrs_post_init__(self):
    #Populate gets called here
    super().__init__()
    self.max_tiles = self.size.x * self.size.y

def populate(self) -> bool:
    if self.total_tile_count >= self.max_tiles:
        return False
    #Stuff

This presents an interesting issue, one which is not so obvious at a brief glance: Your max_tiles is 0 when populate gets called. As such, since the total_tile_count variable is 0, the if condition is triggered and the function fails, leaving you with an empty board. However, if you remove the call to populate in the base class, you would remove the confusion and make the user call populate when they absolutely know that their data is complete. I stumbled into that and was very very confused when printing variables because they appeared to magically reset only for the initial function call.
Your board is also semi-specific. I feel like it could work for games similar nature to lucky thirteen, but take monopoly, for instance. You reserve a list for the third dimention regardless of game type. I myself, for instance, am building a game which takes place on a 2d matrix only, and having to do self.tiles[x][y][0] looks like it overcomplicates the way the data is stored. You also assume that the board is going to always be full at the start of the game, which is not the case. Take 2048, for example. The game starts with 1 empty tile and progressively adds more as the game progresses. With your board, one must write a dummy tile builder function, something like

lambda p: []

, and then go through and place what the board starts with. Finally, if my board was unique, I'm going to go back to the monopoly example, I can't imagine using your game board class to store the objects because the tile builder function would have to have some sort of a state to hang onto in order to progressively feed populate with new data. I might as well override methods on the class and do it by hand.
Finally, concerning negative coordinates. The reason why I was raising this issue is for the fact that, you're right, I would typically handle this in code. However, I have yet seen a board which employs negative indexes. Most of the games I've made concerning this genre either complained about negative indexes because -1 is not next to 0. Besides, if the board raises an exception for negative values, your fetch_neighbors function would just be a loop through all valid directions trying to read a tile at the current position wrapped in a try/except block. If you have personally relied on negative indexes do let me know, I'm vaguely curious.
That all being said, I still like the GameBoard class, I just think it is aimed at a specific board game genre rather than try to adopt for general use. Take what I write with a grain of salt -- probably a lot of it -- because like I said, the class does come with support for stacks of tiles like in Lucky Thirteen or Backgammon.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : BoundTo via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector

Reply via email to