Commit Graph

280 Commits

Author SHA1 Message Date
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
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
7a8a0945c6 Drop sand grains without propagation 2020-07-16 12:11:13 +02:00
9bf58c7cef Find id for pile center 2020-07-16 12:11:13 +02:00
cb3c5623ae Add specs for sand_grain_drop.py 2020-07-16 12:11:13 +02:00
c188ae6f33 Update .gitignore 2020-03-09 22:54:05 +01:00
490e98c308 Testing __init__ method in a Class 2019-09-22 17:39:48 +02:00
794c197ce3 Add script resize_b64_str.py
Resize an image provided in  a Base64 string
2019-09-06 15:47:54 +02:00
2f9a4b8aaa Reorganise repo 2019-09-06 15:46:11 +02:00
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
Fred Z
1451c5ff36 Clean up and document __init__ method 2018-03-14 10:40:18 +01:00
Fred Z
91c5bdb761 Clean up the code a little bit 2018-03-14 10:40:18 +01:00
Fred Z
ffe3023b4d Adding methods: listen connection & brobdcast msg 2018-03-14 10:40:18 +01:00
Fred Z
7b9128c3b2 Update TODO
- verify if user name is already used TODO17
- ordering a bit
2018-03-14 10:40:18 +01:00
Fred Z
a0598d3599 Create client
DONE TODO03
2018-03-14 10:40:18 +01:00
Fred Z
03cbd5474d Add network/connection Class
Create a socket object for opening the server connection with some mehods:
-__init__()
- close()
- list_sockets()
- count_clients()
2018-03-14 10:40:18 +01:00
Fred Z
315e7f9537 Create server, and remove backup feature
DONE TODO01
DONE TODO02
2018-03-14 10:40:17 +01:00
Fred Z
f903089686 Roadmap to next exercice: multiplayer & network 2018-03-14 10:40:17 +01:00
Fred Z
7b6953a948 Corrige la syntaxe: audit pyLint 2018-03-14 10:40:17 +01:00
Fred Z
0779b0b5c7 Transforme des TODO en issue 2018-03-14 10:40:17 +01:00
Fred Z
78be5f0877 Clean closing socket with <ctrl+c> 2018-03-05 23:14:40 +01:00