Pytorch AI Game Adding Cost Display
Автор: Stephen Blum
Загружено: 2026-02-25
Просмотров: 53
Описание:
Today our goal is to add levels to the AI game and put a text output on the screen to show how the AI is training. The game is an AI chase game where the goal is to run away from the AI. I want to put AI stats in the top right corner, so we need to create some small text with a mono font for the status. The losses list needs to be part of the AI object, so I set losses to an empty list there.
We are going to render this as text, blit it to the screen, and make sure it appears in the right spot, using the width of the text and screen. I had to tweak the code to get the float formatting right and to make the color readable. There was a bug where the loss was showing as increasing instead of decreasing, but after checking the loss calculation and making sure we were not dividing by zero and not appending loss twice, it worked.
Now the AI’s learning status updates on the top right of the screen as it plays, and you can easily see if the AI is improving or not.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: