Agent-based modeling in JavaScript in the browser or on the server. [v0.5.19]

Race to the Center

This simple model reflects a phenomenon of two-party politics where both candidates shift their positions to garner more votes. Voters are represented along a single axis, and two candidates are initially placed at random positions in the left half and the right half (blue and red, respectively, as in U.S. politics). A voter casts their ballot for the candidate whose position is closer to theirs.

After each round of voting, the candidate with fewer votes shifts their position (there is no incentive for an incumbent to adopt a new position). With LEARNING_RATE set to 1, they will inevitably move toward the center, with the opponent doing the same if and when they are the minority candidate. With a lower LEARNING_RATE, the process still moves toward the center, but resembles a random walk, where candidates try out new positions that may be less optimal and find equilibrium more slowly.