Skip to content

examples: add luck vs skill gambling model#322

Open
riddhi2106 wants to merge 7 commits intomesa:mainfrom
riddhi2106:riddhi2106-patch-1
Open

examples: add luck vs skill gambling model#322
riddhi2106 wants to merge 7 commits intomesa:mainfrom
riddhi2106:riddhi2106-patch-1

Conversation

@riddhi2106
Copy link

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:

  • Each agent is assigned a fixed skill level drawn uniformly from [0,1].
  • α (skill impact): A model parameter that controls how strongly an agent’s skill affects the probability of winning; small values mean outcomes are mostly driven by chance, while larger values make skill more influential.
  • Skill slightly biases the probability of winning a bet, while outcomes remain stochastic.
  • Agents repeatedly place fixed-size bets over a short time horizon.
  • After each step, agents are ranked by wealth.
  • The model tracks the average skill of the top 10% and bottom 10% of agents by wealth.

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.
image

Copy link
Member

@EwoutH EwoutH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to a subfolder, ‎examples/gambling/ for example

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants