Score Tracker Ruleset

This page demonstrates how the io.picolabs.score_tracker ruleset keeps track of points. This ruleset is generalized, and may be used in various games or events, such as OpenWest presentations.

The Ruleset

You can access the ruleset here: https://github.com/Picolab/OpenWest2019/blob/master/io.picolabs.score_tracker

How it works

Normally, participants in a contest would be required to sign in with some sort of username and password in order for the code to properly associate points earned with a specific person. Since nobody likes creating a username and password for everything, this ruleset aims to eliminate that need through the use of cookies, as inspired by Bruce Conrad's OpenWest 2018 demo.

How to use

Using this ruleset is pretty straightforward. Go to Manifold and create a new card called "my contest" (or whatever else you want to call it) and install the ruleset on it. Currently, the ruleset's entity variable doesn't support multiple contests on the same pico, so the idea is to create one pico per contest. You only need to use Manifold to create the pico if you want to use the built-in component which displays a nice little leaderboard in the manifold app. If you don't care for this, or if you don't have access to the Manifold pico-engine, then I recommend just creating your own pico on your engine and viewing the currentRanks function result in the testing tab.

What DID/ECI should I use?

When the ruleset is installed, it creates a new channel that allows only events of domain "score". This is to prevent someone from doing strange things with the DID, such as creating new child picos. When programming some sort of application code which makes the sky/event calls to the contest pico, use this secured DID to send score events.

Steps

  1. The first thing a participant must do is register themselves by sending the score:new_participant event. The person only needs to provide their first and last names separately. First and last names which are already registered will return a directive saying so. The ruleset will then return a directive which sets a cookie on their device which acts as a unique identifier.
  2. Now that the person has their cookie set, they can send any number of score:new_points events to start raking in points. They only need to provide the "points" attribute (a number) and a "descr" (a string) attribute which describes the event which gave them points. No steps are taken to prevent someone from using a tool like Postman or curl to generate as many points as they would like, so this ruleset is not secure enough for serious competitions.
  3. When the contest is over, the administrator need only call the currentRanks function and record the ordered results.

Recovering a cookie

Some devices, especially mobile ones, occasionally clear cookies on their own. A participant may recover their cookie by speaking with an administrator and giving their first and last names. The admin then uses the infoFromName function to get a recovery code for the participant, who can then send the score:recovery_needed event with this recovery code and their cookie will be reset.

Viewing a Leaderboard

The io.picolabs.score_tracker ruleset is also a manifold app, so there is a friendly component written to display the results from the currentRanks function. If you didn't create the pico via Manifold, then you will need to view the leaderboard by calling the currentRanks function.

Here is a picture of the early prototype component:


Copyright Picolabs | Licensed under Creative Commons.