JamesDevJim / game-zulu

First game of the coolest project
0 stars 1 forks source link

Structure of calling python code from a python process using subprocess #3

Closed shuttle1987 closed 4 years ago

shuttle1987 commented 4 years ago

I'd be interested in knowing what this is aiming to achieve:

https://github.com/JamesDevJim/game-zulu/blob/4b46243499803992d0ef07bb856fb49bb8f72240/game_changer.py#L20-L30

We already have a Python process so using Python to spawn a new Python process to run Python code seems to be much better done via other means, there's better ways of running Python code from within Python processes. However the specifics of what I'd suggest would depend a bit on what this is trying to achieve (imports vs exec vs other approaches).

JamesDevJim commented 4 years ago

The intent is, when playing game #1 (game zulu) if the player wins, then run game #2, if the player loses go back to game #1.

I'm guessing the better way to do this is to create sometype of main.py that will be the traffic controller and always run?

The current method of doing this is painful as when you win or lose a game, you have to wait for python to load an entire game from scratch.

shuttle1987 commented 4 years ago

Create an entry point for each game, then import that entry point and just run the function. You may need to refactor a few things to make this work painlessly

shuttle1987 commented 4 years ago

So when you lose a game do you go back one game or all the way back to the start?

JamesDevJim commented 4 years ago

If you lose, you go back to game 1. Back to the start

On Mon, Feb 24, 2020 at 1:20 AM Janis Lesinskis notifications@github.com wrote:

So when you lose a game do you go back one game or all the way back to the start?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/JamesDevJim/game-zulu/issues/3?email_source=notifications&email_token=AKQABVK2UMVUK3VW2IU24KDREOGNJA5CNFSM4KZZ7FR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMXDBDY#issuecomment-590229647, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKQABVKS4MDEHWFLTIQTOGDREOGNJANCNFSM4KZZ7FRQ .

-- James L. Bell, EIT, CEM, LEED Green Assoc.

M: 781 913 5892 | E: Jamesleonbell@gmail.com www.linkedin.com/in/jamesleonardbell/