So I was write as I suspected; the grid is not actually being built like
I thought it was. Sure the ID's print fine but when the grid positions
are procedurally accessed the program fails with IndexError.
python3 test1.py
| 19 | 5 | 5 | 5 |
| 11 | 6 | 19 | 11 |
| 6 | 6 | 11 | 19 |
| 11 |
Now I have the output that I expect and procedurally they output matches
the id of the Node/Tile. But I am thoroughly confused as to why my by_id
functions use the opposite grid to get the correct output?
# Output
python3 test1.py
| 6 | 20 | 19 | 11 | 11 | 20 | 5 | 11 |
| 20 | 19 | 20 | 11 |
I fixed the other functions to again work as expected. But the
procedural access of the self.grid and self.transposed_grid also
function correctly. That is good because now I can again do lookups if I
need to. Although I do not have a need to at this time.
Can anyone see anything wrong with th
On 12/01/2015 19:35, WolfRage wrote:
So I was write as I suspected; the grid is not actually being built like
I thought it was. Sure the ID's print fine but when the grid positions
are procedurally accessed the program fails with IndexError.
python3 test1.py
| 19 | 5 | 5 | 5 |
| 11 | 6 | 19
On 12/01/15 20:28, WolfRage wrote:
anyone has any improvements or things to think about, I would love to
hear it.
Sorry, no time to read the detail, but one thing I thought might be
handy is to convert the draw method to return a string and make it the
__str__methodf of the grid.
Then the d
I haven't looked carefully at your code but there's always a smell in
Python when you see structure[x][y]. Can you change the grid so you
always write something like:-
for row in grid:
for cell in row:
process(cell)
I say this as I'm all for short term pain, long term gain, esp
On 01/12/2015 05:00 PM, Alan Gauld wrote:
Sorry, no time to read the detail, but one thing I thought might be
handy is to convert the draw method to return a string and make it the
__str__methodf of the grid.
Then the draw method becomes print(self)
And you can also just use print(aGrid) etc.
On 01/12/2015 05:00 PM, Alan Gauld wrote:
__str__methodf of the grid.
Then the draw method becomes print(self)
And you can also just use print(aGrid) etc.
Implemented with some other improvements using the same idea but applied
to several of the other functions, that provide output.
Now I
Updated the code to now allow for a fill_rows optional argument for
Grid, that determines how many rows are filled with values.
I have also added some experimental code to invert the dropping, as in
all of the values can float to the top. Other code is even more
experimental and not yet working