Thursday, October 28, 2010

A Few Decades of Bicycles

When I told my friend David that I have my eye on a new bicycle, he asked if this fascination with bikes was a new thing. That got me thinking about my bikes and biking over the years, so I thought I'd put some of that into words.

I lived in England with my parents and siblings in 1965 and 1966. That was a major watershed. My childhood memories are clearly divided into before, during, and after. I was nine years old when we moved to England, so I was already a bit of a big kid and enjoying bike riding. I still have my bike license plate from 1964. I must have had a coaster brake single speed bike, but I remember nothing about it. I do remember riding down Elmwood Ave. to the other end, which must have been all of twenty blocks! But that freedom to explore is a memory I still cherish.

We got two bikes in England; they must have been for my sisters. I remember my older sister's bike especially, because it had a front hub dynamo. They've been around a long time! And both bikes had hand brakes. Those were really nice bicycles! I spent most of my time in a boarding school there and didn't ride much at all. I do remember a bit of riding on the left side of the road, borrowing my older sister's bike.

When we moved from England back to Ohio, to Bath, somehow I caught the trend and begged my Dad for a Schwinn Sting-Ray. He was generous enough to indulge me - a five speed derailleur with a monster shifter on the top tube. But soon after that I met my best friend of those days, Mark Laessig. Mark died tragically young, at maybe 27. I was in contact with him shortly before cancer took him, when he was designing supersonic jet engines at NASA. But even in 8th grade he was obviously brilliant. Somehow in 1969 he had some kind of real racing bike, with drop bars, toe clips, and Campagnolo shifters front and rear. I only had that Sting-Ray a few months before I pulled off the banana seat and replaced it with something much more conventional. The high rise bars got pushed far forward to get me into a conventional posture.

Oh, I rode that bike a lot! Just to ride to Mark's house was a good ride - up Bath Hill, to start with! The biggest ride I remember was Mark and I riding to Nelson Ledges State Park. Looking on a map now - wow, that was over 40 miles! I bonked on the return trip and Mark's Mom rescued us, so it was probably only a 60 mile day. With some hiking and bouldering in the park, too!

Over Spring Break, 1969, we moved to Lake Forest, Illinois. Kiddle's was the bike shop there. I am proud to say that my first W-2 was from Kiddle's. I didn't work there more than a few months. The owner even offered to send me to the Schwinn Repair School in Chicago! But, sad to say, we were already planning our move away from Lake Forest by then.

Soon after our arrival in Lake Forest, I got the Raleigh catalog from Kiddle's and studied it thoroughly. I decided the Super Course was the bike for me and somehow saved up the money to buy one - surely with help from my parents, though I sure don't remember the specifics anymore! I know I rode that bike to summer school and over to Lake Forest college all the time. A side note - that was at the beginning of my computing experience - I was a regular on the IBM 1130 at Lake Forest college. I was fascinated by the closed solutions for cubic and quartic equations and had those written up in Fortran. I don't think I ever bothered to check my solutions, though! I try to do better nowadays!

The really big ride I remember from those days was a three day camping trip. I think there were four of us: John Gwynn, John Evers, Mark Recktenwald, and myself. We rode from Lake Forest up into Wisconsin, somewhere around Lake Geneva. We all would have liked to visit the Yerkes Observatory there but we just didn't have time. We must have been a sight, our tents and sleeping bags crudely strapped on our bike racks! I remember pulling into a Wisconsin State Campground in the dark, and the ranger's office was closed. We were all top students, but I think Mark was deputized to write the note: "We, a group of campers..." We found the picnic area and set up our tents well away from the RVs with their blaring radios or whatever people used in 1970. I also remember riding with a stomach ache from eating under-cooked pancakes from our campground breakfast. Were we cooking with Sterno?

In 1971 we moved to Fort Wayne. My main riding partner there was Mike Short. Ah, I remember attempting a century then. I bonked at about mile 85 and took the sag wagon the rest of the way. I had the patch from that ride on the knee of my blue jeans for a few years after: "I rode to Hell and back!". I hear there's another town not too far away, also in Michigan, that's called Nirvana. We didn't get there, though! I remember too riding many times from our house in the southwest suburbs, down US 24 past the intersection with I-69, into the center of Fort Wayne, to hang out at the library. I got some good use out of my Super Course!

In 1973 I left home to go to college at Princeton in New Jersey. I locked my bike up in the cloisters of Holder Hall with a cheap cable lock and didn't really ride at all or pay attention to the bike. I guess it was early spring before I noticed that the bike was gone. It was a nice bike but I hadn't been riding it so it wasn't a huge tragedy.

