Files
2025-05-23 22:01:00 +08:00

73 lines
1.5 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Default values
N_MIN=4
N_MAX=16
MINE_DEN_MIN=0.3
MINE_DEN_MAX=0.4
REVEAL_FRAC_MIN=0.3
REVEAL_FRAC_MAX=0.4
NUM_OF_DATA=1000
MAX_ATTEMPTS=5000
# Parse command-line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--n_min)
N_MIN="$2"
shift 2
;;
--n_max)
N_MAX="$2"
shift 2
;;
--mine_den_min)
MINE_DEN_MIN="$2"
shift 2
;;
--mine_den_max)
MINE_DEN_MAX="$2"
shift 2
;;
--reveal_frac_min)
REVEAL_FRAC_MIN="$2"
shift 2
;;
--reveal_frac_max)
REVEAL_FRAC_MAX="$2"
shift 2
;;
--num_of_data)
NUM_OF_DATA="$2"
shift 2
;;
--max_attempts)
MAX_ATTEMPTS="$2"
shift 2
;;
*)
echo "Unknown parameter: $1"
exit 1
;;
esac
done
echo "Generating Minesweeper puzzles with the following configuration:"
echo " Grid size: ${N_MIN}×${N_MIN} to ${N_MAX}×${N_MAX}"
echo " Mine density: ${MINE_DEN_MIN} to ${MINE_DEN_MAX}"
echo " Reveal fraction: ${REVEAL_FRAC_MIN} to ${REVEAL_FRAC_MAX}"
echo " Number of puzzles: ${NUM_OF_DATA}"
echo " Max attempts per puzzle: ${MAX_ATTEMPTS}"
# Generate puzzles with the specified parameters
python games/tasks/minesweeper/scripts/minesweeper.py \
--n_min "$N_MIN" \
--n_max "$N_MAX" \
--mine_den_min "$MINE_DEN_MIN" \
--mine_den_max "$MINE_DEN_MAX" \
--reveal_frac_min "$REVEAL_FRAC_MIN" \
--reveal_frac_max "$REVEAL_FRAC_MAX" \
--num_of_data "$NUM_OF_DATA" \
--max_attempts "$MAX_ATTEMPTS"
echo "All puzzles generated successfully!"