Skip to content

Commit

Permalink
parabellum
Browse files Browse the repository at this point in the history
  • Loading branch information
syrkis committed Jul 7, 2024
1 parent 2cfa199 commit b6de227
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions ludens.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"2024-07-07 11:05:57.124 python[56985:875363] ApplePersistence=NO\n"
"2024-07-07 16:37:48.299 python[66039:1017127] ApplePersistence=NO\n"
]
}
],
Expand Down Expand Up @@ -47,12 +47,10 @@
"outputs": [],
"source": [
"state_seq = []\n",
"for i in range(30):\n",
"for i in range(100):\n",
" rng, act_rng, step_key = random.split(rng, 3)\n",
" act_key = random.split(act_rng, len(env.agents))\n",
" actions = {\n",
" a: 0 * env.action_space(a).sample(k) for a, k in zip(env.agents, act_key)\n",
" }\n",
" actions = {a: env.action_space(a).sample(k) for a, k in zip(env.agents, act_key)}\n",
" state_seq.append((step_key, state, actions))\n",
" obs, state, reward, done, info = env.step(step_key, state, actions)"
]
Expand All @@ -66,7 +64,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"240it [00:04, 56.24it/s] \n"
"800it [00:14, 56.05it/s] \n"
]
},
{
Expand All @@ -90,7 +88,15 @@
"output_type": "stream",
"text": [
"Moviepy - Done !\n",
"Moviepy - video ready output/parabellum.mp4\n"
"Moviepy - video ready output/parabellum.mp4\n",
"MoviePy - Building file output/parabellum.gif with imageio.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
" \r"
]
}
],
Expand Down
Binary file modified output/parabellum.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion parabellum/vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def animate_one(self, state_seq, action_seq, save_fname):
# save the images
clip = ImageSequenceClip(frames, fps=48)
clip.write_videofile(save_fname, fps=48)
# clip.write_gif(save_fname.replace(".mp4", ".gif"), fps=24)
clip.write_gif(save_fname.replace(".mp4", ".gif"), fps=24)
pygame.quit()

def render_agents(self, screen, state):
Expand Down

0 comments on commit b6de227

Please sign in to comment.