examples: add luck vs skill gambling model#322
Conversation
EwoutH
left a comment
There was a problem hiding this comment.
Thanks for your PR.
You placed all your files in the root of the repo, could you move it to it's own folder, like examples/gambling/ ?
| @@ -1,4 +1,5 @@ | |||
| from mesa_replay import CacheableModel, CacheState | |||
|
|
|||
There was a problem hiding this comment.
Why did you change all these files?
README.md
Outdated
| # Mesa Examples | ||
| ## Core Mesa examples | ||
| The core Mesa examples are available at the main Mesa repository: https://github.com/mesa/mesa/tree/main/mesa/examples | ||
| # Luck vs Skill in Short-Term Gambling |
There was a problem hiding this comment.
It seems you edited the wrong Readme. This is the general readme for all example models. You probably want to add your own readme in a seperate folder
There was a problem hiding this comment.
move to a subfolder, examples/gambling/ for example
There was a problem hiding this comment.
Thank you for taking the time to review my PR. I’ve moved the example into examples/gambling, restored the main README, and added a dedicated README for the example.
for more information, see https://pre-commit.ci
Updated my example's readme from github directly.
| def step(self): | ||
| self.steps += 1 | ||
|
|
||
| for agent in list(self.agents): |
There was a problem hiding this comment.
Can you change this use the do or shuffle_do mesa convention
Summary
This PR adds a new example demonstrating how short-term gambling outcomes are dominated by luck, even when agents differ in skill. The example also shows that early winners are not reliably more skilled than early losers, illustrating why short-term success is often misattributed to ability.
Motive
In stochastic environments, observed performance is often mistaken for underlying ability. This is especially common in gambling and similar settings, where short-term outcomes are highly noisy but are still used to infer skill.
This example is motivated by the need to clearly demonstrate why early success is an unreliable indicator of ability. By providing a minimal and transparent model, the example helps users understand how randomness and ranking alone can produce apparent performance differences, even when true skill differences are small.
The goal is to offer a simple, intuitive illustration of the distinction between luck and skill.
Implementation
The example implements a minimal gambling model with the following structure:
The visualization shows how, over short horizons, the average skill of winners and losers remains similar despite clear differences in outcomes.
Usage Examples
This is a screenshot of one of the possible outputs.
