Commit Graph

291 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 f4c4f9fcb3 🔀 Merge branch '1-techtest'
Reorganize a `string` by :
*  removing spaces
*  groups it by `n` characters
*  separated by `sep`
2020-07-16 13:06:24 +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
Freezed 85df8b487f Merge branch 'xkcd-pwd' into 'master'
Xkcd password

A password generator a suggested by : https://xkcd.com/936/

See merge request free_zed/mypsb!1
2020-03-10 20:19:28 +00:00
Freezed dc5e4d720b Add password generator 2020-03-09 23:06:14 +01:00
Freezed c188ae6f33 Update .gitignore 2020-03-09 22:54:05 +01:00
Freezed 490e98c308 Testing __init__ method in a Class 2019-09-22 17:39:48 +02:00
Freezed 794c197ce3 Add script `resize_b64_str.py`
Resize an image provided in  a Base64 string
2019-09-06 15:47:54 +02:00
Freezed 2f9a4b8aaa Reorganise repo 2019-09-06 15:46:11 +02:00
Freezed 2b3b0f93ad Update README 2019-09-06 15:45:43 +02:00
Fred Z dfeff7a50c Replaces doctests test by pytest tests 2018-08-14 23:58:02 +02:00
Fred Z 85eb74ba5f Adds some code to play with pytest 2018-08-14 23:57:34 +02:00
Fred Z 2818543f83 Tests simple implementation of PyMySQLb 2018-08-04 08:16:20 +02:00
Fred Z d7fd69619f Tests kwargs in a function 2018-08-04 08:13:36 +02:00
Fred Z 5db5dcaae4 Update README.md 2018-03-15 10:36:50 +01:00
Fred Z 7c4d429613
Updade roadmap & pause announce 2018-03-14 10:52:56 +01:00
Fred Z 30de5f8096 Starts modif gameplay to multiplayer/network mode
I am pausing the devel here, I have to prioritise another project.
Doctests seems to be obsolete for testing network scripts.
I'll be back with Pytest!
2018-03-14 10:40:44 +01:00
Fred Z 579bf24c17 Updates maps for multiplayer (remove robot letter) 2018-03-14 10:40:44 +01:00
Fred Z 367750b9c4 Adds `data_filter()` to sanitize username 2018-03-14 10:40:19 +01:00
Fred Z 851b618ff7 Pylint check and clean 2018-03-14 10:40:19 +01:00
Fred Z a14ef683cb Export template's message from `server_log()`
In order to use this method in the whole class.
Update `__init__()` & `close()` to use `server_log()`. NO MORE `print()`
in this class ;-)
2018-03-14 10:40:19 +01:00
Fred Z 703380ded6 Refactors `listen()` about log, broadcast & send
Adds `server_log()` method in order to export the `print()` calls.
Centralize _log_, _broadcast_ & _send_ operations in the bottom of the
loop  (except when sockets needs to be close).
I think it is improves readability and will facilitate code evolution,
for example when writing the servers log in file(s).
2018-03-14 10:40:19 +01:00
Fred Z f90a1a38d5 Refuses client connection beyond a certain number
FIX TODO19: add max player number
2018-03-14 10:40:19 +01:00
Fred Z 44514971ef Ajusts messages to clients in waiing-room 2018-03-14 10:40:19 +01:00
Fred Z 7708781e29 Checks player name in `listen()`
Adds length limit
Fix TODO17: verify if user name is already used
2018-03-14 10:40:19 +01:00
Fred Z c075c17172 Improves `broadcast()`: linked to `list_sockets()`
Now sends messages only to named-client, and for that uses
`list_sockets()`

Takes sender name from `_user_name` attribute and delete the name
argument from the method
2018-03-14 10:40:19 +01:00
Fred Z 1c5366beb5 Refactors `count_clients()` & `list_sockets()`
`list_sockets()` uses only clients with a name already typed in
(filled in `_user_name` attribute), to avoid starting a game with not
named player

`count_clients()` was too messy and autonomous, now it uses
`list_sockets()` for counting only named players and not depend on
naming player mechanism or main socket.# Veuillez saisir le message de
validation pour vos modifications. Les lignes
2018-03-14 10:40:18 +01:00
Fred Z dfaee27cc4 Fixes 2 syntax errors caused by fatigue
Forget to:
- rename the import instruction after renaming the file
- instance the map object after exporting it from the function
2018-03-14 10:40:18 +01:00
Fred Z 7633dd0f1f Update TODO: add max player number TODO19 2018-03-14 10:40:18 +01:00
Fred Z 1446a49df6 Update README.md 2018-03-14 10:40:18 +01:00
Fred Z 2df0513d89 Rename Map instance according GAME_NETWORK style 2018-03-14 10:40:18 +01:00
Fred Z c7096ee757 Export Map instanciation in parent script
More readable and easier for adding multiplayer feature in the Map object
2018-03-14 10:40:18 +01:00
Fred Z 99ed30197c list_sockets(): return name in place of peername
Previous instructions do not work as expected, and finally I just need
user name to identify the clients connected, not connection parameters
2018-03-14 10:40:18 +01:00
Fred Z a501fd69bb Add the waiting-room-loop before game begining 2018-03-14 10:40:18 +01:00
Fred Z 5047c993a8 listen(): Use attribute, no more tuple return 2018-03-14 10:40:18 +01:00
Fred Z 7722ae368e broadcast(): Export string in a constant 2018-03-14 10:40:18 +01:00
Fred Z 2f024b5d0a count_client(): use client with a filled username 2018-03-14 10:40:18 +01:00
Fred Z ddf9d57d38 Syntax update in TODO 2018-03-14 10:40:18 +01:00
Fred Z b659d0ff7f Using the network to wait & connect client
Crash when MIN_CLIENT_NB is reached
2018-03-14 10:40:18 +01:00