<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Netrek-dev,</div><div class=""><br class=""></div><div class="">I’m pleased to announce that <a href="http://netrek.networkmom.net" class="">netrek.networkmom.net</a> now has 16 (pretty dumb) Netrek Robots ready to shoot in your general direction! As humans join the server, robots will logoff. As humans leave the server, robots will join. Only humans are counted in the metaserver submission.</div><div class=""><br class=""></div><div class="">Since this is the netrek-dev list, below is the Swift code for the Robot Mark 1. I hope it is highly readable.</div><div class=""><br class=""></div><div class="">Stability and feature improvements to the Swift Netrek server will continue (in particular, still no genocide logic). I also fixed a few bugs in the MacOS and iOS clients while developing the server and will push those next week.</div><div class=""><br class=""></div><div class="">I’m also happy to accept pull requests for better robots. You can also suggest a “name” for your robot. Will your robot namesake go on to achieve honor and glory?</div><div class=""><br class=""></div><div class="">If you login to the server, you’ll see that all four teams are active. That’s intentional. There’s a plan for that…</div><div class=""><br class=""></div><div class="">Darrell</div><div class=""><br class=""></div><div class=""><a href="https://github.com/darrellroot/netrek-server-swift/blob/master/Sources/netrek-server-swift/Robots/RobotModel1.swift" class="">https://github.com/darrellroot/netrek-server-swift/blob/master/Sources/netrek-server-swift/Robots/RobotModel1.swift</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class="">//</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class="">// RobotModel1.swift</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class="">// netrek-server-swift</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class="">//</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class="">// Created by Darrell Root on 7/15/20.</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class="">//</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">import</b></span> Foundation</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(0, 73, 117); background-color: rgb(255, 255, 255);" class=""><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">class</b></span><span style="color: #000000" class=""> </span>RobotModel1<span style="color: #000000" class="">: </span><span style="color: #284b4f" class="">Robot</span><span style="color: #000000" class=""> {</span></div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(0, 73, 117); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">enum</b></span><span style="color: #000000" class=""> </span>Strategy<span style="color: #000000" class=""> {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">case</b></span> <span style="color: #0f68a0" class="">refuel</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">case</b></span> <span style="color: #0f68a0" class="">repair</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">case</b></span> <span style="color: #0f68a0" class="">dogfight</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">var</b></span> <span style="color: #0f68a0" class="">strategy</span>: <span style="color: #284b4f" class="">Strategy</span> = .<span style="color: #3b7f89" class="">dogfight</span></div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">weak</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">var</b></span> <span style="color: #0f68a0" class="">me</span>: <span style="color: #284b4f" class="">Player</span>?</div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(186, 0, 17); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">public</b></span><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span><span style="color: #000000" class=""> </span><span style="color: #0f68a0" class="">userinfo</span><span style="color: #000000" class=""> = </span>"RobotModel1"</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(15, 104, 160); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">public</b></span><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span><span style="color: #000000" class=""> </span>preferredShip<span style="color: #000000" class=""> = </span><span style="color: #284b4f" class="">ShipType</span><span style="color: #000000" class="">.</span><span style="color: #3b7f89" class="">cruiser</span></div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">required</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">init</b></span>(player: <span style="color: #284b4f" class="">Player</span>, universe: <span style="color: #284b4f" class="">Universe</span>) {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">me</span> = player</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(15, 104, 160); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">public</b></span><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">func</b></span><span style="color: #000000" class=""> </span>secondTimerFired<span style="color: #000000" class="">() {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">guard</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> me = <span style="color: #3b7f89" class="">me</span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">switch</b></span> me.<span style="color: #3b7f89" class="">status</span> {</div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">case</b></span> .<span style="color: #3b7f89" class="">free</span>, .<span style="color: #3b7f89" class="">observe</span>:</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>//should not get here</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">break</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">case</b></span> .<span style="color: #3b7f89" class="">outfit</span>:</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">guard</b></span> me.<span style="color: #3b7f89" class="">receivedCpOutfit</span>(team: me.<span style="color: #3b7f89" class="">team</span>, ship: <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">preferredShip</span>) <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(186, 0, 17); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span><span style="color: #5c2699" class="">debugPrint</span><span style="color: #000000" class="">(</span>"<span style="color: #000000" class="">\(</span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">#file</b></span><span style="color: #000000" class="">)</span> <span style="color: #000000" class="">\(</span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">#function</b></span><span style="color: #000000" class="">)</span> Unable to outfit ship"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">case</b></span> .<span style="color: #3b7f89" class="">explode</span>:</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">break</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">case</b></span> .<span style="color: #3b7f89" class="">dead</span>:</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">guard</b></span> me.<span style="color: #3b7f89" class="">receivedCpOutfit</span>(team: me.<span style="color: #3b7f89" class="">team</span>, ship: <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">preferredShip</span>) <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(186, 0, 17); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span><span style="color: #5c2699" class="">debugPrint</span><span style="color: #000000" class="">(</span>"<span style="color: #000000" class="">\(</span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">#file</b></span><span style="color: #000000" class="">)</span> <span style="color: #000000" class="">\(</span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">#function</b></span><span style="color: #000000" class="">)</span> Unable to outfit ship"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">case</b></span> .<span style="color: #3b7f89" class="">alive</span>:</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">guard</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> nearestEnemy = <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">nearestEnemy</span>() <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #3b7f89" class="">adjustShields</span>(nearestEnemy: nearestEnemy)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #3b7f89" class="">shootLaser</span>(nearestEnemy: nearestEnemy)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #3b7f89" class="">shootTorpedo</span>(nearestEnemy: nearestEnemy)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">switch</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">strategy</span> {</div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">case</b></span> .<span style="color: #3b7f89" class="">refuel</span>:</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #3b7f89" class="">strategyRefuel</span>()</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">case</b></span> .<span style="color: #3b7f89" class="">repair</span>:</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #3b7f89" class="">strategyRepair</span>()</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">case</b></span> .<span style="color: #3b7f89" class="">dogfight</span>:</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: #3b7f89" class="">strategyDogfight</span>(nearestEnemy: nearestEnemy)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">private</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">func</b></span> <span style="color: #0f68a0" class="">adjustShields</span>(nearestEnemy: <span style="color: #284b4f" class="">Player</span>) {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">guard</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> me = <span style="color: #3b7f89" class="">me</span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> enemyDistance = <span style="color: #284b4f" class="">NetrekMath</span>.<span style="color: #3b7f89" class="">distance</span>(me,nearestEnemy)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> enemyDistance < <span style="color: #284b4f" class="">Laser</span>.<span style="color: #3b7f89" class="">baseRange</span> <span style="color: #5c2699" class="">*</span> <span style="color: #000bff" class="">2</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>//shields should be up</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> <span style="color: #5c2699" class="">!</span>me.<span style="color: #3b7f89" class="">shieldsUp</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">receivedCpShield</span>(up: <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">true</b></span>)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> } <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> me.<span style="color: #3b7f89" class="">shieldsUp</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">receivedCpShield</span>(up: <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">false</b></span>)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">private</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">func</b></span> <span style="color: #0f68a0" class="">shootLaser</span>(nearestEnemy: <span style="color: #284b4f" class="">Player</span>) {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">guard</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> me = <span style="color: #3b7f89" class="">me</span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> enemyDistance = <span style="color: #284b4f" class="">NetrekMath</span>.<span style="color: #3b7f89" class="">distance</span>(me,nearestEnemy)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> enemyDistance < <span style="color: #284b4f" class="">Laser</span>.<span style="color: #3b7f89" class="">baseRange</span> <span style="color: #5c2699" class="">/</span> <span style="color: #000bff" class="">2</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> enemyDirectionRadian = <span style="color: #284b4f" class="">NetrekMath</span>.<span style="color: #3b7f89" class="">angle</span>(origin: me, target: nearestEnemy)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> enemyDirectionNetrek = <span style="color: #284b4f" class="">NetrekMath</span>.<span style="color: #3b7f89" class="">directionRadian2Netrek</span>(enemyDirectionRadian)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">fireLaser</span>(direction: enemyDirectionNetrek)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">private</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">func</b></span> <span style="color: #0f68a0" class="">shootTorpedo</span>(nearestEnemy: <span style="color: #284b4f" class="">Player</span>) {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">guard</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> me = <span style="color: #3b7f89" class="">me</span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> enemyDistance = <span style="color: #284b4f" class="">NetrekMath</span>.<span style="color: #3b7f89" class="">distance</span>(me,nearestEnemy)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>//TODO adjust to torpedo range</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> enemyDistance < <span style="color: #284b4f" class="">Laser</span>.<span style="color: #3b7f89" class="">baseRange</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> enemyDirectionRadian = <span style="color: #284b4f" class="">NetrekMath</span>.<span style="color: #3b7f89" class="">angle</span>(origin: me, target: nearestEnemy)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> variance = <span style="color: #2e0d6e" class="">Double</span>.<span style="color: #5c2699" class="">random</span>(in: <span style="color: #000bff" class="">-0.3</span> <span style="color: #5c2699" class="">..<</span> <span style="color: #000bff" class="">0.3</span>)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">fireTorpedo</span>(direction: enemyDirectionRadian <span style="color: #5c2699" class="">+</span> variance)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">private</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">func</b></span> <span style="color: #0f68a0" class="">strategyDogfight</span>(nearestEnemy: <span style="color: #284b4f" class="">Player</span>) {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">guard</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> me = <span style="color: #3b7f89" class="">me</span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>//random course toward enemy</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">var</b></span> directionRadian = <span style="color: #284b4f" class="">NetrekMath</span>.<span style="color: #3b7f89" class="">angle</span>(origin: me, target: nearestEnemy)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>//random evasive 120 degrees each way</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> directionRadian <span style="color: #5c2699" class="">+=</span> <span style="color: #2e0d6e" class="">Double</span>.<span style="color: #5c2699" class="">random</span>(in: <span style="color: #2e0d6e" class="">Double</span>.<span style="color: #5c2699" class="">pi</span> <span style="color: #5c2699" class="">*</span> <span style="color: #000bff" class="">-0.3</span> <span style="color: #5c2699" class="">..<</span> <span style="color: #2e0d6e" class="">Double</span>.<span style="color: #5c2699" class="">pi</span> <span style="color: #5c2699" class="">*</span> <span style="color: #000bff" class="">0.3</span>)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">receivedDirection</span>(direction: directionRadian)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>//random speed</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">var</b></span> speed = <span style="color: #2e0d6e" class="">Int</span>(me.<span style="color: #3b7f89" class="">ship</span>.<span style="color: #3b7f89" class="">maxSpeed</span> <span style="color: #5c2699" class="">/</span> <span style="color: #000bff" class="">2</span> <span style="color: #5c2699" class="">-</span> <span style="color: #000bff" class="">1</span>)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> speed <span style="color: #5c2699" class="">+=</span> <span style="color: #2e0d6e" class="">Int</span>.<span style="color: #5c2699" class="">random</span>(in: <span style="color: #000bff" class="">-2</span><span style="color: #5c2699" class="">..<</span><span style="color: #000bff" class="">2</span>)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">receivedCpSpeed</span>(speed: speed)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(15, 104, 160); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">private</b></span><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">func</b></span><span style="color: #000000" class=""> </span>strategyRepair<span style="color: #000000" class="">() {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">guard</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> me = <span style="color: #3b7f89" class="">me</span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> planet = me.<span style="color: #3b7f89" class="">orbit</span>, planet.<span style="color: #3b7f89" class="">repair</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> planet = me.<span style="color: #3b7f89" class="">orbit</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">receivedRepair</span>(<span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">true</b></span>)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> planet = <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">nearestRepairPlanet</span>() {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">receivedPlanetLock</span>(planetID: planet.<span style="color: #3b7f89" class="">planetID</span>)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">receivedCpSpeed</span>(speed: <span style="color: #2e0d6e" class="">Int</span>(me.<span style="color: #3b7f89" class="">ship</span>.<span style="color: #3b7f89" class="">maxSpeed</span> <span style="color: #5c2699" class="">/</span> <span style="color: #000bff" class="">2</span>))</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> } <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>//no friendly fuel planet so we stop to repair</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">receivedRepair</span>(<span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">true</b></span>)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(15, 104, 160); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">private</b></span><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">func</b></span><span style="color: #000000" class=""> </span>strategyRefuel<span style="color: #000000" class="">() {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">guard</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> me = <span style="color: #3b7f89" class="">me</span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> planet = me.<span style="color: #3b7f89" class="">orbit</span>, planet.<span style="color: #3b7f89" class="">fuel</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> planet = me.<span style="color: #3b7f89" class="">planetLock</span>, planet.<span style="color: #3b7f89" class="">fuel</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> planet = <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">nearestFuelPlanet</span>() {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">receivedPlanetLock</span>(planetID: planet.<span style="color: #3b7f89" class="">planetID</span>)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">receivedCpSpeed</span>(speed: <span style="color: #2e0d6e" class="">Int</span>(me.<span style="color: #3b7f89" class="">ship</span>.<span style="color: #3b7f89" class="">maxSpeed</span> <span style="color: #5c2699" class="">/</span> <span style="color: #000bff" class="">2</span>))</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> } <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(86, 96, 107); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span>//no friendly fuel planet so we stop to refuel</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> me.<span style="color: #3b7f89" class="">receivedCpSpeed</span>(speed: <span style="color: #000bff" class="">0</span>)</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(15, 104, 160); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">private</b></span><span style="color: #000000" class=""> </span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">func</b></span><span style="color: #000000" class=""> </span>decideStrategy<span style="color: #000000" class="">() {</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">guard</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">let</b></span> me = <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">me</span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">else</b></span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(186, 0, 17); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class=""> </span><span style="color: #5c2699" class="">debugPrint</span><span style="color: #000000" class="">(</span>"<span style="color: #000000" class="">\(</span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">#file</b></span><span style="color: #000000" class="">)</span> <span style="color: #000000" class="">\(</span><span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">#function</b></span><span style="color: #000000" class="">)</span> Unable to identify myself"<span style="color: #000000" class="">)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> me.<span style="color: #3b7f89" class="">damage</span> > me.<span style="color: #3b7f89" class="">ship</span>.<span style="color: #3b7f89" class="">maxDamage</span> <span style="color: #5c2699" class="">/</span> <span style="color: #000bff" class="">2</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">strategy</span> = .<span style="color: #3b7f89" class="">repair</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> me.<span style="color: #3b7f89" class="">fuel</span> <span style="color: #5c2699" class=""><</span> me.<span style="color: #3b7f89" class="">ship</span>.<span style="color: #3b7f89" class="">maxFuel</span> <span style="color: #5c2699" class="">/</span> <span style="color: #000bff" class="">3</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">strategy</span> = .<span style="color: #3b7f89" class="">refuel</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">return</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">strategy</span> == .<span style="color: #3b7f89" class="">repair</span> <span style="color: #5c2699" class="">&&</span> me.<span style="color: #3b7f89" class="">damage</span> < <span style="color: #000bff" class="">10</span> {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">strategy</span> = .<span style="color: #3b7f89" class="">dogfight</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">if</b></span> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">strategy</span> == .<span style="color: #3b7f89" class="">refuel</span> <span style="color: #5c2699" class="">&&</span> me.<span style="color: #3b7f89" class="">fuel</span> <span style="color: #5c2699" class="">></span> (me.<span style="color: #3b7f89" class="">ship</span>.<span style="color: #3b7f89" class="">maxFuel</span> <span style="color: #5c2699" class="">-</span> <span style="color: #000bff" class="">500</span>) {</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> <span style="color: rgba(180, 0, 98, 0.8)" class=""><b class="">self</b></span>.<span style="color: #3b7f89" class="">strategy</span> = .<span style="color: #3b7f89" class="">dogfight</span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""> }</div><p style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 21px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div></div><div class=""><br class=""></div></body></html>