Created
August 4, 2012 22:00
-
-
Save jmhofer/3260241 to your computer and use it in GitHub Desktop.
Robocode with F#: Very First Steps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#light | |
namespace johofer | |
open Robocode | |
type SharpyTheFirst() = | |
inherit Robot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#light | |
namespace johofer | |
open Robocode | |
type SharpyTheFirst() = | |
inherit Robot() | |
override this.Run() = | |
this.Initialize() | |
this.MainLoop() | |
member private this.Initialize() = | |
this.TurnLeft (this.Heading - 90.0) | |
this.TurnGunRight 90.0 | |
member private this.MainLoop() = | |
while true do | |
this.ExecuteSingleStep() | |
member private this.ExecuteSingleStep() = | |
this.Ahead 5000.0 | |
this.TurnRight 90.0 | |
override this.OnScannedRobot e = | |
this.Fire 1.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment