Commit Graph

13 Commits

Author SHA1 Message Date
Freezed 043d088405 🔀 Merge branch '2-techtest'
Print the state of a sand `pile` after droping `n` sand grain on top of it.

* Sand pile is a square table of uneven size (viewed from up)
* Sand grain is always dropped on center of pile
*  When a cell had 4 grains inside, these grains moves on the near 4th cells
*  Grains going out the pile are losts
2020-07-16 13:07:58 +02:00
Freezed 0bd7ff72b0 Refactor propagation in a function
That's better! I want more test cases to check my algorythm !
2020-07-16 12:37:47 +02:00
Freezed 2119783dad Update neighbors cells
Propation is right for small iteration and/or pile with low grain rate.
For pile with high grain rate, the main while loop is not enough to make propagation
in all cells
2020-07-16 12:11:13 +02:00
Freezed eebd2751fe Update only drop cell
Structure for pile walking to find cells greater than 3 is set

I do not update neighbors cells, then only central value of the pile (where the
sand grain is dropped) is at the right value in the end
2020-07-16 12:11:13 +02:00
Freezed ff479a6fe2 Change approach global instead local
1st idea was to manage propagation cells after cells. But this looks to generate
a chain reaction that I cannot manage in a function.

New idea is to manage the whole pile :
* add a grain
* find cells that reached 4
    * change cell & update neighbors
* find cells that reached 4
    * change cell & update neighbors
2020-07-16 12:11:13 +02:00
Freezed 7a8a0945c6 Drop sand grains without propagation 2020-07-16 12:11:13 +02:00
Freezed 9bf58c7cef Find id for pile center 2020-07-16 12:11:13 +02:00
Freezed cb3c5623ae Add specs for `sand_grain_drop.py` 2020-07-16 12:11:13 +02:00
Freezed 5471f30e97 Update tests : deliverable 2020-07-16 09:26:15 +02:00
Freezed fbdc3815e7 Join strings into one with right separation 2020-07-16 09:20:12 +02:00
Freezed d09dcc6b63 Split strings groups in a list 2020-07-16 09:14:33 +02:00
Freezed c14c31cde6 Remove spaces in string 2020-07-16 09:01:39 +02:00
Freezed 7a7c0b9661 Add specs for `reorganize_string.py` 2020-07-16 08:10:21 +02:00