I think it was at the end of first semester sophomore year - my physics lab partner told me he was selling his racing bike. He was upgrading to a Masi, as I recall. Wow, the bikes that were appearing in those days! So I bought his Legnano. Campagnolo Nuevo Record derailleurs, center-pull brakes - probably Weinberg - and sew-up tires! I think I bought that bike immediately after Christmas break. I took it out on a ride... all the way out, a freezing rain began. I remember coming back toward Princeton on Route 206 and slipping and falling and landing sprawled out on the highway. It was busy enough with tractor-trailors and every kind of traffic, but somehow right that moment an angel must have been watching. I got back up and tried to walk with the bike but the road was so slippery I couldn't even walk on it!

Probably my longest ride in Princeton was out to the ocean, to Asbury Park. I remember riding over through Lambertville and down along the Delaware River, too.

Ah, the summer of 1976, I worked out in Grand Junction, Colorado. I was doing some programming work for Ken Deffeyes and Ian MacGregor, two geology professors. Mostly we'd commute by car, from the Mesa College dormitories where we stayed, to the ERDA labs where we worked. But for a week or two I was on my own. I recall that I borrowed a bike from one of the ERDA administrators for my commuting in that interval. I remember riding a bit on the back roads around the edges of Grand Junction.

I moved to Philadelphia in 1977 for graduate school. I remember taking the Legnano out for longer rides - sometimes for laps of the classic East and West River Drives, other times out to West Chester or Paoli. The Legnano isn't any kind of urban utility bike, though! I know I used a variety of old coaster brake bikes that seemed to appear out with people's trash from time to time. I remember riding no-hands in the middle of the night on one such bike, from 3rd and South St., after seeing some jazz, back to home in West Philadephia. Riding no hands up over the South St. bridge was the biggest challenge but not so difficult. I really pooled my pennies at one point and bought a new Panasonic five-speed urban bike. This bike was a bit of a technology experiment - the freewheel mechanism was in the bottom bracket, so you could shift the derailleur while you were coasting! But this bike got stolen after less than a year. Better to use a junk bike for running errands!

In 1982 I moved up to Poughkeepsie, NY, to work for IBM. My Dad loaned me his Schwinn Collegiate 5-speed bike to get around until I could afford a car. I remember riding that bike from downtown Poughkeepsie, where I lived, to the IBM education building south of the main site. I remember holding a duffle bag with my laundry across the handlebars, riding to the laundromat. How long did it take me to get that Schwinn back to my Dad? I still had the Legnano then, too. I remember riding up to Rosendale and then around the back side of the Shawangonks and then up and over, by Mohonk Mountain House. That Legnano did not have low gears! I remember riding up to Rhinebeck, too.

I spent a year or so in Cambridge, MA, in 1991. Already I had some kind of mountain bike. I remember riding that in Dutchess County a bit and how much more work it was to ride than the Legnano. But for the potholes and trolley tracks of the Boston area, the mountain bike worked great. I doubt that I even brought the Legnano to Boston - it must have stayed in Poughkeepsie.

I was on a long meditation retreat from late 1992 through early 1996. I stored a lot of my stuff but I sold a lot too - both the mountain bike and the Legnano moved on. My sister worked for a while at Bicycling magazine in Emmaus, PA. I think that's where the Legnano went.

I headed to the Portland, OR, area after retreat. I was low enough on funds and Portland looked like a good bike riding town, so my plan was to do without a car. I stayed a month or so beforehand with my sister in California. I found a Trek 520 there and had it shipped up to Oregon. I wish I had waited and bought my 520 up in Oregon, but I wasn't sure what would be in stock etc. and I didn't want to risk being without wheels.

The 520 served me quite well in Portland. I could ride over the West Hills from Hillsboro, where I lived, into downtown Portland, load up with books at Powell's, and haul them home. Usually coming home I would take Terwilliger and Beaverton-Hillsdale Highway. Up and over Cornell going west with panniers full of books - too much for me! I remember too some rides into the countryside. I especially remember my one ride up Laurelwood Hill. I had no idea what I was getting myself into! But it was a clear day, and at the top I was rewarded with a spectular view of five peaks - Ranier, St. Helens, Adams, Hood, Jefferson. Wow!

Somehow in Portland - well, I had a good job and so I could afford it - but I worked my way up to three bikes: a folding bike and a bombproof Amsterdam city bike along with the 520.

In 2007 I moved back east, into the Catskills Mountains. Lots of busy narrow twisty roads here! But slowly I am working out routes to get places while avoiding the most dangerous roads. This past spring I was delivering census questionnaires. My sweetheart's teenage son has a mountain bike which I used for a decent fraction of the work. Those fat tires and low gears are really handy for the private roads that snake up the valleys here! So that has got me thinking about a bike I can use for grocery shopping, for hauling real cargo up the mountain slopes - up Dug Hill Road!

Friday, August 20, 2010

Pythagorean Shifts

I see that the Yamaha CP1 electronic piano can be switched to play in Pythagorean tuning. This means that fifths are true, i.e. a frequency ratio of 3/2. This is about 2 cents sharper than an equal tempered fifth - a cent is 1% of a half step. Of course, if you follow the circle of fifths and every fifth is 2 cents sharper than equal tempered, the circle will not actually close. The last fifth must be 22 cents flat! Thus, the Pythagorean tuning can be diagrammed with:



I don't see in the CP1 manual which fifth they chose to be flat, so I just took a guess.

This choice of the flat fifth might be something a performer would like to vary, even during a performance. How should the tuning of the piano best change when the performer shifts the flat fifth up or down a fifth?

One approach would just be to shift the whole diagram over a fifth - to keep the same set of differences from equal temperament, but just to shift the assignment of those differences a fifth. This can be diagrammed with:


This is clearly not very satisfactory. Every note on the piano gets adjusted - most notes a flattened two cents, but then one note is sharpened by twenty two cents. This global shuffling could be disruptive in the middle of a performance.

Another approach is simply to sharpen a single note by twenty four cents:


The great advantage of this approach is that, when shifting the flattened fifth one step around the circle of fifths, only one note is changed: the eleven others are left unaltered. This should eliminate any sense of disruption during a performance.

However, with this approach, the whole set of differences from equal temperament drifts sharp by two cents. Shifting again and again in the same direction would just keep sharpening the tuning of the piano. But that is the nature of real Pythagorean tuning: the circle of fifths just doesn't close!

Of course the performer would also have the inverse option, to move the flattened fifth back in the circle of fifths. Again eleven note are unaltered, and then one note would be flattened by twenty four cents.

It looks like this approach to dynamically shifts for Pythagorean tuning could be implemented naturally on the Yamaha Motif XS synthesizer, using the stock tuning controls.

Step one is just to work with Pythagorean tuning, to explore the musical value of the just tuned perfect fifths, and then to see how that awkward very flat fifth gets in the way. Then one can start to explore how dynamically shifted tuning allows one to push the piano past its usual limits - it's as if the piano actually has more keys than twelve per octave!

Wednesday, August 18, 2010

Dynamically Tuned Piano

Tuning a keyboard instrument such as a piano so that each half step has exactly the same frequency ratio is the tuning system known as equal temperament. In equal temperament, a sequence of notes can be shifted up or down the keyboard by any number of steps, and the harmonic relationships between the notes will not be changed. This symmetry is a big advantage for equal temperament.

As discussed by Kyle Gann, there are subtly different tunings that have some other advantages. The fundamental problem with equal temperament, or really with any tuning system, is that the mathematical ratios underlying harmony can be combined in an infinite variety which would require densely packed notes infinitesimally spaced, if the mathematical ratios were to be represented precisely by the tuning system. For a tuning system to provide only a manageable set of notes to a performer, some or all of the intervals will have to be adjusted, or tempered.

Any tuning system that is not equal tempered will not be symmetrical, by that very inequality. A sequence of notes will sound somewhat different if it is shifted up or down the keyboard. For example, the fifth from C to G might be slightly different than the fifth from E to B. A musical piece will have a slightly different character when transposed to a different key.

This variety of character opens up an interesting musical possibility. Given modern keyboard technology, the pitch of any note on a keyboard can be shifted slightly in an instant. To change the character of a piece of music, one could leave the music in the same key, but just tweak the tuning of the instrument on the fly, during a performance.

This is analogous to an orchestral harp. A harp has only seven strings. One can use the pedals of the harp to sharpen or flatten strings, one pitch class at a time, so the harp can be played in the different keys. My proposal here is to take a keyboard that can has twelve pitch classes available, and to use a pedal, or perhaps hand operated controls, to shift one or more of those twelve pitch classes slightly sharper or flatter, to make available multiple non-equal temperaments during a performance.

Here is one concrete proposal for a set of operations to shift tunings. Studying Kyle Gann's presentation of Young's Well Temperament from 1799, one can see that the deviation of the pitches of the various notes from equal temperament follows a simple pattern when plotted along the sequence of fifths:



Typically one will want to shift the meanings of the notes, the harmonic structure, by a fifth. One could just shift the tuning pattern directly:


This shift leaves four pitch classes unaltered, sharpens four, and flattens four. One problem with this shift is that the four unaltered pitch classes are in two separate pairs. Musically, probably only two are significant at any time.

One can also provide two alternatives: shifting up


and shifting down



These two shifts also leave four pitch classes unaltered, but the four pitch classes are all together in the circle of fifths, and so would generally work better as a tonal center during a shift.

A complete system could provide these three alternative shifts when moving up a fifth, and the corresponding three when moving down a fifth, for a total of six single step possibilities. Each step could be repeated indefinitely. Shifting over repeatedly would bring one back to the same tuning after twelve shifts. Shifting up or down repeatedly would keep sharpening or flattening notes, so the whole tuning would be drifting up or down in pitch. Of course, a more typical usage would likely be to shift up when moving a fifth in one direction, then to shift down when moving a fifth in the other direction, which would return the keyboard to the starting tuning.

Monday, May 17, 2010

Who Shall We Blame?

It's anybody's guess at this point, what damage the on-going Deepwater Horizon oil spill will cause. Even long after the flow has stopped and the oil has dissipated and settled, much of the damage will be deep underwater, and much of the damage will be blended in with the side effects of so many other industrial processes, that we will never be able to assess the impact with much precision. But it's clear that the damage will be severe. Surely, someone must pay the price. Surely we have the right and duty to insure justice is served.

I don't know much about the theory or practice of law. It certainly seems valuable to have some social mechanisms to discourage harmful behavior, along with those to encourage helpful behavior. But any such mechanisms will inevitably be very crude. The realities of harmful and helpful behaviors get exquisitely subtle, while the political and bureaucratic mechanisms of the law are dreadfully gross. The situation is the same with charity. It's good that we have charitable institutions, but a cornerstone of society is built of the charitable actions of individuals at the personal level. Another cornerstone is formed by our personal actions of encouragement and discouragement, and our personal evaluation of the helpful and harmful character of actions.

There will surely be plenty of blame passed around for this oil spill. Any operation of this scale and complexity will include many mistakes and oversights. Usually there isn't such a catastrophe to provoke their being brought to light. Now we have a catastrophe. We will hear about the mistakes. However the legal system decides to assign the blame, though, we would be wise to look carefully at the deeper patterns underlying the situation.

The real situation is not properly characterized as a single blown-out well spewing thousands of barrels of oil each day into the Gulf of Mexico. The real situation is that such catastrophes have become a daily routine in our world. Do the tar sand operations in Alberta, operating as planned, do much less damage than this accidentally blown out well? Or look at the damage from the strip mining of coal, or... anyone with their eyes open can extend this list indefinitely.

We can blame corporations, or the financiers, or the government. But Pogo really hit the point: "We have met the enemy, and he is us." It's not just how each of us damages the planet through our individual actions of driving a car, etc. It's not even just how our demand for goods and services drives others to meet our demands through damaging actions. We are all members of the global community, participants in a grand shared imagination of the facts and values that constitute our world, our reality. We are all responsible for bringing into reality the kind of world we have, of daily ecological catastrophe. We all have the responsibility to change, to cultivate a new vision.

It might be that, in a world where risking such catastrophes is unacceptable, the price of gasoline is more like ten dollars per gallon rather than three, and due to that we all experience many constraints on our travels and on the availability of goods and services. Perhaps we can see that by paying such a price we will have purchased a planet that can provide our great grandchildren with an environment in which they can thrive. We might think that we have stumbled upon a remarkable bargain, and celebrate.

Just as the tone and character of our individual life is built up of moments of experience and response that flow from one to the next, so our society and culture are constituted by nothing other than our momentary celebrations and condemnations flowing from individual to individual and recycling through the networks of our communities. We each have the power and responsibility to steer not only our individual responses but those at every scale in the world in which we live.

This is our catastrophe. It is up to each of us to create a world where such catastrophes are vanishingly rare, instead of the daily routine.

Friday, March 19, 2010

Buddhism in a Nutshell

I'm reading Richard Gombrich's What the Buddha Thought (Equinox 2009), and just came upon this wonderful nugget (p. 74):
You cannot see things straight because you are blinded by passion, and you allow your emotions to control you because you do not see things as they are.

Wednesday, March 10, 2010

Automotive Black Boxes

The problems that Toyota is having with stuck accelerators needn't be chalked up entirely to shoddy engineering or corporate greed. Modern cars are very complicated systems which are very difficult to design flawlessly or to diagnose when failures occur. And it's not just cars that are getting more and more complicated!

This rise in complexity is in part due to the pull of rapidly advancing digital electronic technology. Compute power is so cheap, it becomes the optimum way to provide what the customer demands: performance and economy. And customers do demand ever more performance and economy, whether it's due to constraints or worries about the environment, or just because it's what they're conditioned to expect by automotive advertising.

Improvements in safety and efficiency seem entirely positive, but if the cost in complexity brings new risks from rare but catastrophic failures, the gain is not so entire. If 95% of customers have an improved experience, but 0.1% suffer dreadful consequences, the trade-off is not obviously worth pursuing.

But if manufacturers of such complex but safety-critical products could more effectively address the risks of rare but catastrophic failure, so the failure rate could be reduced dramatically, the gains in routine safety and efficiency could be enjoyed with much less risk.

One important such mechanism is already in widespread use in the airplane industry: the black box. It may now be time for the introduction of black boxes into automobiles. Something like a flash drive could record perhaps a half hour's worth of data - the movements of the steering wheel and the pedals, together with engine and wheel speeds, at the very least. Key data from various subsystems should also be included - whatever information could best help engineers diagnose the cause of whatever catastrophic failure might occur.

There are also tools available to help designers find and fix rare design flaws, so they never escape to the field to cause failures. But it is unreasonable to expect activities like driving cars and flying airplanes to be perfectly safe. Reality always has more tricks in reserve than any design team can anticipate.

While engineers certainly must work diligently to eliminate flaws, the real key to progress is to learn from whatever failures occur despite one's best efforts. Modern cars have become so complex that the gross evidence of tire skid marks and observers' memories are insufficient to enable diagnosis of rare failures. Black boxes in automobiles could provide an economical and effective way to learn from those failures so the problems can be fixed before more lives are risked.

Tuesday, January 19, 2010

Luck

Where are these spikes coming from?

A quick review: I am simulating the evolution of strategies for playing Prisoner's Dilemma. I have a parameterized version of the classic strategy TIT FOR TAT. At each generation, I have 100 strategies, i.e. 100 different combinations of values of the four parameters that define a strategy. Each strategy is played against every other strategy for 100 or 300 iterations. Each strategy accumulates a total score across all these iterations and opponents. After all the play of one generation, the lowest scoring half the the strategies are eliminated. The remaining strategies, that scored in the top half, are then combined in a randomized way to generate enough new strategies to bring the total back to 100, and a new round of play is begun.

The graph above is a plot of the numbers of defect-defect, defect-cooperate, and cooperate-cooperate moves for each generation. For this experiment I let each pair of strategies play each other for a run of 300 iterations, instead of 100. The frequency of spikes is thereby reduced.

The most interesting parameter seems to be - given that the opponent has been defecting recently, with what probability should the current strategy cooperate? This probability appears to settle slowly down to around 0.05, then jump rapidly at irregular intervals to around 0.2.

I ran a strategy with this "unwarranted cooperation" parameter set to 0.1, against the classical TIT FOR TAT, for 100 runs, each of which was 100 iterations long. TIT FOR TAT never won a run of 100 iterations - at best it tied. The 20th through 80th percentile runs had the 0.1 strategy winning by 5 points. The best the 0.1 strategy did against TIT FOR TAT was to win by 15 points.

I then played a 0.2 strategy against the 0.1 strategy. the 0.1 strategy generally won - the best it did was to win by 110 points. The median margin was 45 points. 80 percent of the time it won by at least 25 point. But the 0.2 strategy did win at least once, by 25 points.

I think this explains the spikes, or at least starts to. The results of the playing at each generation are not well determined - the distribution of results has some significant range. There is a general drift toward defection, but now and again there is enough lucky cooperation that the cooperating strategies can survive and reproduce.

Another source of randomness is the creation of the new strategies to be added to play in the next generation. Each new strategy is constructed from two randomly chosen surviving strategies from the current generation. If by chance two relatively cooperative strategies are chosen, their child is sure also to be cooperative. The more strategies there are that are cooperative, the more they have the opportunity to increase their scores through mutual cooperation.



Monday, January 18, 2010

backwards

