Message Boards Message Boards

Incentivizing Good Behavior with the Wolfram Cloud

Posted 8 years ago

I had such luck using the Wolfram Language to help my son crack a forgotten lock combination, I've been trying to find other ways to incorporate little programming demonstrations/projects into daily household life. I won't go into the details, but my wife and I just made an arrangement with our daughter — she gets a star or point each time she does a certain thing that she doesn't particularly like to do, and if she gets x number of points, she gets a small reward that we've agreed on in advance. Typical incentivizing of good behavior... but the thing we're awarding points for could happen at a variety of times and locations, and in situations where either my wife or I might be present. So how do we ensure that two forgetful parents accurately track these events? It occurred to me that I could probably whip something up in just a few lines of Wolfram Language code that would fit the bill.

I need some simple persistent storage for tracking points, so let's create a Databin:

bin = CreateDatabin[]
Out[301]= Databin["gx61vKJi"]

All I need to do is add (and sometimes, perhaps, subtract) values, so I don't need much of a schema for the data. Let's just initialize the Databin with a value of 0:

DatabinAdd[bin, 0]

Then I need a simple function to modify the Databin and show some visualization of progress. This one will take a number of points, add them to the last value in the Databin, and plot the result (the new "Latest" value) as a HorizontalGauge:

pointPlot = Function[val,
   DatabinAdd[bin, bin["Latest"]["Data"] + val];
   HorizontalGauge[bin["Latest"]["Data"], {0, 25}, 
    GaugeMarkers -> Placed[Graphics[Disk[]], "DivisionInterval"], 
    ScaleDivisions -> {5, 5}, ImageSize -> 700]];

Then I make a simple FormPage, which lets me add and remove single points, or simply plot the latest value (by adding 0 points to the latest value):

f = FormPage[{"Points" -> <|
     "Interpreter" -> {"+1" -> 1, "-1" -> -1, "Check progress" -> 0}, 
     "Control" -> PopupMenu|>}, pointPlot[#Points] &, 
  AppearanceRules -> <|"Title" -> "Random Kid Challenge"|>]

And then deploy...

In[323]:= CloudDeploy[f, Permissions -> "Public"]
Out[323]= CloudObject["https://www.wolframcloud.com/objects/8fd763f3-1307-4971-9475-74840fcdd22e"]

enter image description here

POSTED BY: Alan Joyce
3 Replies

The deployed FormPage looks great in a mobile browser. I just bookmarked it.

POSTED BY: Alan Joyce

enter image description here - another post of yours has been selected for the Staff Picks group, congratulations! We are happy to see you at the top of the "Featured Contributor" board. Thank you for your wonderful contributions, and please keep them coming!

POSTED BY: EDITORIAL BOARD

This is nice. Did you incorporate it on to a smartphone app?

POSTED BY: Manjunath Babu
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract