

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An assignment for a university course, cs 591, where students are required to use genetic algorithms (ga) to evolve strategies for the rock-paper-scissors (rps) game. The assignment involves modifying an existing ga or writing a new one, testing it against a nash strategy, changing the fitness function, and adding spatial structure to the population. The document also provides resources for downloading ga software and details about what to hand in.
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


The idea of this assignment is to use the genetic algorithm to evolve strategies for playing a sim- ple two-person game known as Rock-Paper-Scissors (RPS). In RPS, each player has a choice of three alternatives: Rock, Paper, and Scissors. After each player has made her choice, the winner is determined as follows: Rock beats Scissors (by smashing the scissors); Paper beats Rock (by wrapping the Rock); Scissors beats Paper (by cutting the paper). For one round of the game, all choices have equal probability of winning, so no strategy is favored. However, the game becomes more interesting when there are repeated interactions between the players. In this assignment we will be as interested in the dynamics of a population of RPS players as we are in evolving a single rule that plays the game well.
You are free to choose any publicly available genetic algorithm software or to write your own using the language of your choice. One possible choice is a very simple genetic algorithm written in C by Gary Flake (see URLs below). If you choose to use Flake’s code, please note that it generates FSAs for playing the Prisoner’s Dilemma. You will be using a different representation to play a different game.
(a) Test the GA against a simple Nash strategy (the strategy that chooses among the three alternatives with equal probability). That is, evaluate an individual’s fitness by measur- ing its success playing against the Nash strategy (b) Change the fitness function so that an individual i plays against x other individuals on each generation to determine i’s fitness. The best value for x will depend on your population size—-you will need to experiment with different values of x to learn which values produce the most interesting dynamics. Each i vs. x interaction consists of a repeated RLP game, say for 51 rounds.
(a) Design a representation that includes the Nash strategy. e.g., by encoding the strategy as a set of probabilities, implement the strategy, and compare its performance with the performance of the representation from Part I. (b) Add space to the model, so that the population occupies a 2-Dimensional array, with one individual (or a small number of individuals) occupying every cell in the array. Study the effects of adding spatial structure to the population.
A suggested representation is to modify the representation described in class for the Prisoner’s Dilemma game. In that representation, a history of the past three moves is maintained and used as an index into an array that specifies what move to make. If you choose to maintain a history of three moves, then your strategy will have 3^6 possibilities rather than 2^6 (because there are three possible choices at each time step). This is only a suggestion. If you have an idea for a different representation, please discuss it with Stephanie ahead of time.
Gary Flake’s book The Computational Beauty of Nature, published by MIT Press, has an excel- lent collection of software that accompanies it. The software, including the genetic algorithm, is available from http://mitpress.mit.edu/books/FLAOH/cbnhtml/source.html. The general download page is: http://mitpress.mit.edu/books/FLAOH/cbnhtml/download.html. There are UNIX, Mac, and Windows versions, both binary and source. The basic, architecture-independent (i.e. UNIX or Windows) source archive is: http://mitpress.mit.edu/books/FLAOH/cbnhtml/cbn-noarch-src+docs.tgz. The most rele- vant program for us is called gaipd (GA for Iterated Prisoner’s Dilemma). Another recommended package, although I haven’t personally tried it, is GAlib, available from http://lancet.mit.edu/ga/. This is a more recent industrial strength implementation.
You are allowed to work with one other partner, if you choose. On March 1 you are expected to hand in a working GA (source code listing), some plots of its performance (e.g., mean fitness plotted against generation), descriptions of examples of high-fitness individuals, and a 3-5 page writeup. On March 13, you should hand in an augmented writeup that describes your new representation, how the spatial algorithm works, any changes to the fitness function, your new results, the comparison between the various methods, and your conclusions.