Skip to content

yaskovdev/genetic-programming-robocode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using Genetic Programming To Evolve A Robocode Robot

After 63 generations, the blue robot evolved to almost always win against the most annoying enemy (Tracker).

Demo

The below graph shows how the fitness was changing with every generation. Something important happened around 40th generation.

Fitness

The Evolved Program

The Push program that the blue robot is using is quite concise:

(integer.ln ((() (((exec.pop integer.yank (integer.ln ((integer.fromboolean exec.y (((exec.pop)) false (exec.stackdepth (robot.turngunright) (exec.stackdepth exec.swap integer.* (exec.stackdepth integer.pow robot.ahead))) robot.turnradarleft (exec.stackdepth integer.rot robot.turnright robot.fire))))))) false (false) robot.turnradarleft (exec.stackdepth integer.rot robot.turnright robot.fire))) integer.stackdepth) integer.=)

How To Run Locally

Create ROBOCODE_HOME environment variable set to, e.g., c:\robocode.

-Xmx512M -Djava.security.manager=allow -XX:+IgnoreUnrecognizedVMOptions "--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED" "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED" "--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED" "--add-opens=java.desktop/sun.awt=ALL-UNNAMED"

Also, since you set NOSECURITY to true, do not forget to add the next paths to the classpath (see this issue):

  1. /Users/yaskovdev/robocode/robots
  2. /Users/yaskovdev/robocode/robots/robocode-push-1.0-SNAPSHOT-jar-with-dependencies.jar

About

Using genetic programming to evolve a Robocode robot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages