summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/test
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-08-27 17:51:09 +0200
committerAdam Borowski <kilobyte@angband.pl>2013-08-27 22:20:00 +0200
commit75ea027c7664e6c3c8bfb55aa137e06c62a82f11 (patch)
treeff40fa7f7babc2b2c463e4ec57a1bbbbd8c67e27 /crawl-ref/source/test
parentbb6b2d10dd37bdc8f91ac81ee6396fa5021b3bac (diff)
downloadcrawl-ref-75ea027c7664e6c3c8bfb55aa137e06c62a82f11.tar.gz
crawl-ref-75ea027c7664e6c3c8bfb55aa137e06c62a82f11.zip
Save the Abyss bot every 1000 turns. Use a per-game --seed.
Because, you know, being able to reproduce crashes without having to run a random bot for days, might be of some use.
Diffstat (limited to 'crawl-ref/source/test')
-rwxr-xr-xcrawl-ref/source/test/stress/abyss14
-rw-r--r--crawl-ref/source/test/stress/abyss.rc20
2 files changed, 31 insertions, 3 deletions
diff --git a/crawl-ref/source/test/stress/abyss b/crawl-ref/source/test/stress/abyss
new file mode 100755
index 0000000000..56e99f3e73
--- /dev/null
+++ b/crawl-ref/source/test/stress/abyss
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Usage: test/stress/abyss game_id, where game_id must be a number. If not
+# provided, it defaults to the script's PID.
+
+GAME=${1:-$$}
+
+while ./crawl -name "Abyss-$GAME" -rc test/stress/abyss.rc -seed "$GAME"
+ do
+ # ^Q to exit the loop, &^C to crash and retain the save
+ if ! [ -f "saves/Abyss-$GAME.cs" ]
+ then exit
+ fi
+ done
diff --git a/crawl-ref/source/test/stress/abyss.rc b/crawl-ref/source/test/stress/abyss.rc
index cf95d90d5c..aa72e154b8 100644
--- a/crawl-ref/source/test/stress/abyss.rc
+++ b/crawl-ref/source/test/stress/abyss.rc
@@ -1,8 +1,7 @@
# A bot to exercise player-vs-monsters combat and Abyss generation.
#
-# Usage: ./crawl --no-save --rc test/stress/abyss.rc
-#
-# Wizmode is needed.
+# Usage: test/stress/abyss
+# (or disable the autosave then ./crawl --no-save --rc test/stress/abyss.rc)
name = Abyss_walker
species = mu
@@ -16,6 +15,7 @@ autofight_stop = 0
Lua{
bot_start = true
last_turn = -1
+first_turn = you.turns()
local cmds = {string.char(9), 'u', 'k', 'l', 'n', '.'}
function ready()
local esc = string.char(27)
@@ -57,6 +57,15 @@ function ready()
"debug.disable('mon_act', false)" .. eol .. esc)
--# exit the Abyss then go back, so it's not the special starting Abyss
crawl.sendkeys("&B")
+ elseif bot_start then
+ bot_start = false
+ crawl.enable_more(false)
+ crawl.sendkeys("&Y" .. esc)
+ crawl.sendkeys("&" .. string.char(20) ..
+ "debug.disable('confirmations')" .. eol ..
+ "debug.disable('death')" .. eol ..
+ "debug.disable('hunger')" .. eol ..
+ "debug.disable('afflictions')" .. eol .. esc)
end
if you.turns() ~= last_turn then
command = 1
@@ -89,5 +98,10 @@ function ready()
command = 2
end
crawl.sendkeys(cmds[command])
+
+ --# do only 1000 turns per invocation
+ if you.turns() - first_turn >= 1000 then
+ crawl.sendkeys(string.char(19))
+ end
end
}