Oops! Reviewing my code... I see that I had the logic backwards. The probability that keeps spiking is actually that of an unwarranted cooperation! Here is a plot with the total numbers of defect-defect, defect-cooperate, and cooperate-cooperate rounds of the game. There are 100 strategies, so that is 4950 pairs, and each pair is run for 100 iterations. Thus the total across all three categories should be 495, 000. Whew! Looks like a match!

Sunday, January 17, 2010

Elimination Rate


Each generation, I am saving the best strategies to run again in the next generation. There is no limit to how long a strategy can be kept - as long as it doesn't get eliminated, it will be kept.

However many strategies are eliminated, I will create the same number of new strategies, so that in each round of play there are the same number of strategies, 100, competing. Each new strategy is created by combining two existing strategies. These two strategies are picked at random from the strategies that scored well enough to be kept for the next generation.

Now I am sorting the scores on each round of play, so I can control the fraction of strategies I eliminate. Here is the graph of evolution of the probability of unprovoked defection, when I eliminate the bottom scoring half of the strategies in each generation:
I have added a couple new lines to this graph - now I am plotting the smallest and the largest values across the 100 strategies, along with the 20th and 80th percentiles, and the median.

If instead I only eliminate the bottom scoring 20% of the strategies, here is how things evolve:

Details, Details

Here's the evolution of the probability of unprovoked defection, when I reduce the level of mutation allowed to 3% instead of 5%. The spikes are certainly much less prominent and their onset is less abrupt.

There is another factor that I am not controlling very carefully - the fraction of strategies that is eliminated in each generation. What I am currently doing is just taking the midpoint between the highest score and the lowest score. The strategies that score below the midpoint are eliminated. Sometimes that might eliminated 40% of the strategies, sometimes 60%. I need to control that fraction more carefully, and to investigate how the pattern of evolution varies and the fraction changes.

Saturday, January 16, 2010

The Literature

OK, I do need to see what others have discovered - this game is quite classical by now, so there must be a considerable literature.

Robert Hoffmann's paper "The Ecology of Cooperation" looks really good for a starting point:

http://www.nottingham.ac.uk/~lizrh2/papers.html

First Plot

I ran the simulation for 4000 generations. This is a plot of the probability that evolves, the probability of defecting when the opponent has been cooperating recently. I am actually using a moving average of recent opponent behavior, rather than just the most recent move. My population size is 100. I have plotted here the 20th percentile, median, and 80th percentile values for the probability of an unprovoked defection.

This sure looks more like some kind of chaos, rather than anything periodic! The relaxation back to polite behavior looks nicely exponential. But that indulgence in nastiness seems to come out of nowhere.

Right now I am allowing a child's parameter to run beyond the range of its parents' values by 5 percent. It must be the case that these nasty suprises come out of these mutations. For a next experiment, I will reduce the allowable range of mutation. This should reduce the frequency of nasty surprises - so I hypothesize!

Prisoner's Dilemma

I am having great fun reading William Poundstone's book on John Von Neumann, Game Theory, the RAND Corporation, etc. So much so, I have to try some of this myself! So I bring up a fresh project space in Linux KDE, and away I go.

How about a parameterized TIT FOR TAT. For example, there can be a couple of probabilities - depending on what the opponent did on the last move, cooperate or defect, this new strategy can use one probability or the other to decide whether to cooperate or defect this turn.

Next, suppose we have a whole population of TIT FOR TAT players, each with its own parameter values. We can play every one against the other and accumulate scores. Then we can pick the parameter values with the best scores, maybe the top half or whatever fraction we like.

The idea is to use this as a model for evolution. I will have to read Axelrod's The Evolution of Cooperation, but sometimes it's just more fun to jump in and try it before getting too bogged down reading about all the approaches everybody else has tried!

Now that I have selected the fittest strategies, I will reproduce them with a bit of variation to create a new generation of strategies. My current idea is to mimic biology: I will create a new strategy from a pair of existing strategies. For each parameter, the pair of existing strategies defines a range of values. I will pick the corresponding parameter value for the new strategy by picking randomly from that range, plus allowing a little extra mutation, a little running outside that range.

So, select the fittest in each generation, then reproduce with variation to create each next generation, repeat for many generations... what will happen?

My first experiment gives a curious result: there seems to be a kind of cycle, where gradually the strategies evolve into a polite TIT FOR TAT with little cheating, then there is a sudden burst of cheating, which again settles slowly back into politeness.

Is this a real property of this kind of system or just a bug? More investigation is needed! What fun!