Skip to content

Simulate#3

Merged
sdeming merged 7 commits intomainfrom
simulate
May 24, 2025
Merged

Simulate#3
sdeming merged 7 commits intomainfrom
simulate

Conversation

@sdeming
Copy link
Owner

@sdeming sdeming commented May 24, 2025

Adds functionality to simulate the game without having to run it. This is much faster making it easier to iterate over bot improvements. Also added --seed option to set the random seed for consistent results.

Example:

❯ cargo run -- bots/jojo.rasm bots/jojo.rasm --max-turns 2000 --seed 1337 --simulate
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/botarena bots/jojo.rasm bots/jojo.rasm --max-turns 2000 --seed 1337 --simulate`
15:11:39.980 INFO  botarena: Bot Arena starting...
15:11:39.981 INFO  botarena::game: Arena created with 20x20 grid.
15:11:39.981 INFO  botarena::game: Simulating for a maximum of 2000 turns.
15:11:39.981 INFO  botarena::game: Using deterministic seed: 1337
15:11:39.981 INFO  [R01] botarena::game: Loading and parsing program for Robot 1 (Name: jojo) from file: bots/jojo.rasm
15:11:39.982 INFO  [R02] botarena::game: Loading and parsing program for Robot 2 (Name: jojo) from file: bots/jojo.rasm
15:11:39.985 INFO  botarena::game: Loaded 2 robots.
15:11:39.986 INFO  botarena::game: Particle system initialized.
15:11:39.986 INFO  botarena::arena: Placing 4 obstacles...
15:11:39.986 INFO  botarena::arena: Obstacles placed.
15:11:39.986 INFO  botarena::game: Starting headless simulation...
15:11:40.024 INFO  [R01] botarena::arena: Robot 1 took 6.30 damage, health remaining: 93.70
15:11:40.073 INFO  [R01] botarena::arena: Robot 1 took 10.00 damage, health remaining: 83.70
15:11:40.097 INFO  [R02] botarena::arena: Robot 2 took 6.30 damage, health remaining: 93.70
15:11:40.109 INFO  [R02] botarena::arena: Robot 2 took 6.30 damage, health remaining: 87.40
15:11:40.110 INFO  [R02] botarena::arena: Robot 2 took 6.30 damage, health remaining: 81.10
15:11:40.121 INFO  [R01] botarena::arena: Robot 1 took 10.00 damage, health remaining: 73.70
15:11:40.130 INFO  [R01] botarena::arena: Robot 1 took 10.00 damage, health remaining: 63.70
15:11:40.130 INFO  [R01] botarena::arena: Robot 1 took 6.30 damage, health remaining: 57.40
15:11:40.135 INFO  [R01] botarena::arena: Robot 1 took 6.30 damage, health remaining: 51.10
15:11:40.136 INFO  [R01] botarena::arena: Robot 1 took 6.30 damage, health remaining: 44.80
15:11:40.139 INFO  [R01] botarena::arena: Robot 1 took 10.00 damage, health remaining: 34.80
15:11:40.149 INFO  [R01] botarena::arena: Robot 1 took 10.00 damage, health remaining: 24.80
15:11:40.152 INFO  [R01] botarena::arena: Robot 1 took 10.00 damage, health remaining: 14.80
15:11:40.156 INFO  [R01] botarena::arena: Robot 1 took 10.00 damage, health remaining: 4.80
15:11:40.160 INFO  [R01] botarena::arena: Robot 1 took 10.00 damage, health remaining: -5.20
15:11:40.160 INFO  [R01] botarena::arena: Robot 1 destroyed!
15:11:40.160 INFO  botarena::game: Simulation complete: jojo WINS with 81.10 health after 444 turns
15:11:40.160 INFO  botarena::game: Exiting headless simulation.
15:11:40.160 INFO  botarena: Bot Arena finished.

This should be the same every time it runs and it should also be the same if run without --simulate.

@sdeming sdeming merged commit 85d8d95 into main May 24, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant