예제 #1
0
파일: a3.py 프로젝트: dazhuoge/pythonGame
    def animate(self, steps, callback=lambda: None):
        """Animates some steps (i.e. from selecting some dots, activating companion, etc.
        
        Parameters:
            steps (generator): Generator which yields step_name (str) for each step in the animation
        """

        if steps is None:
            steps = (None for _ in range(1))

        animation = create_animation(self._master, steps,
                                     delays=ANIMATION_DELAYS, delay=DEFAULT_ANIMATION_DELAY,
                                     step=self._animation_step, callback=callback)
        animation()
예제 #2
0
def app():
    st.markdown(
        """
        # Single Bot Race

        **Now it's time to race**!!!

        Click the button below to generate and show the outcome of a single Bot race.
        """
    )

    if st.button("Run Race"):
        bots = util.build_all_bots()

        game = Game(bots, use_trace=True, verbose=False)
        while game.winner is None:
            game.play_round()

        fig = util.create_animation(game.trace_df)
        st.plotly_chart(fig, use_container_width=True)