View unanswered posts | View active topics It is currently Mon Apr 20, 2026 1:08 pm



Reply to topic  [ 49 posts ]  Go to page 1, 2, 3, 4  Next
 Script Challenge - Amtrak 
Author Message
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post Script Challenge - Amtrak
Years ago, I wrote a quick Amtrak script. I was amazed at how efficiently it could be done from a "lines of code" standpoint, though it took many more lines to make it turn efficient.

Let's have a little friendy competition to see just how small an amtrak script can be made to be. I know we can do get it down under 30 lines of code. Or gasp... 20?

For now, we'll not worry too much about turn-efficiency, but it needs to stick to the MSLs, and completely surround them with figs. If it lays a few extra figs or backtracks some, no biggie. We'll assume a starting point of Stardock, and that all Class 0's are known (read: in the database). We can also assume enough starting figs on our ship so as not to need a refill. Bonus points for turn efficiency.

One gotcha to watch out for... it can't attempt to lay a fig in FedSpace... OUCH!

Edit:
I just wrote a quick, very unsafe, 31-liner, which I'll post tomorrow, but that isn't even with much effort. I'm guessing we can trim it way down.

Enjoy,
+EP+

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Fri Feb 05, 2010 1:05 am
Profile WWW
Ambassador
User avatar

Joined: Wed Nov 12, 2008 8:57 am
Posts: 3554
Location: Long Beach, CA
Unread post Re: Script Challenge - Amtrak
Can we call another script to save lines of code? For instance, call a surround script.

Helix

_________________
Helix
Do I really look like a guy with a plan? You know what I am? I'm a dog chasing cars.
Lest we forget
I had to ask myself WWSGD?


Fri Feb 05, 2010 1:21 am
Profile WWW
Lieutenant J.G.
User avatar

Joined: Sun Mar 13, 2005 3:00 am
Posts: 387
Location: USA
Unread post Re: Script Challenge - Amtrak
Helix wrote:
Can we call another script to save lines of code? For instance, call a surround script.

Helix


I get Second place My script is

Load ShortestAmtrackIntheUniverse.ts
halt

_________________
Find out just what any people will quietly submit to and you have the exact measure of the injustice and wrong which will be imposed on them. Frederick Douglas


Fri Feb 05, 2010 5:51 am
Profile ICQ
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: Script Challenge - Amtrak
For an amtrak to work you need to surround All of fedspace with figs (sectors 1 - 10) not just the msl's.

_________________
Coconut Telegraph (ICQ)#586137616
Team Speak3@ 220.244.125.70:9987
Founding Member -=[Team Kraaken]=- Winner of Gridwars 2010 - Ka Pla
Image
Jesus wounldn't Subspace Crawl


Fri Feb 05, 2010 11:53 am
Profile ICQ YIM
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post Re: Script Challenge - Amtrak
Clearly, it has to be a proper amtrak, meaning fed (1-10 & SD) and the MSLs (SD<->1, SD<->AC, SD<->Rylos, Rylos<->AC) must be fully encased by figs.

No, you can't link to an external script, but you can integrate it and access it via gosub.

Surely, someone wants to take a stab at it, right?

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Fri Feb 05, 2010 7:13 pm
Profile WWW
Boo! inc.
User avatar

Joined: Sat Oct 09, 2004 2:00 am
Posts: 865
Location: USA
Unread post Re: Script Challenge - Amtrak
yes let the monsters awake!! Dont give us your example yet!

_________________
“The object of war is not to die for your corp but to make the other bastard die for his.”

Boo! inc.


Fri Feb 05, 2010 8:00 pm
Profile
Gameop
User avatar

Joined: Tue Nov 19, 2002 3:00 am
Posts: 1050
Location: USA
Unread post Re: Script Challenge - Amtrak
Ill bite, but it will be acouple of days till ill have the time to take a stab. Like parrot id prefer if you wait to post your 33 line. Maybe a deadline of Monday? What's the starting sector as a standard?

_________________
Dark Dominion TWGS
Telnet://twgs.darkworlds.org:23
ICQ#31380757, -=English 101 pwns me=-
"This one claims to have been playing since 1993 and didn't know upgrading a port would raise his alignment."


Fri Feb 05, 2010 10:12 pm
Profile ICQ
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post Re: Script Challenge - Amtrak
The starting point is Stardock.

I'll hold off on my post till you guys have had a little time to work on it. I did a little outside-the-box thinking and shaved a few more lines, and I'm sure many more will come off before it's done. That is what I enjoy, approaching a problem from every angle till you end up with something you're surprised by. I wrote a 19-line version that almost worked! And I bet the end result will be even smaller.

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Sat Feb 06, 2010 12:42 am
Profile WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Script Challenge - Amtrak
Ok, a few thoughts from EP, a little work... I've gotten this. Now, who can beat it?

Code:
setVar $targets " 1 2 3 4 5 6 7 8 9 10 1 " & STARDOCK & " " & ALPHACENTAURI & " " & STARDOCK & " " & RYLOS & " " & STARDOCK & " " & RYLOS & " " & ALPHACENTAURI & " " & RYLOS & " " & STARDOCK & " "
setVar $step 1
:step
    getWord $targets $next_step $step "%%%%"
    if ($next_step <> "%%%%")
        getCourse $path CURRENTSECTOR $target
        setVar $i 2
        while ($i <= ($path + 1))
            send "mz" &  $path[$i] & "*nn* z a 99999 * j x n f q z 1 * z c d z * "
            setVar $c 1
            while ($c <= SECTOR.WARPCOUNT[$path[$i]])
                setVar $targets $targets & " " & SECTOR.WARPS[$path[$i]][$c]
                add $c 1
            end
            add $i 1
        end
        add $step 1
        goto :step
   end

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Sat Feb 06, 2010 1:21 am
Profile ICQ WWW
Chief Warrant Officer
User avatar

Joined: Wed Jan 04, 2006 3:00 am
Posts: 136
Location: USA
Unread post Re: Script Challenge - Amtrak
Wow, that is a nice little script. I do see one way to shorten it up one line since undeclared variables can be considered to have a value of zero.

Code:
setVar $targets " 1 2 3 4 5 6 7 8 9 10 1 " & STARDOCK & " " & ALPHACENTAURI & " " & STARDOCK & " " & RYLOS & " " & STARDOCK & " " & RYLOS & " " & ALPHACENTAURI & " " & RYLOS & " " & STARDOCK & " "
:step
    getWord $targets $next_step ($step + 1) "%%%%"
    if ($next_step <> "%%%%")
        getCourse $path CURRENTSECTOR $target
        setVar $i 2
        while ($i <= ($path + 1))
            send "mz" &  $path[$i] & "*nn* z a 99999 * j x n f q z 1 * z c d z * "
            setVar $c 1
            while ($c <= SECTOR.WARPCOUNT[$path[$i]])
                setVar $targets $targets & " " & SECTOR.WARPS[$path[$i]][$c]
                add $c 1
            end
            add $i 1
        end
        add $step 1
        goto :step
   end


Sat Feb 06, 2010 2:48 am
Profile
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Script Challenge - Amtrak
Really? Hrm. I don't see a way to forgo initializing $i, since it would grow to random sizes depending
on the course. And I don't see a way to avoid initializing $c, since it would grow for the same reason.

Care to share?

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Sat Feb 06, 2010 3:27 am
Profile ICQ WWW
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: Script Challenge - Amtrak
It is the "step" var used in getWord $targets $next_step ($step) "%%%%" that MD is talking about. You init it as 1 a couple of lines before that.

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Sat Feb 06, 2010 5:03 am
Profile ICQ
Lieutenant J.G.
User avatar

Joined: Sun Mar 13, 2005 3:00 am
Posts: 387
Location: USA
Unread post Re: Script Challenge - Amtrak
Singularity wrote:
Ok, a few thoughts from EP, a little work... I've gotten this. Now, who can beat it?

Code:
setVar $targets " 1 2 3 4 5 6 7 8 9 10 1 " & STARDOCK & " " & ALPHACENTAURI & " " & STARDOCK & " " & RYLOS & " " & STARDOCK & " " & RYLOS & " " & ALPHACENTAURI & " " & RYLOS & " " & STARDOCK & " "
setVar $step 1
:step
    getWord $targets $next_step $step "%%%%"
    if ($next_step <> "%%%%")
        getCourse $path CURRENTSECTOR $target
        setVar $i 2
        while ($i <= ($path + 1))
            send "mz" &  $path[$i] & "*nn* z a 99999 * j x n f q z 1 * z c d z * "
            setVar $c 1
            while ($c <= SECTOR.WARPCOUNT[$path[$i]])
                setVar $targets $targets & " " & SECTOR.WARPS[$path[$i]][$c]
                add $c 1
            end
            add $i 1
        end
        add $step 1
        goto :step
   end



Couple quick thoughts before going to work?

I thought MSL's were between 1-SD 1-AC 1-Ry and AC-SD-RY
I don't see the path between 1 and anywhere but SD
I also don't see the sentinel "%%%%" being in the targets string

But maybe my brain cell in charge of logical thinking has died due to my use of alcohol.

_________________
Find out just what any people will quietly submit to and you have the exact measure of the injustice and wrong which will be imposed on them. Frederick Douglas


Sat Feb 06, 2010 5:48 am
Profile ICQ
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Script Challenge - Amtrak
Promethius wrote:
It is the "step" var used in getWord $targets $next_step ($step) "%%%%" that MD is talking about. You init it as 1 a couple of lines before that.


Ohh... ok. Good catch. Change made...

Code:
setVar $targets " 1 2 3 4 5 6 7 8 9 10 1 " & STARDOCK & " " & ALPHACENTAURI & " " & STARDOCK & " " & RYLOS & " " & STARDOCK & " " & RYLOS & " " & ALPHACENTAURI & " " & RYLOS & " " & STARDOCK & " "
:step
    add $step 1
    getWord $targets $next_step $step "%%%%"
    if ($next_step <> "%%%%")
        getCourse $path CURRENTSECTOR $next_step
        setVar $i 2
        while ($i <= ($path + 1))
            send "mz" &  $path[$i] & "*nn* z a 99999 * j x n f q z 1 * z c d z * "
            setVar $c 1
            while ($c <= SECTOR.WARPCOUNT[$path[$i]])
                setVar $targets $targets & " " & SECTOR.WARPS[$path[$i]][$c]
                add $c 1
            end
            add $i 1
        end
        goto :step
    end


Quote:
I thought MSL's were between 1-SD 1-AC 1-Ry and AC-SD-RY
I don't see the path between 1 and anywhere but SD
I also don't see the sentinel "%%%%" being in the targets string


1 to AC, 1 to Ry (and back) isn't part of the msl, is it? I believe it's 1 to dock, dock to
alpha, dock to rylos, rylos to alpha. If this turns out to be wrong, I can add to the targets
string easily enough.

%%%% Isn't in the targets string on purpose, getWord has a default value that you
can assign. Take a look...

http://www.navhaz.com/files/script.html#CMD_27

Ok, so 18 lines. Come on, someone can beat it...

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Sat Feb 06, 2010 6:23 am
Profile ICQ WWW
Commander

Joined: Sun Feb 25, 2001 3:00 am
Posts: 1838
Location: Guam USA
Unread post Re: Script Challenge - Amtrak
The MSL is tera to dock , dock to tera then (trianglate dock , alpha , rylos)
: dock to rylos and back.
: dock to alpha and back.

: rylos to alpha and back.

Amtrack is all the sectors around the edge of all these sectors plus sector's around 1 though 10.

_________________
TWGS V2 Vids World on Guam Port 2002
Telnet://vkworld.ddns.net:2002
Discord @ DiverDave#8374
Vid's World Discord

Founding Member -=[Team Kraaken]=- Ka Pla

Image
Winners of Gridwars 2010
MBN Fall Tournament 2011 winners Team Kraaken
Undisputed Champions of 2019 HHT Just for showing up!

The Oldist , Longist Running , Orginal Registered Owner of a TWGS server :
Vids World On Guam


Sat Feb 06, 2010 8:16 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 49 posts ]  Go to page 1, 2, 3, 4  Next

Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.