BeachComber - fast and efficient beach combing

Veracity

Developer
I have published BeachComber.ash to SVN. Use it like this:

BeachComber 0

Use all of your remaining free walks to go to random sections of beach to comb the "best" thing it finds there

BeachComber 10

Use up free walks, as above, and then spend 10 turns going to 10 more random sections of beach and combing

It uses the properties that KoLmafia automatically sets for you when you visit a section of beach - _beachMinutes and _beachLayout

Code:
[color=green]> set VBC.PickStrategy=random[/color]

VBC.PickStrategy => random

[color=green]> BeachComber 4[/color]

Encounter: Comb the Beach
Submitting option 5 for choice 1388
Combed 0 patches of beach using no turns.
Encounter: Comb the Beach
Submitting option 2 for choice 1388
Encounter: Comb the Beach (1229 minutes down the beach)
2 squares in beach 1229 contain combed sand
88 squares in beach 1229 contain rough sand
Combing the square at coordinates 8,12283 which contains rough sand
Encounter: Comb the Beach
You acquire an item: beach glass bead
You acquire grain of sand (3)
Submitting option 2 for choice 1388
Encounter: Comb the Beach (9497 minutes down the beach)
1 squares in beach 9497 contain combed sand
89 squares in beach 9497 contain rough sand
Combing the square at coordinates 7,94962 which contains rough sand
Encounter: Comb the Beach
You acquire an item: bunch of sea grapes
You acquire grain of sand (3)
Submitting option 2 for choice 1388
Encounter: Comb the Beach (4160 minutes down the beach)
2 squares in beach 4160 contain combed sand
88 squares in beach 4160 contain rough sand
Combing the square at coordinates 3,41598 which contains rough sand
Encounter: Comb the Beach
You acquire an item: kelp
You acquire grain of sand (4)
Submitting option 2 for choice 1388
Encounter: Comb the Beach (9623 minutes down the beach)
90 squares in beach 9623 contain rough sand
Combing the square at coordinates 7,96225 which contains rough sand
Encounter: Comb the Beach
You acquire an item: bunch of sea grapes
You acquire grain of sand (4)
Submitting option 5 for choice 1388
Combed 4 patches of beach using turns.

Edit 1:

I changed the name to BeachComber and released it via svn:

Code:
svn checkout https://svn.code.sf.net/p/veracity0/code/beach
It has two configurable properties:

VBC.Priorities is a list of square types in priority order:

W - a beached whale
? - unknown
C - a sand castle
r - rough sand
c - combed sand
H - a beach head

Default:

set VBC.Priorities=W,?,C,r,c

VBC.PickStrategy specifies the strategy use to pick a square on the random beach:

first - pick the leftmost square closest to the sea with the highest available type
random - pick a random square that contains the hight available type

Default:

set VBC.PickStrategy=first
 
Last edited:

Magus_Prime

Active member
It worked well. Thank you. The only thing I can think of to change would be adding an aggregate tally of everything found after however many beachcombing actions were specified.
 

Veracity

Developer
Renamed it to BeachComber, changed the initial comment, and published to SVN.

Made the square priority order configurable and added a "strategy" configurtion which will allow you to either go to the first (leftmost, closest to sea) or random square of the highest priority.

I suppose I now need to check the configuration to validate the strategy name and to comb somewhere, at least, if you only prioritize squares which are not present. There will always be rough sand - except for the super degenerate case where somebody has combed it all...

And a cumulative item tally would be nice, as Magus_Prime suggested.

Now that one of my multis bought one of these, I can continue experimenting with this even while my main is chaining runs to finish TCRS, accumulate enough swagger, and finish up the Standard SC ascensions for the year.
 
Last edited:

Yendor

Member
I'm finding this stops if it's set to random and only finds one of its highest priority:
Code:
Encounter: Comb the Beach (3080 minutes down the beach)
1 squares in beach 3080 contain a sand castle
1 squares in beach 3080 contain combed sand
98 squares in beach 3080 contain rough sand
Random range must be at least 2 (beachcomber.ash, line 209)
  at pick_random_coords_to_comb (beachcomber.ash:209)
  at pick_coords_to_comb (beachcomber.ash:251)
  at comb_random_beach (beachcomber.ash:286)
  at beach_comb_turns (beachcomber.ash:316)
  at beach_comb_turns_only (beachcomber.ash:337)
  at main (beachcomber.ash:358)
 

Veracity

Developer
Thanks, Yendor.

Revision 187:

Changed the configuration options from "VCB.*" to "VBC.*" Sorry.
Validate configuration options.
If you do not specify 'r' or 'c' in VBC.Priorities, you get them anyway at end.
Options in VBC.Priorities are now separated with ',', not '|'. Default is now "W,?,C,r,c".
And when using "random", only call random() if there is more than one square with the requested square type.
 

Veracity

Developer
Revision 188 now tallies the number of times you comb a type of beach square and prints it at the end.

Code:
Combed 229 patches of beach using turns.

Combed a sand castle 5 times.
Combed rough sand 224 times.

Items combed:
seal tooth (1)
taco shell (12)
coconut shell (1)
dull fish scale (5)
rough fish scale (1)
sea salt crystal (1)
sea carrot (14)
sea cucumber (8)
sea avocado (14)
sand dollar (4)
sea grease (1)
sea jelly (1)
grain of sand (639)
magenta seashell (25)
cyan seashell (21)
gray seashell (24)
green seashell (23)
yellow seashell (22)
bunch of sea grapes (18)
kelp (32)
waders (1)
 

coandco

New member
I'm getting this seemingly at random when using the default BeachComber 0 functionality. The first time I tried it, it used 7 of my 10 free walks before crashing:
Code:
> BeachComber 0

Validating configuration.
All is well!
Encounter: Comb the Beach
Submitting option 2 for choice 1388
Encounter: Comb the Beach (5925 minutes down the beach)
Combing the square at coordinates 2,59245 which contains a sand castle
Encounter: Comb the Beach
You acquire an item: driftwood pants
You acquire grain of sand (2)
Submitting option 2 for choice 1388
Encounter: Comb the Beach (1618 minutes down the beach)
Combing the square at coordinates 7,16171 which contains a sand castle
Encounter: Comb the Beach
You acquire an item: bunch of sea grapes
You acquire grain of sand (2)
Submitting option 2 for choice 1388
Encounter: Comb the Beach (9821 minutes down the beach)
Combing the square at coordinates 2,98210 which contains a sand castle
Encounter: Comb the Beach
You acquire an item: bunch of sea grapes
You acquire grain of sand (3)
Submitting option 2 for choice 1388
Encounter: Comb the Beach (823 minutes down the beach)
Combing the square at coordinates 2,8221 which contains a sand castle
Encounter: Comb the Beach
You acquire an item: sea cucumber
You acquire grain of sand (3)
Submitting option 2 for choice 1388
Encounter: Comb the Beach (5765 minutes down the beach)
Combing the square at coordinates 6,57647 which contains a sand castle
Encounter: Comb the Beach
You acquire an item: taco shell
You acquire grain of sand (2)
Submitting option 2 for choice 1388
Encounter: Comb the Beach (4119 minutes down the beach)
Combing the square at coordinates 2,41190 which contains a sand castle
Encounter: Comb the Beach
You acquire an item: kelp
You acquire grain of sand (3)
Submitting option 2 for choice 1388
Encounter: Comb the Beach (9581 minutes down the beach)
Combing the square at coordinates 2,95810 which contains a sand castle
Encounter: Comb the Beach
You acquire an item: driftwood hat
You acquire grain of sand (4)
Submitting option 2 for choice 1388
Encounter: Comb the Beach (3196 minutes down the beach)

Combed a sand castle 7 times.

Items combed:
taco shell (1)
sea cucumber (1)
grain of sand (19)
bunch of sea grapes (2)
kelp (1)
driftwood hat (1)
driftwood pants (1)
Offset 0 out of bounds (BeachComber.ash, line 223)
  at square_at (BeachComber.ash:223)
  at comb_random_beach (BeachComber.ash:352)
  at beach_comb_free (BeachComber.ash:373)
  at beach_comb_free_only (BeachComber.ash:396)
  at main (BeachComber.ash:425)
