View unanswered posts | View active topics It is currently Mon Apr 27, 2026 2:13 pm



Reply to topic  [ 49 posts ]  Go to page Previous  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 Re: Script Challenge - Amtrak
Yes, I think everyone considers that an MSL. It's possible that the Feds only go one way, but dunno if it has ever been tested. You'll note in the targets list from Sing's example that after sector 10, it returns to sector 1 and then to Stardock, for this very reason, if 1 -> SD is different than SD -> 1.

Also, a better targets list would be:
1 2 3 4 5 6 7 8 9 10 1 SD RYLOS AC SD AC RYLOS SD

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


Sun Feb 07, 2010 6:28 pm
Profile WWW
Veteran Op

Joined: Tue Nov 28, 2006 4:04 pm
Posts: 5025
Unread post Re: Script Challenge - Amtrak
These sectors and routes are included in msl's and it doesn't matter if any of these routes include one way sectors or not.

Sectors 1 thru 10
The Stardock
1 to Stardock
Stardock to 1
Alpha to Stardock
Stardock to Alpha
Rylos to Stardock
Stardock to Rylos
Alpha to Rylos
Rylos to Alpha


Sun Feb 07, 2010 7:25 pm
Profile
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: Script Challenge - Amtrak
Big D wrote:
These sectors and routes are included in msl's and it doesn't matter if any of these routes include one way sectors or not.

Sectors 1 thru 10
The Stardock
1 to Stardock
Stardock to 1
Alpha to Stardock
Stardock to Alpha
Rylos to Stardock
Stardock to Rylos
Alpha to Rylos
Rylos to Alpha


Any citadel in the above sectors would go lvl 2 at tern..except 1 and sd which prevent inception.
Fig and mines would be removed except for 1 thru 10 and dock which prevent them being laid.

So all the above would be msl's (major space lanes).

Surrounding all the above would prevent a towed Trader from escaping. Which is the purpose of an Amtrak if any newer player where viewing...we didnt explain..our bad.

_________________
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


Mon Feb 08, 2010 1:00 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
You guys are slacking off. It can be done in less than 19 lines, so let's see some innovative ideas. I think I can do it in 11 lines. Heh, you should prolly call BS on that.

Sometime tomorrow I'll post a conventional ~30 line approach, and my flawed 19 line approach that prompted Sing's 19 liner.

I've also come up with several approaches that yield less than 19 lines, which I'll post as time allows. Maybe they'll spark a few ideas. One used the readToArray idea, which Prom also thought of. Very innovative.

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


Tue Feb 09, 2010 12:35 am
Profile WWW
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: Script Challenge - Amtrak
ElderProphet wrote:
You guys are slacking off. It can be done in less than 19 lines, so let's see some innovative ideas. I think I can do it in 11 lines. Heh, you should prolly call BS on that.

Sometime tomorrow I'll post a conventional ~30 line approach, and my flawed 19 line approach that prompted Sing's 19 liner.

I've also come up with several approaches that yield less than 19 lines, which I'll post as time allows. Maybe they'll spark a few ideas. One used the readToArray idea, which Prom also thought of. Very innovative.


well I usually twarp to amtrak list so good luck to you. I am getting to old for express warping. Pgrid is my more usual style.

_________________
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


Tue Feb 09, 2010 5:59 pm
Profile ICQ YIM
Commander
User avatar

