How to get started on coding this kind of scoring system?

Hey All–

This may be beyond me for now, but I want to start learning how to code something like this for a scoring system:

Let’s say I want to grade you on five skills five times each. There’s a panel of lights. Five rows, one for each skill, each with five lights. The lights can each be blue (B), red (R), yellow (Y), white (W), or black (U) (unlit). Every time you solve a task, the game scores you. It would look something like this to the player:

I can’t figure out how to format this, so imagine that there are five columns labeled Test 1, 2, 3, 4, 5.

Running B U U U U
Jumping R U U U U
Swimming W U U U U
Climbing B U U U U
Cycling Y U U U U U

With each test, the next U would turn to a color and this would keep the player’s score.

Is there a good example somewhere in the docs for something like this? I’ve read through the “Scoring” examples, but none of them seem very helpful for this kind of scenario. This isn’t exactly racking up points. And none of that displays a changing chart like this to the player.

I don’t even know what search terms to use to find any examples like this. Where should I start?

2 Likes

I think this is just a series of lists – one per “skill”, with potential values of B, R, W, Y, and U. There are some solid tools for dealing with lists in Inform, and a whole chapter in the docs so I don’t think this should be too tricky!

3 Likes

You wouldn’t expect to find anything on this related to scoring in the docs, 'cause it’s really more of an information representation problem; it’s incidental that you’re pursuing it for a scoring system.

This is a job for tables.

skill is a kind of value.
Some skills are defined by the table of mad skills.

color is a kind of object.
black is a color.
blue is a color.
red is a color.
yellow is a color.
white is a color.

table of mad skills
skill   printed name    t1 (color)  t2 (color)  t3 (color)  t4 (color)  t5 (color)
run "Running"
jump    "Jumping"
swim    "Swimming"
climb   "Climbing"
cycle   "Cycling"

when play begins:
  repeat with hue running through the colors begin;
    now the printed name of the hue is character number 1 in ((the printed name of the hue) in title case);
  end repeat;
  now the printed name of black is "U";
  choose row 1 in the table of mad skills;
  now the t1 entry is blue;
  showme the contents of the table of mad skills.

And now showme the contents approaches what you’re after. (You’ll have to write your own output, of course.)

table of mad skills
(row 1)  | run | Running | B | U | U | U | U |
(row 2)  | jump | Jumping | U | U | U | U | U |
(row 3)  | swim | Swimming | U | U | U | U | U |
(row 4)  | climb | Climbing | U | U | U | U | U |
(row 5)  | cycle | Cycling | U | U | U | U | U |

I have the different printed names for the skills 'cause Jumping and Climbing already have meaning in I7. I made color a kind of object instead of a kind of value so I could have the separate printed names.

Edited to add: 5 trials is about the limit for what I’d do with a table where I have to name and manipulate the columns with hard-coded numbers in the name. Possibly at 6 and definitely by 10 I’d switch to lists like Mike suggested, with skills being a kind of object where A skill has a list of colors called the scores.

5 Likes

And with a little cheat in building the spaces into the labels, it becomes super-easy to do the output:

table of mad skills
skill   label   t1 (color)  t2 (color)  t3 (color)  t4 (color)  t5 (color)
run "Running  "
jump    "Jumping  "
swim    "Swimming "
climb   "Climbing "
cycle   "Cycling  "


To print the skills table:
    repeat through the table of mad skills begin;
      say "[label entry] | [t1 entry] | [t2 entry] | [t3 entry] | [t4 entry] | [t5 entry] |[line break]";
    end repeat;
Running   | B | U | U | U | U |
Jumping   | U | U | U | U | U |
Swimming  | U | U | U | U | U |
Climbing  | U | U | U | U | U |
Cycling   | U | U | U | U | U |
6 Likes

I really should frown at you for writing this code instead of making me do it myself, but, er, I could not have done this. Thanks for the help!

2 Likes