You have the latest use_for_items.txt. Will not check again today.
 
Last edited:

Veracity

Developer
You need to update KoLmafia. "Combed a sand castle 7 times" seems impossible. A sand castle is a "C" - but "combed sand" used to be "C", although it is now "c". I made that change in 19381 and forgot to update the "since" in this script. So, with the old version, it was looking only for combed sand - and when you got a beach which didn't have any, it crashed.

Revision 190 of this script does this:

Requires KoLmafia r19381
Removes "sand castle" from default squares we will comb. Nothing special in them. Leave them for people to smash when they are manually combing the beach.
Looks for messages in bottles (per forum rumor) and finds one, save the page HTML in file in your "data" directory.

YOUR_NAME_bottle_message_20190716113431308.txt

It'll log this at the end. If you get one, upload it here, please, so we can look at it and figure out how to parse out the message. Thanks.
 

Damien

New member
So, for some unknown reason, I am unable to see the script in svn. Any advice? I'm on the latest version as far as I can tell.
 

fronobulax

Developer
So, for some unknown reason, I am unable to see the script in svn. Any advice? I'm on the latest version as far as I can tell.

Do you mean you are having trouble getting it from SourceForge or do you mean it is not showing up in Kolmafia's Script Manager? If the latter then the file that drives the manager has been getting changed a lot and it is possible that you snagged a version that is no longer the best. Under normal circumstances KoLmafia will only try and fetch that file once a day so the first suggestion would be to try again. A second suggestion would be to delete svnrepo.json in your data subdirectory and try again. The menu is getting quite full and you might try and sort on author's name in both the Manage and Install tabs. (Veracity). If you find it on the Manage tab then it is already installed. Otherwise it should be on the Install tab.

There is a possibility of errors in the file but since I am not seeing them on my system I am focused on how your system's status might be different.
 

Damien

New member
Ok, to clarify my issue, I can't see in the script manager. I search for "Beach", but there aren't any results.
 

Damien

New member
A second suggestion would be to delete svnrepo.json in your data subdirectory and try again.
So, I did what you tried and deleted the file, and I have run into a minor issue, and now I can't see any scripts. It seems that mafia hasn't reinstalled the file, though the scripts I already downloaded are still there.
 

fronobulax

Developer
So, I did what you tried and deleted the file, and I have run into a minor issue, and now I can't see any scripts. It seems that mafia hasn't reinstalled the file, though the scripts I already downloaded are still there.

The code, as I understand it is supposed to unconditionally download the file if it is not there. Perhaps I have erred and the once a day preference overrides the download. Hopefully when you try again things will work.

My understanding is that mafia tries to down load and read the file. Then, whether the file was downloaded or not, it builds the Scripts menu by traversing your svn directory (which contains installed scripts). If somethign in svn had an entry in the file then it merges the information. If something is in svn but not in the file (for whatever reason) it still includes an entry in the Scripts menu. Entries that are in the file but not in svn show up under the Install tab.

So if it works tomorrow, all is good. If not then, with my recent change, if you have no svnrepo.json file then you are having an issue downloading.
 

Veracity

Developer
Revision 192 does this:

Default strategy is now "random".
A driftwood beach comb is as good as a Beach Comb, as far as this script is concerend.
Command argument can be a (positive) number, "free", or "all".

And I like "random". This happened this morning when I was using up my remaining turns before ascending:

Code:
Encounter: Comb the Beach (4819 minutes down the beach)
> 100 squares in beach 4819 contain rough sand
> Combing the square at coordinates 10,48190 which contains rough sand
Took choice 1388/4: (secret choice)
choice.php?whichchoice=1388&option=4&coords=10%2C48190
Encounter: Comb the Beach
You acquire an item: cursed pirate cutlass
You acquire hamethyst (5)
You acquire baconstone (5)
You acquire porquoise (5)
You gain 218,390 Meat
That's on row 10 - the farthest from the waves. Had I been using "first", it would have gone to the row that is closest to the sea.
Not that that probably matters; I suspect the contents of each square are random, rather than pre-seeded.

Hmm. I just noticed I got a bunch-o-Meat. I need to report that at the end, along with the cumulative items.
 
Top