Is there a way to run a simulation in python arcade while still updating the graphics and keeping the buttons active

52 views Asked by At

I am creating a AI backgammon bot and have written some code using an arcade to show the board, pieces, etc. I have a function that will run a simulation game between two versions of the AI. When I use a button that advances the game by one turn, the code will run and I will see the results of the turn displayed on the board. (The on_draw method calls the draw_board(MainBoard) function to draw the current board which is updated by the function that makes the AI move.) I want to be able to similarly see all the moves in the game when I run the run_game() function. I do not have any fancy move animations, just want to draw a the current board between each move in the game. Is there any way to do this?

basically what I want:

while not game_over:
    make_move()
    on_draw() #This does not work, but is there some way to manually get the screen to update outside of the on_draw function?

Additionally, although this may be harder/not possible. Is there a way to keep the application responsive while the simulation is happening (using multiprocessing or some such thing) so I could have a stop button?

I hope this is not too confusing.

0

There are 0 answers