RPI/Mathactivity/XML: Difference between revisions

From OLPC
Jump to navigation Jump to search
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
==XML Howto==
==XML Howto==
http://www.boddie.org.uk/python/XML_intro.html
http://www.boddie.org.uk/python/XML_intro.html <br />
http://docs.python.org/lib/module-xml.dom.minidom.html<br />
http://wiki.python.org/moin/MiniDom
==Math Format==
==Math Format==
*Relatively Extensible
*Relatively Extensible
Line 15: Line 17:
**Level ID for each problem
**Level ID for each problem
**Answer to problem
**Answer to problem
**Hints
**Chances




<math_problems>
<math_problems>
<problem>
<problem id="01">
<lt sign="1">12</lt>
<problem_level>0</problem_level>
<lt var="3">4</lt>
<num_chances>2</num_chances>
<rt>16</rt>
<mathml>
<? actual generated mathml here ?>
</problem>
<problem>
</mathml>
<lt>1</lt>
<answer>3</answer>
<lt>4</lt>
</problem>
</problem>
</math_problems>
</math_problems>
Line 38: Line 41:
<goal>
<goal>
<resource>
<resource>
<required>
</required>
<obtained>
<obtained>
</obtained>
</obtained>
Line 51: Line 56:


==Resource and Market Format==
==Resource and Market Format==
<economy>

<resources>
<resource>
<name>Mud</name>
<uid>1</uid>
<imgpath>./mud.gif</imgpath>
<probid>100</probid>
</resource>
<resource>
<name>Wood</name>
<uid>2</uid>
<imgpath>./wood.gif</imgpath>
<probid>101</probid>
</resource>
<resource>
<name>Stone</name>
<uid>3</uid>
<imgpath>./stone.gif</imgpath>
<probid>102</probid>
</resource>
<resource>
<name>Metal</name>
<uid>4</uid>
<imgpath>./metal.gif</imgpath>
<probid>103</probid>
</resource>
<resources>

<market type="symmetric (or asymmetric)">
<exchange>
<item uid="1" />
<prices>
<price uid="2">1/3</price>
<price uid="3">1/5</price>
<price uid="4">1/10</price>
</prices>
</exchange>
<exchange>
<item uid="2" />
<prices>
<price uid="1">2</price>
<price uid="3">1/2</price>
<price uid="4">1/4</price>
</prices>
</exchange>
...
</market>

</economy>
==Sample Settings Parser==
[[/Sample_Parser|Sample Parser]]

Latest revision as of 22:41, 15 April 2008

XML Howto

http://www.boddie.org.uk/python/XML_intro.html
http://docs.python.org/lib/module-xml.dom.minidom.html
http://wiki.python.org/moin/MiniDom

Math Format

  • Relatively Extensible
  • Prototype Parser and Math Engine in PHP
  • Polynomials only at this time
  • Math engine is not yet complete, will have to discuss some ideas in meeting Tuesday
    • Ideas for storing expressions? i.e. log(x), (x^3), etc?
  • Notes to self:
    • Operations?
    • Auto-generate constants?
  • 'Barking up the wrong tree?' - MathML - http://www.w3.org/Math/
  • Encapsulate MathML inside our own XML wrapper
    • Unique identifiers per problem
    • Level ID for each problem
    • Answer to problem
    • Hints
    • Chances


<math_problems>
  <problem id="01">
      <problem_level>0</problem_level>
      <num_chances>2</num_chances>
      <mathml>
          <? actual generated mathml here ?>
      </mathml>
      <answer>3</answer>
  </problem>
</math_problems>

Goal Format

Persistence of State Format

<state>
	<players>
	</players>
		<goal>
			<resource>
                               <required>
                               </required>
				<obtained>
				</obtained>
			</resource>
			<purchased_subgoal>
			</purchased_subgoal>
			<problems>
				<used>
				</used>
			</problems>
		</goal>
</state>

Resource and Market Format

<economy>
<resources>
  <resource>
    <name>Mud</name>
    <uid>1</uid>
    <imgpath>./mud.gif</imgpath>
    <probid>100</probid>
  </resource>
  <resource>
    <name>Wood</name>
    <uid>2</uid>
    <imgpath>./wood.gif</imgpath>
    <probid>101</probid>
  </resource>
  <resource>
    <name>Stone</name>
    <uid>3</uid>
    <imgpath>./stone.gif</imgpath>
    <probid>102</probid>
  </resource>
  <resource>
    <name>Metal</name>
    <uid>4</uid>
    <imgpath>./metal.gif</imgpath>
    <probid>103</probid>
  </resource>
<resources>
<market type="symmetric (or asymmetric)">
<exchange>
  <item uid="1" />
  <prices>
    <price uid="2">1/3</price>
    <price uid="3">1/5</price>
    <price uid="4">1/10</price>
  </prices>
</exchange>
<exchange>
  <item uid="2" />
  <prices>
    <price uid="1">2</price>
    <price uid="3">1/2</price>
    <price uid="4">1/4</price>
  </prices>
</exchange>
...
</market>
</economy>

Sample Settings Parser

Sample Parser