Joined: Fri Jun 09, 2006 2:00 am
Posts: 1402
Location: Canada
Unread post Re: Script Challenge - Amtrak
Hope noone minds.. I'm on vacation and had a little time to sit down and spit something out. Using Sing's macro (can't remember how to write a macro to save my corpies life :D ). Naturally the TXT file has the list of all target sectors --EP tipped me off to that idea.

Code:
readtoarray "C:\MSLs.txt" $ARRAY
while ($i <= ($ARRAY - 1))
   getcourse $PATH CURRENTSECTOR $ARRAY[($i + 1)]
   setvar $a 1
   while ($a <= ($PATH + 1))
      send "mz" & $PATH[$a] & "*nn* z a 99999 * j x n f q z 1 * z c d z * j ** /"
      waiton #179 & "Turns"
      add $a 1
   end
   add $i 1
end

11 Lines. would be 10; except the script needs the waiton to help keep it in pace with the twgs. Also of note; I added the "** /" to the end of sings macro because CURRENTSECTOR does'nt always update properly.

_________________
----------------------------
-= QUANTUM Computing 101: 15 = 3 x 5 ... 48% of the time.


Tue Feb 09, 2010 9:01 pm
Profile ICQ YIM
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Script Challenge - Amtrak
ROTFLOL. Well if we can use external files, then why not just use includes?

Code:
   gosub :amtrack~do_amtrack
   halt
   include "includes/amtrack.ts"

_________________
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


Tue Feb 09, 2010 10:08 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
LS, 2 things. 1, it has to be the complete code, no precreated text files (or includes). 2, that routine doesn't fig surrounding sectors, assuming MSLs.txt just lists the MSL sectors themselves.

The readToArray trick is where you create an array (and count $variable) in just 3 lines of code:
delete file.txt
write file.txt "1*2*3*4*5*6*7*8*9*10*1" // list separated by returns
readToArray file.txt $array

Here is the basic outline for my old amtrak, but realize there are issues with it... mostly that it uses "<" to return to the MSL sector, which breaks if it passes through a one-way.
Code:
setVar $targets "1 2 3 4 5 6 7 8 9 10 1 " & STARDOCK & " " & RYLOS & " " & ALPHACENTAURI & " " & STARDOCK & " " & ALPHACENTAURI & " " & RYLOS & " " & STARDOCK
setVar $lastTarget STARDOCK
setVar $a 1
while ($a <= 18)
   getWord $targets $target $a
   gosub :gridCourse
   setVar $lastTarget $target
   add $a 1
end
halt

:gridCourse
getCourse $course $lastTarget $target
setVar $b 2
while ($b <= ($course + 1))
   setVar $sector $course[$b] // for legibility
   send "mz" $sector "* n n * z a 99999 * * " // no fig
   gosub :gridSector
   add $b 1
end
return

:gridSector
setVar $c 1
while ($c <= SECTOR.WARPCOUNT[$sector])
   setVar $adjacent SECTOR.WARPS[$sector][$c] // for legibility
   send "mz" $adjacent "* n n * z a 99999 * j x n f q z 1 * z c d z * < "
   add $c 1
end
return

Then, if you take that and put the gosub routines inline, and remove the 2 lines for legibility, you get a similarly limited 19 line variant.
Code:
setVar $targets "1 2 3 4 5 6 7 8 9 10 1 " & STARDOCK & " " & RYLOS & " " & ALPHACENTAURI & " " & STARDOCK & " " & ALPHACENTAURI & " " & RYLOS & " " & STARDOCK
setVar $last STARDOCK
setVar $a 1
while ($a <= 18) // $targets has 18 words in it
   getWord $targets $target $a
   getCourse $path $last $target
   setVar $b 2
   while ($b <= ($path + 1))
      send "mz"  $path[$b]  "* n n * z a 99999 * * "
      setVar $c 1
      while ($c <= SECTOR.WARPCOUNT[$path[$b]])
         send "mz" SECTOR.WARPS[$path[$b]][$c] "* n n * z a 99999 * j x n f q z 1 * z c d z * < "
         add $c 1
      end
      add $b 1
   end
   setVar $last $target
   add $a 1
end

I offer those examples as concise code, but the one-way flaw prevents it from being a viable amtrak. Still, use that as a starting point and see what you can do with it.

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


Wed Feb 10, 2010 7:47 am
Profile WWW
Commander
User avatar

Joined: Fri Jun 09, 2006 2:00 am
Posts: 1402
Location: Canada
Unread post Re: Script Challenge - Amtrak
Singularity wrote:
ROTFLOL. Well if we can use external files, then why not just use includes?

Code:
   gosub :amtrack~do_amtrack
   halt
   include "includes/amtrack.ts"


Actually... the GoSub OR Halt isn't needed... twx wil automatically run the code in the file mentioned in the include file. So all you need is:
Code:
include "includes/amtrack.ts"


Quote:
LS, 2 things. 1, it has to be the complete code, no precreated text files (or includes). 2, that routine doesn't fig surrounding sectors, assuming MSLs.txt just lists the MSL sectors themselves.


Sorry. Seemed to me an awful lot of assumptions were being made.. not sure why the so called 'Target' list can't also include the MSL Adjacents. Case and Point: Everyone is using GetCourse, which assumes that a complete map already exists. If this isn't an accurate assumption, then I'd have to ask why nobody's code accounts for a possible "-1" returned by GetCourse? Seems logical to have a already generated list of 'Target' Sectors.

Fewest-line challenges are good; in this case I think the challenge should cover a few 'basic' and realistic eventuallities.

Looking forward to the solution.

_________________
----------------------------
-= QUANTUM Computing 101: 15 = 3 x 5 ... 48% of the time.


Wed Feb 10, 2010 2:16 pm
Profile ICQ YIM
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: Script Challenge - Amtrak
LoneStar wrote:
Fewest-line challenges are good; in this case I think the challenge should cover a few 'basic' and realistic eventuallities.

Looking forward to the solution.



well do a dscan from each sector along the msl and you will get the adj map.

_________________
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


Wed Feb 10, 2010 6:12 pm
Profile ICQ YIM
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Script Challenge - Amtrak
Quote:
Actually... the GoSub OR Halt isn't needed... twx wil automatically run the code in
the file mentioned in the include file. So all you need is:


Yes, but that assumes your include is structured a particular way. If you use gosubs, it's
likely things will be called out-of-order

Quote:
Fewest-line challenges are good; in this case I think the challenge should cover a
few 'basic' and realistic eventuallities.


Agreed, in reality there's a lot more to consider.

Quote:
well do a dscan from each sector along the msl and you will get the adj map.


Dscan or sector display. But, that only works if the prior getCourse didn't return a -1.

_________________
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


Wed Feb 10, 2010 8:06 pm
Profile ICQ WWW
Commander
User avatar

Joined: Wed May 03, 2006 2:00 am
Posts: 1722
Location: USA
Unread post Re: Script Challenge - Amtrak
So for the record...

Code:
Load amtrak.ts


Doesn't count as the winning entry for one line? :(

_________________
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


Wed Feb 10, 2010 8:54 pm
Profile ICQ YIM
Veteran Op

Joined: Tue Nov 28, 2006 4:04 pm
Posts: 5025
Unread post Re: Script Challenge - Amtrak
Parrothead wrote:
So for the record...

Code:
Load amtrak.ts


Doesn't count as the winning entry for one line? :(


Actually I can do it in 0 lines.
Right click on twx icon, left click on load script, position arrow on amtrak script, and left click again.
Beat that...


Wed Feb 10, 2010 9:07 pm
Profile
Lieutenant J.G.
User avatar

Joined: Sun Mar 13, 2005 3:00 am
Posts: 387
Location: USA
Unread post Re: Script Challenge - Amtrak
I asked this question before and got an answer but I do not think you think what I think I think.

setVar $targets "1 2 3 4 5 6 7 8 9 10 1 " & STARDOCK & " " & RYLOS & " " & ALPHACENTAURI & " " & STARDOCK & " " & ALPHACENTAURI & " " & RYLOS & " " & STARDOCK

Where is the route from stardock to terrra in this?
from what I see we have
Terra to Fedspace
Terra to SD
SD to Rylos
Rylos to AC
AC to SD and back again
AC to Rylos and Rylos to SD

Yes I agree that it is only one more character but in our haste to be concise we forgot about the SD to Terra route
and while we were at that we used a constant for the length of the target array.

That is 2 errors that I have spotted after looking for about 5 minutes.
Also while not errors the variable names targets and target WILL cause confusion at some point

Also just looking at the code what happens when there is a planet with cannons set to sector fire and
you go and attempt to grid it?

Yes if you are only interested in figging MSL's then cannons shouldn't be a problem because you will only use
this after tern when planets in MSL's will get downgraded to level 2.

_________________
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


Wed Feb 10, 2010 10:01 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
Maniac wrote:
Where is the route from stardock to terrra in this?


It's not there, but it's easily added. Just go from 10 to stardock, stardock back to 1, then 1 to stardock.

Maniac wrote:
Also just looking at the code what happens when there is a planet with cannons set to
sector fire and you go and attempt to grid it?


Well, if we're going to try to make it safe you're going to have a completely different script. None of
this is torp safe. Or turn efficient. In the real world, it'd be completely different.

Maniac wrote:
Yes if you are only interested in figging MSL's then cannons shouldn't be a problem because you will only use
this after tern when planets in MSL's will get downgraded to level 2.


Actually, you'd run an amtrack right before extern, to lock in towees.

_________________
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


Wed Feb 10, 2010 10:31 pm
Profile ICQ WWW
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 39 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.