Skip to content

Commit

Permalink
Adding script to regenerate seed catalog files for compare seeds action
Browse files Browse the repository at this point in the history
  • Loading branch information
flend committed Jan 13, 2024
1 parent 0286c2b commit df4f547
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/update_seed_catalogs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import subprocess
import argparse
import sys

def create_brogue_seed_catalog_file(output_seed_catalog_file, extra_args, max_level):

seed_catalog_cmd_args = f'--print-seed-catalog 1 25 {max_level}'

# Generate the first 25 seeds
if extra_args:
brogue_command = f'./bin/brogue {extra_args} {seed_catalog_cmd_args} > {output_seed_catalog_file}'
else:
brogue_command = f'./bin/brogue {seed_catalog_cmd_args} > {output_seed_catalog_file}'
print(f"Running {brogue_command}...")
brogue_result = subprocess.run(brogue_command, shell=True, capture_output=True, text=True)

if brogue_result.returncode:
print("Test run failure, seed catalog generation failed. Output:")
print(brogue_result.stdout)
sys.exit(1)

print("Seed catalog creation complete.")

def main():
# Create the argument parser
parser = argparse.ArgumentParser(description='Brogue Seed Catalog Updater for Brogue Seed Compare Test Runner. Run this script to update the seed catalog files used by the Brogue Seed Compare Test Runner. This should be done after a change to the Brogue source code that changes the dungeon generation. Assumes brogue compiled binary available in ./bin/brogue')
parser.parse_args()

create_brogue_seed_catalog_file('test/seed_catalogs/seed_catalog_brogue.txt', None, 40)
create_brogue_seed_catalog_file('test/seed_catalogs/seed_catalog_rapid_brogue.txt', "--variant rapid_brogue", 10)

if __name__ == '__main__':
main()

0 comments on commit df4f547

Please sign in to comment.