New ChoiceScript Randomtest features



In the latest version of ChoiceScript up on github, you’ll find that randomtest.html has three new features.

  1. Avoid used options (less random; finds bugs faster). When this box is checked, randomtest will avoid selecting options that it selected before in a previous iteration. (It first looks for the options that have been used the least; if there’s a tie, it will select one randomly.) This is now enabled by default.

  2. Show choices selected during game. This has always been enabled by default; it shows the exact option that the player selected during play. The new feature is that it’s possible to turn this off, just like @cvaneseltine’s “nodisp” randomtest variant. This is useful if you only want to view line coverage statistics and don’t care about the exact paths used to get there.

  3. Highlight gender pronouns. When enabled, gender pronouns will be highlighted with a yellow background. (This is especially useful when you enable “Show full text during game.”) This makes it easier to notice pronoun errors when proofreading randomtest output.

Pronouns that come from variables will appear in blue; hard-coded pronouns will appear in red. For example, this code:

*temp he "she"

$!{He} gave him a leaflet.

Would display like this:

In a game that uses variable pronouns, hard-coded pronouns are more likely to be in error, so coloring them red makes them extra noticeable.

Let me know if you have questions about these changes or find bugs in the new randomtest!

Testing tool: Randomtest_nodisp
Back from break, anything new? Changes in ChoiceScript?

Do you think “Avoid used options” should be checked by default?

  • Yes
  • No

0 voters


It seems like most people think “Avoid used options” should be the default; that makes sense to me, so I’ve made it the default (and edited the top post of this thread).

IMO, there are two distinct uses for Randomtest:

  1. Finding bugs. This is the most common and most important; “Avoid used options” is good for this. There’s two modes:
    1a. Crashing bugs, where we want the crashing line number and steps to reproduce
    1b. Continuity bugs, where we want the full-text output, so a human can read through looking for errors.
  2. Generating line statistics, especially counting what percentage of randomtesters visit which endings.

“Avoid used options” is better for #1, and it doesn’t hurt #2 that much.


I know there is a way for randomtest to display the average wordcount of one playthrough, but I can’t remember what it was.


you need to click show text and also only run 1 iteration at a time then you can get the word count iirc


Right, and if you want to get an average word count per play through, you can run 100 iterations and just move the decimal.