| www.ClassicTW.com https://mail.black-squirrel.com/ |
|
| proBubble https://mail.black-squirrel.com/viewtopic.php?f=15&t=21335 |
Page 1 of 1 |
| Author: | Promethius [ Fri Dec 26, 2008 10:32 pm ] |
| Post subject: | proBubble |
If anyone is interested in a bubble finder / bubble sector list script let me know. I have tested it some and found it fairly accurate - finding bubbles of 3 to approx 190 sectors (about 7-8 large bubbles in the game). The output may be a bit slow - about 2 minutes for 20k sectors, but that includes outputting the data to a file (gate sector plus bubble sectors and distances from Terra and Dock for the gate). I really don't know how fast a bubble finder should run in TWX so this may be fast, slow or somewhere in between the two. The bubbles are a bit weird sometimes - the gate may be to two or more adjoining bubbles where a lane runs through the gate so you might want to check that when you decide to build. Also the bubbles may have sectors that allow you to move out of the bubble, but there "shouldn't" be any back doors. All I ask in return for the script is that you let me know about its accuracy and any bugs. PM on this site or hit me on ICQ. [Edit] Although I took it for granted, you do HAVE to have a ZTM [/Edit] [Edit2] There is no maximum on the number of sectors for a bubble in the script, but, the minimum is set to 3 [/Edit2] |
|
| Author: | Quaser [ Fri Dec 26, 2008 11:36 pm ] |
| Post subject: | Re: proBubble |
Am intrested, could you email it to me quaser101@yahoo.com and will let you know how it works. |
|
| Author: | Kaus [ Sat Dec 27, 2008 11:30 am ] |
| Post subject: | Re: proBubble |
Interested |
|
| Author: | Promethius [ Sat Dec 27, 2008 3:10 pm ] |
| Post subject: | Re: proBubble |
Kaus wrote: Interested Please PM me your email addy. I thought I had it, but don't see it. I now have about 7 players testing the script and that should give me some feedback on the results, good and bad. This is the first bubble script I have written and if it goes well, I will post the .ts source - about 116 lines of it which seems fairly compact, but could be made smaller I think. For scripters, the concept I used is fairly simple - maybe too simple, but we will find out. The script uses a single pass and detects sectors of more than 2 warps that can be blocked by an avoid. The script will then do a walk through of the bubble after verifying that no backdoors exist. After a walk through, and if 3 or more sectors are found, it will capture the results to an echo and to a file. The echo is just the gateway sector and number of sectors in the bubble. Bubbles within a bubble may pose a bit of a problem with this script. I really had not thought too much about them so it is possible I may need to add a fix for that. The fix would be a simple array reset I believe. At any rate, we will see what happens. |
|
| Author: | Singularity [ Sat Dec 27, 2008 3:44 pm ] |
| Post subject: | Re: proBubble |
Quote: Bubbles within a bubble may pose a bit of a problem with this script. I really had not thought too much about them so it is possible I may need to add a fix for that. The fix would be a simple array reset I believe. How so? I'd just use a sort by distance from terra, plus an array IsInBubble or something. Do a BFS/DFS w/ the sector out avoided, mark any sectors found as IsInBubble, and obviously don't re-check those already found. Using the avoids trick is a good idea tho for finding single door bubbles, would be a good way to limit the number of gateways in the search. I think EP has a single-pass bubble using a BFS w/ a count instead of a Visited array, or something to that effect. |
|
| Author: | Promethius [ Sat Dec 27, 2008 4:41 pm ] |
| Post subject: | Re: proBubble |
For those testing the script, you have another version in your email that fixes the bubble-in-a-bubble problem. I also included the ability to select your own minimum and maximum bubble sizes. The defaults are 3 for a minimum and 500 for a maximum, but change them to meet your own needs. |
|
| Author: | Promethius [ Sun Dec 28, 2008 4:14 pm ] |
| Post subject: | Re: proBubble - Source |
Even though the script is posted as .cts, I am releasing the source so people can tweak it to output what they need. The script may not be as efficient as it could be, but it works.... One thing that is different in the source and the .cts is that the source includes the warp count of the gateway sector in the file output: Gateway: " & $bubbleGate & " (" & $dispWarpCnt & "-Warps) I am certain there is some redundant use of vars that could be eliminated and other tweaks that can be made. Code: # proBubble.ts by Promethius # Dec 2008 # Find bubbles after ZTM # Bubble finder / bubble sector list # To do: Add option to restrict gates displayed by the number of adjacent warps # # Setup menu vars and version setVar $minBubbleSize 3 setVar $maxBubbleSize 500 setVar $version "ProBubble v1.0" :menu echo ANSI_14 "** " $version ANSI_11 " by Promethius*" echo ANSI_12 "*1. " ANSI_15 "Enter the minimum bubble size. Current is: " ANSI_12 $minBubbleSize echo ANSI_12 "*2. " ANSI_15 "Enter the maximum bubble size. Current is: " ANSI_12 $maxBubbleSize echo ANSI_12 "*3. " ANSI_13 "Run it*" getConsoleInput $menuChoice SINGLEKEY if ($menuChoice = 1) echo ANSI_11 "*Enter the new " ANSI_12 "minimum " ANSI_11 "bubble size*" getConsoleInput $minBubbleSize elseif ($menuChoice = 2) echo ANSI_11 "*Enter the new " ANSI_12 "maximum " ANSI_11 "bubble size*" getConsoleInput $maxBubbleSize elseif ($menuChoice = 3) goto :runIt end goto :menu :runIt setVar $totalBubbles 0 # delete the current file if it exists delete GAMENAME & "_bubbleSectors" & ".txt" # don't care about gates from Fed so set to 11 setVar $idx 11 # clear all internal TWX avoids clearallavoids while ($idx <= SECTORS) # don't want "gates" with only 1-warp sector that can be blocked or has backdoors if (sector.warpcount[$idx] > 1) and (sector.backdoorcount[$idx] = 0) setAvoid $idx setVar $warpCnt sector.warpcount[$idx] setVar $counter 1 while ($counter <= $warpCnt) # get our adjacent sectors to the gate setVar $adj sector.warps[$idx][$counter] if (sector.warpCount[$adj] > 1) and (sector.backdoorcount[$adj] = 0) # check course from terra to our adjacent after voiding the gate above ($idx) getCourse $course 1 $adj if ($course < 0) # no warps to our adjacent, check from adjacent to terra getCourse $course $adj 1 if ($course < 0) gosub :checkBubbles end end end add $counter 1 end # clear the void from our gate clearAvoid $idx end add $idx 1 end # we are done so give the user some information echo ANSI_11 "** Possible gateways: " $totalBubbles "*" echo ANSI_15 "*File saved as: " ANSI_14 GAMENAME & "_bubbleSectors" & ".txt *" clearallavoids halt :checkbubbles setVar $i 1 setVar $move 0 setVar $bubbleSectorCnt 0 setVar $ptr 0 setVar $test "" setVar $bubbleGate $idx setArray $atTop SECTORS setArray $sectorFound SECTORS # get sector(s) ajacent to gate in bubble # mark our gate as found (True) setVar $sectorFound[$bubbleGate] TRUE setAvoid $bubbleGate # loop all adjacent sectors to find our bubble start(s) while ($i <= sector.warpcount[$bubbleGate]) getCourse $chkCourse 1 sector.warps[$bubbleGate][$i] if ($chkCourse < 0) add $move 1 setVar $atTop[$move] sector.warps[$bubbleGate][$i] setVar $sectorFound[$atTop[$move]] TRUE setVar $test $test & $atTop[$move] & " " end add $i 1 end :topQueue if ($test = "") return end setVar $bubbleSectorCnt $move setVar $ptr 1 # if our current sector <> 0, walk through the bubble while ($atTop[$ptr] <> 0) gosub :childQueue end goto :writefile :childQueue setVar $i 1 # basically the same as for the gate, but for the "child" sectors on voiding while ($i <= sector.warpcount[$atTop[$ptr]]) # make sure the adjacent isn't a 1-way from the current sector getdistance $dist sector.warps[$atTop[$ptr]][$i] $atTop[$ptr] if ($dist = 1) and ($sectorFound[sector.warps[$atTop[$ptr]][$i]] = FALSE) add $move 1 add $bubbleSectorCnt 1 # add the sectors found to our "top" queue to have its "children" checked setVar $atTop[$move] sector.warps[$atTop[$ptr]][$i] # mark found as true so we don't include it several times in our list setVar $sectorFound[sector.warps[$atTop[$ptr]][$i]] TRUE end add $i 1 end add $ptr 1 return :writeFile # write a list of sectors # clear the void for the bubble gate clearAvoid $bubbleGate # if the size isn't within our menu parameters, return if ($bubbleSectorCnt < $minBubbleSize) or ($bubbleSectorCnt > $maxBubbleSize) return end add $totalBubbles 1 # distances from terra and from dock getDistance $distTerra 1 $bubbleGate getDistance $distDock STARDOCK $bubbleGate # a little formatting so our output looks somewhat decent getLength $bubbleGate $len setVar $padleft "" while ($len < 5) setVar $padLeft $padLeft & " " add $len 1 end setVar $padSize "" getLength $bubbleSectorCnt $len while ($len < 3) setVar $padSize $padSize & " " add $len 1 end echo ansi_12 "*!!!! " ANSI_15 "Bubble " ANSI_14 $padLeft $bubbleGate ANSI_15 " Contains " ANSI_11 $padSize $bubbleSectorCnt ANSI_15 " Sectors" ANSI_12 " !!!!" setVar $dispWarpCnt sector.warpcount[$bubbleGate] setVar $i 1 write GAMENAME & "_bubbleSectors" & ".txt" "Gateway: " & $bubbleGate & " (" & $dispWarpCnt & "-Warps) - " & $bubbleSectorCnt & " Sectors, Hop: " & $distTerra & " From Terra, " & $distDock & " From Dock" while ($i <= $bubbleSectorCnt) write GAMENAME & "_bubbleSectors" & ".txt" $atTop[$i] add $i 1 end write GAMENAME & "_bubbleSectors" & ".txt" " " # return to topQueue return |
|
| Page 1 of 1 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|