Inspiration

I read about people using prisoner's dilemma like computer simulations which reproduce themselves based on the outcome of these situations. This experiments help simulate the evolution of altruistic and selfish survival strategies. I wanted to test this myself to see what the result was.

What it does

It sets up a program with "organisms" with many different prisoner's dilemma strategies. The user can then have each one pair off against another in rounds of competition and see how which strategies are most successful.

How I built it

I built it in C++ by creating a linked list of "organisms" with memory of past interactions. New organisms are added when they compete and every other node in the list is removed when it becomes too big. There is also a user display.

Challenges I ran into

I had trouble making sure my numbers were accurate, i.e. I didn't accidentally count the same increase in two different functions or neglect to count them. I also ran into problems with exiting loops at the correct times. My result wasn't what I expected, so I interpreted the results within the context of the experimental "environment" and made 2 altered simulations.

Accomplishments that I'm proud of

I successful got the simulation to work and created a flexible interface with the user. I predicted why my code behaved the way it did and made two altered versions of it with different behavior.

What I learned

I expanded my experience with linked lists and created a way of simulating evolution that I could expand on in the future. I learned about the viability of different moral strategies in the conditions presented in my simulation. I learned to look at how my code is structured to explain its behavior.

Simulation1: In this simulation cooperative organisms are initially the most successful, then uncooperative organisms take over. I figured out this is because at first organisms are more likely to be paired with organisms like themselves and over time it becomes more random.

Simulation2: In this simulation uncooperative organisms are the most successful for the entire duration. This is because the pairings are entirely random.

Simulation3: In this simulation cooperative organisms are successful for the entire duration. This is because organism's "children" are clustered near the parents, so they are more likely to be paired with similar organisms.

What's next for Prisoner-s-Dilemma

I would like to alter the simulation to see how it preforms with simulated reputation. I predict reputation will make cooperative strategies more viable.

Built With

Share this project:

Updates