From: "Christoffer Lernö" Date: 2007-03-05T06:55:10+09:00 Subject: Re: [QUIZ] GOPS (#116) --Apple-Mail-4--682906539 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Here is an example of what can be done with a static strategy. This bot has a fixed strategy, always playing the same card in response to a challenge card. This can be surprisingly effective, brutally beating some of my attempts at bots that instead would try to evaluate the best play using knowledge of the opponent's cards. I can't take credit for the idea though, it was thought up by a co- worked of mine. Since I did not want to try static solutions by hand, I decided to try to evolve the best possible solution. This bot was created by randomly creating bots and keeping the best. A bot would only be accepted if it could beat all the previous "master" bots. This particular bot was the best I had after a few hours of random bot births. /C --Apple-Mail-4--682906539 Content-Transfer-Encoding: 7bit Content-Type: text/x-ruby-script; x-unix-mode=0644; name=muppet.rb Content-Disposition: attachment; filename=muppet.rb #!/usr/bin/env ruby -w # Muppet: The Static bot # Using an array-based bot with static responses # was originally conceived by my co-worker Daniel Wikstrom. # This particular strategy was generated by randomly # creating strategies and then letting the strategies to # fight each other. strategy = [4, 2, 5, 6, 1, 7, 11, 8, 12, 3, 13, 9, 10] 13.times do $stdout.puts strategy[$stdin.gets[/\d+/].to_i - 1] $stdout.flush $stdin.gets end --Apple-Mail-4--682906539 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed --Apple-Mail-4--682906539--