EmilZach / Sentence-Crusher

A Python game for crushing sentences.
0 stars 1 forks source link

Pass user_name to new_game() using parameter #8

Closed Arxcis closed 8 years ago

Arxcis commented 8 years ago

This issue is not relevant anymore after switch to object-oriented data handling.

raglew commented 8 years ago

Have to reopen this issue. User name isn't being registered when same user restarts a new game.

Arxcis commented 8 years ago

Ill look into it

  1. mar. 2016 8.57 p.m. skrev "raglew" notifications@github.com:

Reopened #8 https://github.com/EmilZach/Sentence-Crusher/issues/8.

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/EmilZach/Sentence-Crusher/issues/8#event-604582916

Arxcis commented 8 years ago

The reason is here -->> https://github.com/EmilZach/Sentence-Crusher/blob/master/Game/main.py#L29-L35

User name is stored before the While-loop. After each while -loop all data gets reset. Even the name is deleted from DataGuy()

  1. mar. 2016 9.13 p.m. skrev "JoJo" jonas.solsvik@gmail.com:

Ill look into it

  1. mar. 2016 8.57 p.m. skrev "raglew" notifications@github.com:

Reopened #8 https://github.com/EmilZach/Sentence-Crusher/issues/8.

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/EmilZach/Sentence-Crusher/issues/8#event-604582916

Arxcis commented 8 years ago

*from data-object

  1. mar. 2016 9.38 p.m. skrev "JoJo" jonas.solsvik@gmail.com:

The reason is here -->> https://github.com/EmilZach/Sentence-Crusher/blob/master/Game/main.py#L29-L35

User name is stored before the While-loop. After each while -loop all data gets reset. Even the name is deleted from DataGuy()

  1. mar. 2016 9.13 p.m. skrev "JoJo" jonas.solsvik@gmail.com:

Ill look into it

  1. mar. 2016 8.57 p.m. skrev "raglew" notifications@github.com:

Reopened #8 https://github.com/EmilZach/Sentence-Crusher/issues/8.

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/EmilZach/Sentence-Crusher/issues/8#event-604582916

Arxcis commented 8 years ago

After each while-loop we have to reset all data except player name.

raglew commented 8 years ago

How do you get that link to main.py with the particluar section marked out? That's cool.

raglew commented 8 years ago

What about: if continue_game == Y then store D.user in a variable: do the game data reset, and then set D.user = variable.

Arxcis commented 8 years ago

Yes thats a solution. But another solution is go into DataGuy() -class, and maybe make a reset-method. Which only resets the data we want to reset, leaving the rest of the data untouched.

  1. mar. 2016 10.01 p.m. skrev "raglew" notifications@github.com:

What about: if continue_game == Y then store D.user in a variable: do the game data reset, and then set D.user = variable.

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/EmilZach/Sentence-Crusher/issues/8#issuecomment-202136878

raglew commented 8 years ago

That would be an even better solution: instead of D.init() in line 64 of main.py, call a reset method that is basically the same as def init(self) in the DataGuy class, but modified not to change D.user.

Arxcis commented 8 years ago

Yes , excactly. We reset-method can hold data that changes every new-game. And the init-method can hold data that sticks around.

  1. mar. 2016 10.16 p.m. skrev "raglew" notifications@github.com:

That would be an even better solution: instead of D.init() in line 64 of main.py, call a reset method that is basically the same as def init(self) in the DataGuy class, but modified not to change D.user.

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/EmilZach/Sentence-Crusher/issues/8#issuecomment-202139880

raglew commented 8 years ago

Who wants to implement?

EmilZach commented 8 years ago

Doesn't matter for me. I can fix the issue if people wants to

raglew commented 8 years ago

Thanks Emil :)

EmilZach commented 8 years ago

No problem :-)

EmilZach commented 8 years ago

Is this what you wanted? Let me know if I should change anything.

Arxcis commented 8 years ago

Its works perfect. I changed it a bit more though, since you don't have to define all those variables TWICE in DataGuy(). Once is more than enough ;)