[alicebot-style] Multiple choice quiz in AIML
John Campbell
alicebot-style@list.alicebot.org
Fri, 08 Jul 2005 17:14:27 +0100
More haste less speed. Despite having everything working, I posted the wrong file.
Here is the corrected one:
<?xml version="1.0" encoding="ISO-8859-1"?>
<aiml>
<!-- Free software Copyright © ALICE A.I. Foundation. -->
<!-- This program is open source code released under -->
<!-- the terms of the GNU General Public License -->
<!-- as published by the Free Software Foundation. -->
<!-- Complies with AIML 1.0.1 Tag Set Specification -->
<!-- as adopted by the ALICE A.I. Foundation. -->
<!-- Annotated Version updated 8 July 2005 -->
<!-- Revision Multiple 0.04b -->
<category>
<pattern>MULTIPLE CHOICE TEST</pattern>
<template>
<srai>QUESTION I</srai>
</template>
</category>
<category>
<pattern>QUESTION I</pattern>
<template>
Who is the best robot? <br/>
A. R2D2.<br/>
B. ALICE.<br/>
C. HAL 9000.<br/>
<think>
<set name="topic">
QUESTION I
</set>
</think>
</template>
</category>
<topic name="QUESTION I">
<category>
<pattern>_</pattern>
<template>
<think>
<set name="star"><star /></set>
</think>
<condition>
<li name="star" value="A">
Wrong! Try again!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUESTION I</srai>
</li>
<li name="star" value="B">
This is the correct answer!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUESTION II</srai>
</li>
<li name="star" value="C">
Wrong! Try again!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUESTION I</srai> </li>
<li>
Please answer with just A, B or C. Try again!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUESTION I</srai>
</li>
</condition>
</template> </category>
</topic>
<category>
<pattern>QUESTION II</pattern>
<template>
Who was the first president? <br/>
A. George Washington.<br/>
B. Thomas Jefferson.<br/>
C. George Bush.<br/>
<think>
<set name="topic">
QUESTION II
</set>
</think>
</template>
</category>
<topic name="QUESTION II">
<category>
<pattern>_</pattern>
<template>
<think>
<set name="star"><star /></set>
</think>
<condition>
<li name="star" value="A">
This is the correct answer!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUESTION III</srai>
</li>
<li name="star" value="B">
Wrong! Try again!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUESTION II</srai>
</li>
<li name="star" value="C">
Wrong! Try again!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUESTION II</srai> </li>
<li>
Please answer with just A, B or C. Try again!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUESTION II</srai>
</li>
</condition>
</template> </category> </topic>
<category>
<pattern>QUESTION III</pattern>
<template>What was the first state? <br/>
A. Virginia.<br/>
B. Pennsylvania.<br/>
C. Delaware.<br/>
<think>
<set name="topic">
QUESTION III
</set>
</think>
</template>
</category>
<topic name="QUESTION III">
<category>
<pattern>_</pattern>
<template>
<think>
<set name="star"><star /></set>
<set name="topic">QUESTIONS</set>
</think>
<condition>
<li name="star" value="A">
Wrong! Try again!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUESTION III</srai>
</li>
<li name="star" value="B">
This is the correct answer!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUIZ FINISHED</srai>
</li>
<li name="star" value="C">
Wrong! Try again!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUESTION III</srai> </li>
<li>
Please answer with just A, B or C. Try again!<br />
<think><set name="topic">QUESTIONS</set></think>
<srai>QUESTION III</srai>
</li>
</condition> </template>
</category> </topic>
<category>
<pattern>QUIZ FINISHED</pattern>
<template>
<think>
<set name="topic">QUESTIONS</set>
</think>
Congratulations, you have finished the quiz!
</template>
</category>
</aiml>
Regards
John Campbell
Sylvie on the web at http://www.jesus.org.uk/bot
Chat to Sylviebot on AIM at aim:goim?screenname=Sylviebot