Skip to content

An early experiment in learning objects. A simulation of Smith and Price's "Hawk-Dove" in PyGame.

Notifications You must be signed in to change notification settings

ecmendenhall/Hawk-and-Dove

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hawk and Dove is a simulation of the Hawk-Dove game described by John Maynard Smith and George Price in their paper "The logic of animal conflict." Evolutionary game theory is fascinating. Here is one good book on the subject.

This simulation requires NumPy and PyGame. I wrote it as an exercise to practice object orientation. Instead of simulating each round of the game offscreen, birds bounce around in a Pong-like environment, playing a round of Hawk-Dove when they collide. Here are the controls:

  • [ h ]: Spawn a new hawk.

  • [ d ]: Spawn a new dove.

  • [ b ]: Spawn an new bourgeois.

  • [ p ]: Print population statistics to the terminal.

  • [ q ]: Kill all current birds.

  • [ = ]: Raise death threshold.

  • [ - ]: Reduce death threshold.

  • ]: Raise replication threshold.

  • [ [ ]: Reduce replication threshold.

  • [ " ]: Raise game payoff.

  • [ ; ]: Reduce game payoff.

  • [ / ]: Raise game cost.

  • [ . ]: Reduce game cost.

  • [ l ]: Enable fitness-based speeds.

  • [ k ]: Disable fitness-based speeds.

  • [ up arrow ]: Increase game speed.

  • [ down arrow ]: Decrease game speed.

  • [ z ]: Print current death threshold, replication threshold, game cost, and payoff to the terminal.

About

An early experiment in learning objects. A simulation of Smith and Price's "Hawk-Dove" in PyGame.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages