Group Abstract Group Abstract

Message Boards Message Boards

Make a interactive Biology game to teach taxonomic classification?

Posted 8 years ago

Generally speaking, I can usually overcome any programming snags with some persistence and by delving into documentation and the Internet. But this time I'm stuck.

I'm making a simple game to get students used to taxonomic classification. In the game, the player sees an organism's picture and/or common name. Beneath that it says "Kingdom: " followed by an ActionMenu[]. When the player chooses correctly from the menu, a new line is added that says "Phylum: " followed by another ActionMenu[], etc. This all works, but when it continues to class, order, family, genus, and species it does not replace the ActionMenu[] with the correct answer and it does not update the score. I suspect the issue is related to Dynamic, but I'm not sure.

Can anyone help me get unstuck? Please?

By the way, the game's not done. I intend to speed up the organism selection, add behavior for wrong answers, and give it a meaningful scoring system. I'll finish it when I get unstuck and post the complete code here.

Here is what I've got so far...

taxa = {"Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Species"};
spec = Entity["Species", "Class"];
qCt = 1;
score = 0;
Print[Dynamic[spec]];
While[
  Not[spec["TaxonomicLevel"][[2]] == "Species" \[And] (StringQ[spec["CommonName"]] \[Or] ImageQ[spec["Image"]])],
  spec = RandomEntity["Species"]];
stats = EntityValue[spec, Join[{"CommonName", "Image"}, taxa]];
alts = Prepend[Table[Prepend[RandomSample[EntityValue[stats[[n]], "Siblings"], UpTo[6]],stats[[n]]], {n, 4, 9}],EntityList[EntityClass["Species","Kingdom"]]];
ansRt[lvl_, ent_] := (
   Print[{lvl, ent}];
   ques[[lvl, 1, 3]] = ent;
   game[[1, 1]] = Insert[game[[1, 1]], ques[[lvl + 1]], -2];
   score += 100;
   qCt += 1);
ansWr[] := score -= 33;
menu = Table[ActionMenu["choose",RandomSample[Table[If[Length[alts[[n]]] >= m, If[m == 1, alts[[n, m]] :> ansRt[h2, alts[[h2, 1]]] /. {h1 -> m,h2 -> n}, alts[[n, m]] :> ansWr[]], Nothing], {m, 1,7}]]], {n, 1, 7}];
ques = Table[Row[{taxa[[q]], ": ", menu[[q]]}], {q, 1, 7}];
game = Dynamic[Column[{stats[[2]], Style[stats[[1]], 36], ques[[1]],StringForm["Score: `1`", score]}]];
TraditionalForm[Style[Dynamic[game], 24]]

Thank you in advance,

Mark

POSTED BY: Mark Greenberg
4 Replies
Posted 8 years ago

Thanks, Murray, for the comment. The game pulls its taxonomic data from the Wolfram curated data. That way if classifications change, the game changes too. Currently the kingdoms that the player has to choose from are animals, chromistans, bacteria, viruses, archaeans, fungi, and protozoans.

POSTED BY: Mark Greenberg

A biological, not Mathematical, comment: I hope you're no longer teaching that there are just the 2 kingdoms of animals and plants. See,. e.g., [this Wikipedia article]( https://en.wikipedia.org/wiki/Kingdom_(biology)#Modern_view).

POSTED BY: Murray Eisenberg
Posted 8 years ago

Thank you, Matt. Dynamic is a tricky concept. I've yet to wrap my head around it.

I did end up with a working version of the game through a similar solution to yours, though I still have the Dynamic in the last line. Your solution is cleaner, so I won't post mine. I'll go back and see whether I can clean my version up.

Thanks again,

Mark

POSTED BY: Mark Greenberg
Posted 8 years ago
POSTED BY: Matt Woodbury
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard