BeachComber - fast and efficient beach combing

Today I migrated this from sourceforge using SVN to github using GIT.
Future updates will be pushed only to the latter.

I suggest you delete the SVN version (make sure you have KoLmafia r27304!) and then install it via GIT:

Code:
git checkout Veracity0/beach
 
I've been using combo happily for about a year and a half now, but I recently learned something interesting: it doesn't actually have data on all the rare tiles. There is at least one user I could name (and how many others?) who has a personal set of known-to-them but unshared rare tiles. I don't roll that way; I'm not interested in "hoarding" info for my personal profit. I guess I'm a pretty poor capitalist, eh? ;)

In any case, this script has one advantage over combo for "solving" that problem: combo goes to only "minutes down the beach" that are known to have at least one rare tile, whereas this script goes to random "minutes down the beach". Either script COULD record newly discovered "rare" tiles and augment the list of "known" rare tiles - although neither does, currently - but this script is likely to discover more of them.

I want to change this script in these ways:

1) Have a raretiles.json data file - seeded from combo's file - which has all "known" rare tiles.
2) Recognize (from what dropped) what constitutes a rare tile.
3) If we discover a new rare tile, add it to raretiles.new.json
4) Periodically submit such discoveries to combo.
5) Refactor the basic algorithm to do this:

Code:
while there are turns left you want to spend combing
   go to a random number of minutes down the beach
   if there is a whale
     comb it
     if we don't know this is a rare tile
       record it
   while there are uncombed known rare tiles
     comb it
   while there are uncombed twinkly tiles
     comb it
     if it is a rare tile
       record it
   if we found nothing to comb
     comb a rough or combed sand tile

Obviously, that is not complete; if we run out of desired turns without completing the rare or twinkly tiles on a particular beach map, we need to stop. But that's the general idea.

6) I already print the results of combing - by types of tile combed.
I'd like to keep a "cumulative findings" file, per user, like combo does.

I have a couple of ASH bugs/features to do first - it would make my code cleaner if I could have a map keyed by records, for example, although I can work around that - but this will be my next project.
 
Yeah it hasn't been easy getting more data for combo. I did add support for excavator a while ago to log beach data that it encounters, but anyone running combo wouldn't be gathering any new data since the tiles for those minutes are fully logged and for it to be able to log any new rare tiles they have to not be combed already which makes it even more rare to catch.
 
Last edited:
I have added support for spading.

Code:
> BeachComber help

BeachComber PARAM...
    free: comb beach using only free wanders
    all: comb beach using free wanders and all remaining turns
    NUMBER: comb beach using free wanders and specified number of turns

    random: visit random sections of the beach
    spade: methodically visit successive sections of the beach
    minutes=NUMBER: visit specific section of the beach

    help: print this message
    data: load, analyze, and print tile data, and then exit

I made 5 characters talk to Grandpa Seamonkey and get the ability to see twinkles and then sent them to "BeachComber spade all" today, and now I have:

Code:
> BeachComber data

Validating configuration.
All is well!

Unvisited twinkle tiles: 0
Known rare tiles: 849
Verified rare tiles: 1
Erroneous rare tiles: 0
New rare tiles: 0
Known uncommon tiles: 0
New uncommon tiles: 2115
Last minutes down the beach spaded: 576

Beaches with rare tiles: 807
Beaches with uncommon tiles: 544
Beaches with unvisited twinkles: 0

The "known rare tiles" is from combo. Visiting 576 squares and combing all twinkles, I found 1 square that combo knew about - which is why it is marked "verified" - and no other rare tiles. If I ever visit one of combo's rare squares and get an "uncommon" result, I'll put that one in erroneous rare tiles.

I think this will be an extensive project. Eventually, I hope to have more tiles to submit to combo. :)

I put all of this data in a "beach" directory underneath KoLmafia's "data" directory.

spade.minutes.txt
tiles.rare.errors.json
tiles.rare.json
tiles.rare.new.json
tiles.rare.seen.json
tiles.twinkle.json
tiles.uncommon.json
tiles.uncommon.new.json

This is all in data, rather than properties, so that multiple characters can share it - as my spading characters are doing.
The JSON is 100% compatible with combo.
 
Coming soon will be support to visit squares with known rare tiles and comb all such, if they are not yet combed.
Which is to say, the functional equivalent of what combo does.
Except, with the additional spading support in this script, if I go to the section of the beach and see that the rare tile is not combed, if it is either not twinkly or visiting it gives an "uncommon" reward, I'll put it into tiles.rare.errors.json

(The Wiki categorizes tiles as "frequent", "infrequent", and "scarce". combo uses "rare" - and I rather like that. I have "common", "uncommon", and "rare" - just like Magic cards. :))
 
You might add an option to set what % of combs should be used for spading, so that users can choose to spend a portion of their turns collecting data for this community project, without totally ruining their chances of hitting the jackpot. I would also suggest setting something like 10% spading turns as the default option, if not explicitly chosen by the user.
 
Good idea. That would be a Preference, rather than shared data.

You notice I am collecting “uncommon” squares. That’s to enable an improved square picking strategy.

When visiting a square, choose a tile in this order:

1) a whale
2) a known rare tile
3) a hitherto unknown twinkle
4) as a last resort, a known uncommon twinkle, rough sand, combed sand

So, rather than combing all twinkles, only comb the rares and unknown ones before moving to another square.

My characters who are cycling through squares spading will likely be able to visit three times as many squares per day - and I’ll be able to cycle through all 10,000 in a week or less.
 
Revision 3 has this:

Visit tiles in the following order.
  1. a whale
  2. a known rare tile
  3. a hitherto unknown twinkle
  4. a known uncommon tile
  5. rough sand
  6. combed sand
Since not everybody can see twinkles (why not?), if there are no twinkles, look in rough sand for known rare and uncommon tiles before settling for rough sand.
 
Revision 4 saves results in data/beach/results.json.
At the end of a session, it reads the old results, adds in the new ones, and writes out the new tally.

(This is for all characters; I attempted per-character results, but ASH threw an error trying to read the file to update before it had been created.)

It has a JSON object:

{"uncommon":0,"common":1,"rare":0,"meat":0,"items":{"bunch of sea grapes":1,"grain of sand":4}}
 
Revision 5 adds "rare" mode. That will visit only sections of the beach that have known rare tiles.
Since that's what combo does, you'll almost always discover somebody else has gotten there before you.
Although, while testing this, I did happen to comb a cursed pirate hoard and get me a cursed swash buckle.
Aaargh, matey!

BeachComber free rare

will use up your free turns hunting rare booty.
"rare" mode is the default.

My strategy differs from combo's.

Combo randomly (deterministic by your player id) shuffles all the tiles it knows about and visits them in order, continuing the next day where it left off. That does guarantee you will visit every square before you repeat.

Since squares DO regenerate - at an unknown rate, but definitely not "at rollover" - I'm not sure how useful that is. This script randomly selects a beach segment from all rare segments that you have not visited yet this execution.

I might change this, by and by, but I'm reasonably happy with it for now.
 
Revision 6 has a couple teaks.

1) BeachComber data

can be run even if you don't have a Beach Comb or driftwood beach comb - or even not-logged-in if you want to see the current stats.

Code:
Unvisited twinkle tiles: 0
Known rare tiles: 849
Verified rare tiles: 11
Erroneous rare tiles: 0
New rare tiles: 0
Known uncommon tiles: 6002
New uncommon tiles: 0
Last minutes down the beach spaded: 1571

Beaches with rare tiles: 807
Beaches with uncommon tiles: 1535
Beaches with unvisited twinkles: 0

(My characters have visited beaches 1-1571, and many other squares, so far.)

2) BeachComber rare first

Visits known "rare" squares and combs the "best" square

3) BeachComber rare twinkle

As above, but will return to visit any previously unknown twinkles.
Which is to say, a little bit of spading.

My main did this today for a bunch of turns - and found a cursed pirate cutlass.
It saved the HTML for this in "beach" - as we do for other "special" findings - in case you want to look at it.
("special" findings: whale on beach AND when combed, pirate trove, meteorite fragment, rainbow pearl, message in a bottle.)
I'm enjoying this script.
 
And revision 7 includes the tile coordinates in saved HTML file names, so you can see where you combed.
(I have no idea why I didn't do that originally.)

I manually renamed my saved HTML files in data/beach after looking at session logs to figure out what generated them:

Code:
   37712 Aug 18  2020 Veracity_355_2_3_20200818162017165.txt
   17560 Aug 18  2020 Veracity_355_2_3_20200818162017779.txt
   17531 Nov 27  2019 Veracity_3676_4_6_20191127151821207.txt
   18735 Aug 19 05:55 Veracity_5540_9_5_20230819055519801.txt

I have a beached whale on the beach & after being combed, a message in a bottle, and a cursed pirate cutlass.
It's been a while; combo found me several things, but only BeachComber saves the HTML for me to look at.
I'd have liked to have seen the meteorite fragment combo found for me.

Also fixed a bug with bogus logging:

Code:
> Looking for rare tile at (5540,99,85)
...
> Combing the square at coordinates (5540,9,5) which contains rough sand with a twinkle
...
> (5540,9,5) is a 'rare' tile.

I mean, it went to the square it was intending to go to, but "Looking for rare tile at ..." was misleading.
 
Surely saved HTML files should be .html, not .txt

Edit: revision 8 makes it so.
 
Last edited:
Revision 9 does this:

1) Bug: If you visit a beach with known uncommon tiles and twinkles, if all the twinkles are previously known, instead of visiting an active known twinkle - and getting an uncommon reward - we might visit an already combed known twinkle. I fixed that.
2) I added the ability to merge newly discovered (since last release) uncommon tiles into the known uncommon tiles, thus preparing them for release.
3) I submitted updated tiles.rare.seen.json and tiles.uncommon.new.json data files.

Current state of my spading:

Code:
Unvisited twinkle tiles: 0
Known rare tiles: 849
Verified rare tiles: 18
Erroneous rare tiles: 0
New rare tiles: 1
Known uncommon tiles: 9805
New uncommon tiles: 0
Last minutes down the beach spaded: 2993

Beaches with rare tiles: 807
Beaches with uncommon tiles: 2759
Beaches with unvisited twinkles: 0

I'm spading about 500 tiles a day.
Another two weeks or so and I will have visited all 1-10000 minutes down the beach and will have discovered the vast majority of uncommon tiles.
(The only missing ones will be those that were already combed when a combo user - or one of the people hoarding their own rare tiles - have already combed a rare tile and subsequent visits have combed an uncommon one.)
I'll be making a pass through all 10,000 beaches once a week or so, thereafter.
I hope to beat out some of those aforementioned rare-combers and either verify known rare tiles or discover new ones.
 
Revision 9 does this:

1) Bug: If you visit a beach with known uncommon tiles and twinkles, if all the twinkles are previously known, instead of visiting an active known twinkle - and getting an uncommon reward - we might visit an already combed known twinkle. I fixed that.
2) I added the ability to merge newly discovered (since last release) uncommon tiles into the known uncommon tiles, thus preparing them for release.
3) I submitted updated tiles.rare.seen.json and tiles.uncommon.new.json data files.

Current state of my spading:

Code:
Unvisited twinkle tiles: 0
Known rare tiles: 849
Verified rare tiles: 18
Erroneous rare tiles: 0
New rare tiles: 1
Known uncommon tiles: 9805
New uncommon tiles: 0
Last minutes down the beach spaded: 2993

Beaches with rare tiles: 807
Beaches with uncommon tiles: 2759
Beaches with unvisited twinkles: 0

I'm spading about 500 tiles a day.
Another two weeks or so and I will have visited all 1-10000 minutes down the beach and will have discovered the vast majority of uncommon tiles.
(The only missing ones will be those that were already combed when a combo user - or one of the people hoarding their own rare tiles - have already combed a rare tile and subsequent visits have combed an uncommon one.)
I'll be making a pass through all 10,000 beaches once a week or so, thereafter.
I hope to beat out some of those aforementioned rare-combers and either verify known rare tiles or discover new ones.
Thanks for your hardwork!
 
Revision 10 takes the tides into account. Since they can cover from 0 to 4 rows of the beach on any given day, if we are looking to visit a particular rare tile, don't bother if it is under water today.

This also means that it will take multiple spading passes through the whole beach visiting twinkles, as up to four rows will be under water for a particular visit.
 
Revision 12 adds a bunch more verified rare and known uncommon times.
I have now wandered 1-5559 minutes down the beach.
It will take multiple passes:

Code:
// The tides can cover from 0-4 rows of tiles.
// The Wiki says there is an eight-day cycle:
// 0, 1, 2, 3, 4, 3, 2, 1, 0 ...
//
// row 1: available 1 day out of eight (tides = 0)
// row 2: available 3 days out of eight (tides = 0-1)
// row 3: available 5 days out of eight (tides = 0-2)
// row 4: available 7 days out of eight (tides = 0-3)
// row 5-10: available every day

which is to say, only 1 out of 8 days of wandering will even show me whats on row 1.

BeachComber will save special rare events in HTML files for you to examine at your leisure, should you care.
I had them in "data/beach", but that's actually getting a bit cluttered for me.
They are now in "data/beach/html".

I added a README.txt file there.

Code:
BeachComber will save the HTML for rare special events in this directory.
Special events:

Seeing a whale on a beach
Combing a whale
Combing a pirate treasure trove
Combing a message in a bottle
Combing a meteorite fragment
Combing a rainbow pearl

The files will be named:

PLAYER_MINUTES_ROW_COLUMN_TIMESTAMP.html
 
Are spaded locations automatically submitted? or do you want the files here?

Are *.new.json files updated/truncated/merged if you have added content and I have updated from Git? or should they be periodically deleted?

No new rare tiles I'm afraid but some new uncommon and some verified rare tiles (I think)

The forum doesn't allow .json uploads so let me know if you want the contents of tiles.uncommon.new.json and tiles.rare.seen.json

(looks like we allow .js and other extensions so no real reason not to allow .json, probably something for @fewyn to take a look at)
 
Back
Top