Here is a condensed version of all of the applicable code but with out Linked List filled in, as I am preparing to re-write it.

class GameTile():
    def __init__(self, id, **kwargs):
        self.id = id

class GameGrid():
    def __init__(self, **kwargs):
        self.cols = 8
        self.rows = 10
        # Each variable below is a link to the head Node in the respective
        # row or column.
        self.row0 = None
        self.row1 = None
        self.row2 = None
        self.row3 = None
        self.row4 = None
        self.row5 = None
        self.row6 = None
        self.row7 = None
        self.row8 = None
        self.row9 = None
        self.col0 = None
        self.col1 = None
        self.col2 = None
        self.col3 = None
        self.col4 = None
        self.col5 = None
        self.col6 = None
        self.col7 = None
        self.skip_to_row = None
        self.skip_to_col = None
        self.tile_list = list()

    def make_linked_lists(self):
        prev_row_node = None
        prev_col0_node = None
        current_node = None
        for row in range(0, self.rows):
            for col in range(0, self.cols):
                for node in self.tile_list:
                    if node.id == str(col) + ',' + str(row):
                        current_node = node


    def update(self):
        for row in range(0, self.rows):
            element = None
            if row < 7:
                pass
            for column in range(0, self.cols):
self.tile_list.append(GameTile(id=str(column) + ',' + str(row)))

    def print_lists(self):
        for node in self.tile_list:
            print(node.id)


temp = GameGrid()
temp.update()
temp.make_linked_lists()
temp.print_lists()
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to