Skip to content

Commit

Permalink
Merge branch '21014-timeout' of github.com:howsoai/evolver into 21014…
Browse files Browse the repository at this point in the history
…-timeout
  • Loading branch information
apbassett committed Jul 23, 2024
2 parents 159bdc0 + 30f922b commit ef405ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
echo "Running..."
ulimit -s 524288
sudo apt-get install -y gdb
chmod +x debug.sh
./debug.sh
#./amalgam${{ matrix.amlg-postfix }} --debug-internal-memory tic_tac_toe_evolver.amlg -target-time 180 > logs.txt 2>&1
echo "Done"
Expand Down
4 changes: 2 additions & 2 deletions debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ run
thread apply all bt
EOF

# Run GDB in batch mode and capture the output
gdb -batch -x gdb_commands.gdb --args ./amalgam-mt tic_tac_toe_evolver.amlg -target-time 180 &> logs.txt
# Run the program with a timeout and attach GDB to print the backtrace if it hangs
timeout --preserve-status -s SIGINT 240 gdb -batch -x gdb_commands.gdb --args ./amalgam-mt --debug-internal-memory tic_tac_toe_evolver.amlg -target-time 180 &> logs.txt

# Display the last 100 lines of the GDB output
tail -n 100 logs.txt
6 changes: 4 additions & 2 deletions tic_tac_toe_evolver.amlg
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@
^player_1_entity (list "evolver" player_1)
^player_2_entity (list "evolver" player_2) ))

(print "Beginning game of " player_1 " versus " player_2 "\n")
(print "Beginning game of " player_1 " versus " player_2 " at "
(format (system_time) "number" "date:%Y-%m-%d-%H.%M.%S") "\n")

;can specify "get_user_move" for an interactive version
(let (call_entity "TicTacToeGame" "play_game"
(assoc player_controllers (list get_player_1_move get_player_2_move)))

(print "Final results of " player_1 " versus " player_2 "\n")
(print "Final results of " player_1 " versus " player_2 " at "
(format (system_time) "number" "date:%Y-%m-%d-%H.%M.%S") "\n")
(call_entity "TicTacToeGame" "print_board" (assoc board board))
(print (concat "Player " winning_player " won\n"))
(print "Player 1 score: " player_1_score "\nPlayer 2 score: " player_2_score "\n")
Expand Down

0 comments on commit ef405ec

Please sign in to comment.