From 8de75fc17441fda9ad31c6f77a4c6bb5e429c8aa Mon Sep 17 00:00:00 2001 From: David Masad Date: Sat, 27 Feb 2021 13:44:59 -0500 Subject: [PATCH] Debugging weighted random --- examples/duchess_party.html | 6 +++--- examples/simple_space_example.html | 6 +++--- examples/tutorial.html | 6 +++--- storymanager.js | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/duchess_party.html b/examples/duchess_party.html index c8cf12a..e0b99cf 100644 --- a/examples/duchess_party.html +++ b/examples/duchess_party.html @@ -124,7 +124,7 @@ StoryManager.getAllStorylets = function(tag=null) { } StoryManager.getStorylets = - function(n=null, tag=null, selection="ordered", respect_interrupt=true) { + function(n=null, tag=null, selection="weighted", respect_interrupt=true) { /* Get n storylets, prioritizing the highest-priority ones first. @@ -156,7 +156,7 @@ StoryManager.getStorylets = selectedStorylets = this.sortByPriority(allStorylets, n); else if (selection == "weighted") selectedStorylets = this.weightedRandom(allStorylets, n); - + return selectedStorylets; } @@ -189,7 +189,7 @@ StoryManager.weightedRandom = function(allStorylets, n) { rand = Math.random() * sum; for (let i=0; i