diff options
author | truebrain <truebrain@openttd.org> | 2009-01-12 17:11:45 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2009-01-12 17:11:45 +0000 |
commit | a3dd7506d377b1434f913bd65c019eed52b64b6e (patch) | |
tree | ced1a262eb143ad6e64ec02f4a4c89835c0c32fd /bin/ai/regression/completeness.sh | |
parent | 9294f9616866b9778c22076c19b5a32b4f85f788 (diff) | |
download | openttd-a3dd7506d377b1434f913bd65c019eed52b64b6e.tar.xz |
(svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
NoAI is an API (a framework) to build your own AIs in. See:
http://wiki.openttd.org/wiki/index.php/AI:Main_Page
With many thanks to:
- glx and Rubidium for their syncing, feedback and hard work
- Yexo for his feedback, patches, and AIs which tested the system very deep
- Morloth for his feedback and patches
- TJIP for hosting a challenge which kept NoAI on track
- All AI authors for testing our AI API, and all other people who helped in one way or another
-Remove: all old AIs and their cheats/hacks
Diffstat (limited to 'bin/ai/regression/completeness.sh')
-rw-r--r-- | bin/ai/regression/completeness.sh | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/bin/ai/regression/completeness.sh b/bin/ai/regression/completeness.sh new file mode 100644 index 000000000..ad1b4c145 --- /dev/null +++ b/bin/ai/regression/completeness.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +if ! [ -f ai/regression/regression.nut ]; then + echo "Make sure you are in the root of OpenTTD before starting this script." + exit 1 +fi + +cat ai/regression/regression.nut | tr ';' '\n' | awk ' +/^function/ { + for (local in locals) { + delete locals[local] + } + if (match($0, "function Regression::Start") || match($0, "function Regression::Stop")) next + locals["this"] = "AIControllerSquirrel" +} + +/local/ { + gsub(".*local", "local") + if (match($4, "^AI")) { + sub("\\(.*", "", $4) + locals[$2] = $4 + } +} + +/Valuate/ { + gsub(".*Valuate\\(", "") + gsub("\\).*", "") + gsub(",.*", "") + gsub("\\.", "::") + print $0 +} + +/\./ { + for (local in locals) { + if (match($0, local ".")) { + fname = substr($0, index($0, local ".")) + sub("\\(.*", "", fname) + sub("\\.", "::", fname) + sub(local, locals[local], fname) + print fname + if (match(locals[local], "List")) { + sub(locals[local], "AIAbstractList", fname) + print fname + } + } + } + # We want to remove everything before the FIRST occurence of AI. + # If we do not remove any other occurences of AI from the string + # we will remove everything before the LAST occurence of AI, so + # do some little magic to make it work the way we want. + sub("AI", "AXXXXY") + gsub("AI", "AXXXXX") + sub(".*AXXXXY", "AI") + if (match($0, "^AI") && match($0, ".")) { + sub("\\(.*", "", $0) + sub("\\.", "::", $0) + print $0 + } +} +' | sed 's/ //g' | sort | uniq > tmp.in_regression + +grep 'DefSQ.*Method' ../src/ai/api/*.hpp.sq | grep -v 'AIError::' | grep -v 'AIAbstractList::Valuate' | grep -v '::GetClassName' | sed 's/^[^,]*, &//g;s/,[^,]*//g' | sort > tmp.in_api + +diff -u tmp.in_regression tmp.in_api | grep -v '^+++' | grep '^+' | sed 's/^+//' + +rm -f tmp.in_regression tmp.in_api + |