cmdpet / cmd-pet

the command line pet
https://cmdpet.github.io/cmd-pet/
GNU General Public License v3.0
6 stars 4 forks source link

Mainly changed threading behaviour #9

Closed melodicht closed 4 years ago

melodicht commented 4 years ago

There was a bug before where the thread would not close properly when the pet died from the stats decreasing below the minimum threshold. This is caused by the fact that the thread is responsible for detecting this, and thus calls the join() function, which then leads to an error.

Instead, the thread stops when the the is_alive state is False, and the choose_action() also responds to this and lead the game manager to the shut_down() method.

Note that the former die() function is now the end() function since this function is also called when the pet is transferred.