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



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

Joined: Wed Nov 12, 2008 8:57 am
Posts: 3554
Location: Long Beach, CA
Unread post Re: Script Challenge - Amtrak
Look at us lol
I had no idea there was a spacelane between Rylos and AC

SD to Terra, Terra to SD
SD to Rylos, Rylos to SD
SD to AC, AC to SD.
AC to Rylos, Rylos to AC <--- I had no idea there was a spacelane between Rylos and AC that would create a hollow triangle with a handful of sectors inside

Where's TW-Cabal when you need it? ---> Major Space Lanes, MSL’s: The MSL’s are all of the sectors that are directly between Sector 1,
and the Stardock, and the triangle between Stardock, Alpha Centauri, and Rylos. They get cleared every extern.
Don’t leave anything in them that you don’t mind losing at extern. Planets parked in MSL’s will be dropped to lv 2 cits if they have lv 3 or higher.
For a picture of the MSL's, go here (this picture is missing :)


Grin

Helix


Attachments:
MSLs.jpg
MSLs.jpg [ 30.72 KiB | Viewed 5176 times ]

_________________
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?
Sat Feb 06, 2010 9:20 am
Profile WWW
Gameop
User avatar

Joined: Thu Mar 08, 2001 3:00 am
Posts: 886
Location: USA
Unread post Re: Script Challenge - Amtrak
Parrothead wrote:
For an amtrak to work you need to surround All of fedspace with figs (sectors 1 - 10) not just the msl's.

one caveat. you can omit deadends off of fedspace, even small bubbles off of fedspace. this increases your chances of finding a fedsafe opponent outside of fedspace so you can kill him. it also saves you a turn to fig the sector in your script.

_________________
twgs : telnet://twgs.thereverend.org:5023
web : http://www.thereverend.org
games : http://www.thestardock.com/twgssearch/i ... verend.org
helper : http://svn.thereverend.org:8080/revhelper/


Sat Feb 06, 2010 11:48 am
Profile
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post Re: Script Challenge - Amtrak
See, everybody learns something, and maybe it has something to do with scripting. And there's nothing like a script challenge to draw MD out of hiding ;)

Regarding intializing variables, I'd like you to treat this as a subroutine, or maybe include, where it can be called multiple times and succeed. If iteration variables like $i aren't first set to 1 (for example), then the routine will not be repeatable. Might be able to use a trick to do this without burning a line though.

Maniac, getWord has an oft overlooked optional parameter - default value. That is what is happening with "%%%%", it is being assigned if no other word was available.

Final note, Sing's code is very dense, and I believe it also won't stop recursing as posted, though that can be fixed without adding another line. But if you want to post an example of your attempt that is more readable first, but indicate which lines could be omitted, or what you believe the less-readable line count would be, that would probably be better at this stage.

Still, I'm sure there are other good ideas to come... and maybe even shorter examples. But if your code is tight, post it, even if it is longer than Sing's.

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


Sat Feb 06, 2010 1:43 pm
Profile WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Script Challenge - Amtrak
ElderProphet wrote:
Final note, Sing's code is very dense, and I believe it also won't stop recursing as posted, though that can be fixed without adding another line. But if you want to post an example of your attempt that is more readable first, but indicate which lines could be omitted, or what you believe the less-readable line count would be, that would probably be better at this stage.


Hehe, yeh, it's likely to just keep going and going. But turn management wasn't a requirement ;).

I guess that also makes it an entire universe gridder, too. LOLOL. Funny unfigged gridder idea.

How would you fix it without adding a line?

Quote:
Still, I'm sure there are other good ideas to come... and maybe even shorter examples. But if your code is tight, post it, even if it is longer than Sing's.


Indeed. There's a lot of ways to look at the problem, might be an idea in there that could shorten things further.

_________________
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:33 pm
Profile ICQ WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post Re: Script Challenge - Amtrak
To fix it without adding a line, you can alter the inner while condition as follows:
while ($step <= 20) and ($c <= SECTOR.WARPCOUNT[$path[$i]])

That would prevent additional sectors from being added to $targets after the final STARDOCK (word 20) in $targets is gridded to.

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


Sat Feb 06, 2010 7:07 pm
Profile WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Script Challenge - Amtrak
Right, but wouldn't that kill the recursion effect? Since it adds to it and there's no way to know how much has been added from just the first loop?

_________________
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 9:18 pm
Profile ICQ WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post Re: Script Challenge - Amtrak
It would kill the recursion after all the MSL's were walked, and all their adjacents were added... which is where you are when step 20 in $targets is done. Then step 21 would be the first adjacent of the first sector in the path from SD to Terra, and so you wouldn't want to add it's adjacents. You'll still grid it, just not add it's adjacents.

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


Sat Feb 06, 2010 10:29 pm
Profile WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Script Challenge - Amtrak
Ohhh... I see what you're saying. Nice...

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]]) AND ($step <= 20))
                setVar $targets $targets & " " & SECTOR.WARPS[$path[$i]][$c]
                add $c 1
            end
            add $i 1
        end
        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 10:37 pm
Profile ICQ WWW
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: Script Challenge - Amtrak
I tried your macro: "*nn* z a 99999 * j x n f q z 1 * z c d z * " when moving and with a single ship, I think I lost 200 or so holds and about 200k figs in Fed. No, it wasn't a real game, just playing around on my server to see how it worked. I bought a second ship and all was well. I seldom have a single ship unless I am really in trouble so it isn't a big deal. I should have caught the "x n f" part.

_________________
               / Promethius / Enigma / Wolfen /

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


Sat Feb 06, 2010 10:53 pm
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:
I tried your macro: "*nn* z a 99999 * j x n f q z 1 * z c d z * " when moving and with a single ship, I think I lost 200 or so holds and about 200k figs in Fed. No, it wasn't a real game, just playing around on my server to see how it worked. I bought a second ship and all was well. I seldom have a single ship unless I am really in trouble so it isn't a big deal. I should have caught the "x n f" part.


Hrm. Macro works when I test it (cn9 = space). Make sure you're getting the spacing exactly right. If problems persist, get more info. Maybe there's
a reason for the problem somewhere.

_________________
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 11:13 pm
Profile ICQ WWW
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: Script Challenge - Amtrak
I used some of Sing's code in the following script, but it is no where as tight as what he wrote. I decided to work with arrays since it would be different. The write to file and then readToArray at the top probably isn't the normal way of using them. But since I didn't think of ever doing something that way, it was interesting to me. I would not run this in a game as it is way too dangerous - the SZ aliens wacked the heck out of me on some of the surrounds.

Code:
delete "amTraktest.txt"
write "amtraktest.txt" STARDOCK & "*1*2*3*4*5*6*7*8*9*10*1*" & STARDOCK & "*" & RYLOS & "*" & ALPHACENTAURI & "*" & STARDOCK & "*" & ALPHACENTAURI & "*" & RYLOS & "*" & STARDOCK & "*DONE"
readToArray "amTraktest.txt" $myArray
setVar $incrArray 1
setVar $i 1
setVar $myArray2[1] STARDOCK
while ($myArray[($i + 1)] <> "DONE")
     getCourse $course $myArray[$i] $myArray[($i + 1)]
     setVar $pointer 2
     while ($pointer <= ($course + 1))
           send "mz" &  $course[$pointer] & "*nn* z a 99999 * j x n f q z 1 * z c d z * "
           setVar $adjs 1
           while ($adjs <= sector.warpcount[$course[$pointer]])
                 getDistance $dist sector.warps[$course[$pointer]][$adjs] $course[$pointer]
                 if ($dist = 1) and (sector.warps[$course[$pointer]][$adjs] > 10) and (sector.warps[$course[$pointer]][$adjs] <> STARDOCK)
                    send "mz" &  sector.warps[$course[$pointer]][$adjs] & "*nn* z a 99999 * j x n f q z 1 * z c d z * <"
                 elseif (sector.warps[$course[$pointer]][$adjs] > 10) and (sector.warps[$course[$pointer]][$adjs] <> STARDOCK)
                    add $incrArray 1
                    setVar $myArray2[$incrArray] sector.warps[$course[$pointer]][$adjs]
                 end
                 add $adjs 1
           end
           add $pointer 1
     end
     add $i 1
end
if ($incrArray > 1)
    setVar $i 1
    add $incrArray 1
    setVar $myArray2[$incrArray] STARDOCK
    while ($i < $incrArray)
    getCourse $course $myArray2[$i] $myArray2[($i+1)]
      setVar $pointer 2
    while ($pointer <= ($course + 1))
      send "mz" &  $course[$pointer] & "*nn* z a 99999 * j x n f q z 1 * z c d z * "
      add $pointer 1
    end
    add $i 1
    end
end

_________________
               / Promethius / Enigma / Wolfen /

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


Sat Feb 06, 2010 11:31 pm
Profile ICQ
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: Script Challenge - Amtrak
Sing, this is what I get with a single ship - no ships available to xport to:

Command [TL=00:00:00]:[6202] (?=Help)? : J
<Jettison Cargo>

Command [TL=00:00:00]:[6202] (?=Help)? : X


[Pause]
Your RedRum has a transport range of 80 hops.

--< Available Ship Scan >--
Ship Sect Name Fighters Shields Hops Type
----------------------------------------------------------------------------
You do not own any other ships!

Command [TL=00:00:00]:[6202] (?=Help)? : F
<Drop/Take Fighters>

How many fighters do you want defending this sector? 1

_________________
               / Promethius / Enigma / Wolfen /

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


Sat Feb 06, 2010 11:38 pm
Profile ICQ
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Script Challenge - Amtrak
Ohh yeh, if you don't have multiple ships I guess it would do that. LOL.

Buy an extra ship =)

_________________
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


Sun Feb 07, 2010 12:15 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
Singularity wrote:
Ohh yeh, if you don't have multiple ships I guess it would do that. LOL.

Buy an extra ship =)


laff, I should have caught it before I ran it.

_________________
               / Promethius / Enigma / Wolfen /

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


Sun Feb 07, 2010 12:47 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:
Ohhh... I see what you're saying. Nice...

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]]) AND ($step <= 20))
                setVar $targets $targets & " " & SECTOR.WARPS[$path[$i]][$c]
                add $c 1
            end
            add $i 1
        end
        goto :step
    end



Good ideas all...
I have a question....
What happens if the route to stardock happens to have a 1 way warp would the return route be another route and if so
is this also considered a MSL?
for example 1 - SD goes through 1 3 55 66 oneway 77 88 99 SD
and SD -1 would be SD-99 88 77 98 44 66 55 3 1
would 98,44 be considered part of the msl?

_________________
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


Sun Feb 07, 2010 5:19 pm
Profile ICQ
Display posts from previous:  Sort by  
Reply to topic   [ 49 posts ]  Go to page Previous  1, 2, 3, 4  Next

Who is online

Users browsing this forum: No registered users and 18 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.