Menu
News
All News
Dungeons & Dragons
Level Up: Advanced 5th Edition
Pathfinder
Starfinder
Warhammer
2d20 System
Year Zero Engine
Industry News
Reviews
Dragon Reflections
White Dwarf Reflections
Columns
Weekly Digests
Weekly News Digest
Freebies, Sales & Bundles
RPG Print News
RPG Crowdfunding News
Game Content
ENterplanetary DimENsions
Mythological Figures
Opinion
Worlds of Design
Peregrine's Nest
RPG Evolution
Other Columns
From the Freelancing Frontline
Monster ENcyclopedia
WotC/TSR Alumni Look Back
4 Hours w/RSD (Ryan Dancey)
The Road to 3E (Jonathan Tweet)
Greenwood's Realms (Ed Greenwood)
Drawmij's TSR (Jim Ward)
Community
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions, OSR, & D&D Variants
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Resources
Wiki
Pages
Latest activity
Media
New media
New comments
Search media
Downloads
Latest reviews
Search resources
EN Publishing
Store
EN5ider
Adventures in ZEITGEIST
Awfully Cheerful Engine
What's OLD is NEW
Judge Dredd & The Worlds Of 2000AD
War of the Burning Sky
Level Up: Advanced 5E
Events & Releases
Upcoming Events
Private Events
Featured Events
Socials!
EN Publishing
Twitter
BlueSky
Facebook
Instagram
EN World
BlueSky
YouTube
Facebook
Twitter
Twitch
Podcast
Features
Top 5 RPGs Compiled Charts 2004-Present
Adventure Game Industry Market Research Summary (RPGs) V1.0
Ryan Dancey: Acquiring TSR
Q&A With Gary Gygax
D&D Rules FAQs
TSR, WotC, & Paizo: A Comparative History
D&D Pronunciation Guide
Million Dollar TTRPG Kickstarters
Tabletop RPG Podcast Hall of Fame
Eric Noah's Unofficial D&D 3rd Edition News
D&D in the Mainstream
D&D & RPG History
About Morrus
Log in
Register
What's new
Search
Search
Search titles only
By:
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions, OSR, & D&D Variants
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Menu
Log in
Register
Install the app
Install
Upgrade your account to a Community Supporter account and remove most of the site ads.
Community
General Tabletop Discussion
*Pathfinder & Starfinder
Success chances for Skill Challenges
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="sfedi" data-source="post: 4988147" data-attributes="member: 15746"><p><strong>The code</strong></p><p></p><p>For those who asked, here's the code:</p><p></p><p>The evaluation code, which generates the text I posted:</p><p></p><p>[sblock][code]</p><p>| calculator result desc |</p><p>desc := WriteStream on: String new.</p><p>1 to: 5 do: [ :complexity | | successes failures maxNumberOfRolls |</p><p> successes := 2 + (2 * complexity).</p><p> failures := 3.</p><p> maxNumberOfRolls := successes + failures.</p><p> desc cr; cr.</p><p> desc nextPutAll: </p><p> 'Success chance for Skill Challenges complexity ', </p><p> complexity printString, ' (Need ', successes printString, ' successes before ',</p><p> failures printString, ' failures)'.</p><p> desc cr; cr.</p><p> 0.3 to: 0.95 by: 0.05 do: [ :successRate |</p><p> desc nextPutAll: 'Individual chance '.</p><p> (successRate * 100) asInteger printOn: desc.</p><p> desc nextPutAll: '%: '.</p><p> calculator := SCCalculator </p><p> failures: failures</p><p> successes: successes</p><p> chances: (Array new: maxNumberOfRolls withAll: successRate).</p><p> result := calculator execute.</p><p> (result successChance * 100) asInteger printOn: desc.</p><p> desc nextPutAll: '%'.</p><p> desc cr.</p><p> ].</p><p>].</p><p>desc contents.</p><p>[/code][/sblock]</p><p></p><p>Note that it is almost all text formating. The proper calculation is done here:</p><p></p><p>Higher level algorithm methods:</p><p></p><p>[sblock][code]</p><p>SCCalculator>>execute</p><p> "Return result of the calculation"</p><p></p><p> | unsolvedPaths solvedPaths |</p><p> unsolvedPaths := OrderedCollection new.</p><p> solvedPaths := OrderedCollection new.</p><p> unsolvedPaths add: SolutionPath new.</p><p> [unsolvedPaths notEmpty] whileTrue: </p><p> [| toSolvePaths |</p><p> toSolvePaths := OrderedCollection new.</p><p> unsolvedPaths do: </p><p> [:solutionPath | </p><p> (self isSolved: solutionPath) </p><p> ifTrue: [solvedPaths add: solutionPath]</p><p> ifFalse: [toSolvePaths addAll: (solutionPath nextPathsWithChances: self chances)]].</p><p> unsolvedPaths := toSolvePaths].</p><p> ^SCSolutionPaths solutionPaths: solvedPaths</p><p></p><p>SCCalculator>>isSolved: aSolutionPath </p><p> ^(aSolutionPath successes = self successesNeeded) </p><p> or: [aSolutionPath failures = self maxFailures].</p><p></p><p>SCSolutionPaths>>successChance</p><p> ^(self solutionPaths select: [:each | each isResult: #success]) </p><p> inject: 0 </p><p> into: [ :total :successPath | total + successPath probability]</p><p>[/code][/sblock]</p><p></p><p>What this does is to generate "solution paths", that is, a series of successful rolls or failed rolls in several combinations.</p><p>(a path is solved if it has enough successful rolls or enough failed rolls)</p><p>It collects all solution paths.</p><p>It will then ask it's "successChance" and it will sweep all successfull outcomes and sum up their individual probabilities.</p><p></p><p>How an incomplete solution path, gives it's next two solution paths, and some other helper methods:</p><p></p><p>[sblock][code]</p><p>SolutionPath>>nextPathsWithChances: chances </p><p> | newPaths successPath failurePath |</p><p> newPaths := OrderedCollection new.</p><p> successPath := SolutionPath new.</p><p> successPath nodes: self nodes copy.</p><p> successPath nodes add: (SCSolutionNode result: #success probability: (chances at: self nodes size + 1)).</p><p> newPaths add: successPath.</p><p> failurePath := SolutionPath new.</p><p> failurePath nodes: self nodes copy.</p><p> failurePath nodes add: (SCSolutionNode result: #failure probability: 1 - (chances at: self nodes size + 1)).</p><p> newPaths add: failurePath.</p><p> ^newPaths</p><p></p><p>SolutionPath>>failures</p><p> ^(self nodes select: [:each | each result = #failure]) size</p><p></p><p>SolutionPath>>successes</p><p> ^(self nodes select: [:each | each result = #success]) size</p><p></p><p>SolutionPath>>probability</p><p> ^self nodes inject: 1 into: [ :total :node |</p><p> total * node probability ]</p><p>[/code][/sblock]</p><p></p><p>The rest of the code is really trivial: accessors most of them.</p></blockquote><p></p>
[QUOTE="sfedi, post: 4988147, member: 15746"] [b]The code[/b] For those who asked, here's the code: The evaluation code, which generates the text I posted: [sblock][code] | calculator result desc | desc := WriteStream on: String new. 1 to: 5 do: [ :complexity | | successes failures maxNumberOfRolls | successes := 2 + (2 * complexity). failures := 3. maxNumberOfRolls := successes + failures. desc cr; cr. desc nextPutAll: 'Success chance for Skill Challenges complexity ', complexity printString, ' (Need ', successes printString, ' successes before ', failures printString, ' failures)'. desc cr; cr. 0.3 to: 0.95 by: 0.05 do: [ :successRate | desc nextPutAll: 'Individual chance '. (successRate * 100) asInteger printOn: desc. desc nextPutAll: '%: '. calculator := SCCalculator failures: failures successes: successes chances: (Array new: maxNumberOfRolls withAll: successRate). result := calculator execute. (result successChance * 100) asInteger printOn: desc. desc nextPutAll: '%'. desc cr. ]. ]. desc contents. [/code][/sblock] Note that it is almost all text formating. The proper calculation is done here: Higher level algorithm methods: [sblock][code] SCCalculator>>execute "Return result of the calculation" | unsolvedPaths solvedPaths | unsolvedPaths := OrderedCollection new. solvedPaths := OrderedCollection new. unsolvedPaths add: SolutionPath new. [unsolvedPaths notEmpty] whileTrue: [| toSolvePaths | toSolvePaths := OrderedCollection new. unsolvedPaths do: [:solutionPath | (self isSolved: solutionPath) ifTrue: [solvedPaths add: solutionPath] ifFalse: [toSolvePaths addAll: (solutionPath nextPathsWithChances: self chances)]]. unsolvedPaths := toSolvePaths]. ^SCSolutionPaths solutionPaths: solvedPaths SCCalculator>>isSolved: aSolutionPath ^(aSolutionPath successes = self successesNeeded) or: [aSolutionPath failures = self maxFailures]. SCSolutionPaths>>successChance ^(self solutionPaths select: [:each | each isResult: #success]) inject: 0 into: [ :total :successPath | total + successPath probability] [/code][/sblock] What this does is to generate "solution paths", that is, a series of successful rolls or failed rolls in several combinations. (a path is solved if it has enough successful rolls or enough failed rolls) It collects all solution paths. It will then ask it's "successChance" and it will sweep all successfull outcomes and sum up their individual probabilities. How an incomplete solution path, gives it's next two solution paths, and some other helper methods: [sblock][code] SolutionPath>>nextPathsWithChances: chances | newPaths successPath failurePath | newPaths := OrderedCollection new. successPath := SolutionPath new. successPath nodes: self nodes copy. successPath nodes add: (SCSolutionNode result: #success probability: (chances at: self nodes size + 1)). newPaths add: successPath. failurePath := SolutionPath new. failurePath nodes: self nodes copy. failurePath nodes add: (SCSolutionNode result: #failure probability: 1 - (chances at: self nodes size + 1)). newPaths add: failurePath. ^newPaths SolutionPath>>failures ^(self nodes select: [:each | each result = #failure]) size SolutionPath>>successes ^(self nodes select: [:each | each result = #success]) size SolutionPath>>probability ^self nodes inject: 1 into: [ :total :node | total * node probability ] [/code][/sblock] The rest of the code is really trivial: accessors most of them. [/QUOTE]
Insert quotes…
Verification
Post reply
Community
General Tabletop Discussion
*Pathfinder & Starfinder
Success chances for Skill Challenges
Top