Advanced

Re: GC6JHC6 - Pattern matching on the year grid

[Resolved] GC6JHC6 - Pattern matching on the year grid
May 31, 2016 01:30AM
I've passed this concept by al ocal reviewer and he's approved the idea. If a checker can be written, of course. I have already created a single SQL query for GSAK's sqlite that produces a result indicating both qualifying instances, and near-qualifying instances.

Concept: Match a grid-based pattern anywhere on a Year matrix (date placed or date found), having only days above a minimum threshold (number of finds).

It's based on the idea of the 366 day matrix completion, only it now searches for pattern positions using only qualifying days. Potentially with additional options to filter finds.

For example: The "Traditional" themed challenge would be to locate a "T" design (8x10 size) on the grid, with a threshold of 2 or more find-days.

What I input to my query are static values - the coordinate set of the spots needing filling by (0,0) based offsets, and to make things easier the width and height of the pattern, and the number of spots that need to qualify.

It creates a new table combinining a generated 366-day M/D table with those offsets, and includes a count of the number of finds (filtered by cachetype = 'T') per day but as a case value (greater than threshold = 1, else 0). This initial grid (which is only one pattern position - ie Jan 1 + each M/D offset in the pattern) is then also joined to a generated table for the origin position using columns (0,0) to (31-width, 12-height), which are added to the date being checked. And finally, the outermost query groups the results by the origin point, and sums the 1/0 qualifying days. Any row with a sum that matches the number of spots in the pattern is a qualification, and it also returns the origin point for the pattern.

The result can be re-rendered, and the next most highest spot counts can be used as near-matches, a guide fr the user to choose which days they may want to focus on to qualify :)

This is a SQL query you can test in GSAK SQLite, to run on your Finds database. It uses a pattern for a 10x11 phoon with 34 spots, valid origins being from (0,0) to (1,21). It returns the origin point (for every valid origin) and number of date matches (34 being full qualification).
select a,b,sum(f) n from (select a,b,m,d,(case when (select count(*) from caches where strftime('%m/%d',foundbymedate)=y.m||'/'||y.d)>1 then 1 else 0 end) f from (with recursive ab(a,b,n) as (values(0,0,1) union all select (n/22), (n%22), n+1 from ab where n<44) select a,b from ab) x join (with recursive yd(m,d,n) as (values('01','01',1) union all select strftime('%m',2451544.5+n),strftime('%d',2451544.5+n),n+1 from yd where n<366) select m,d from yd) y where m||'/'||d in (with X(m,d) as (values (0,2),(0,3),(1,2),(1,3),(2,3),(2,4),(2,5),(2,6),(3,0),(3,2),(3,3),(3,4),(3,7),(4,0),(4,1),(4,4),(4,7),(5,4),(5,5),(6,3),(6,4),(6,5),(7,2),(7,5),(7,6),(7,8),(8,2),(8,3),(8,6),(8,7),(8,9),(9,4),(10,3),(10,4)) select strftime('%m/%d',date('2000-01-01','+'||(m+a)||' months','+'||(d+b)||' days')) from X)) group by a,b order by n desc, a,b
Note the above origin range for this example is hard-coded, only because at this point the sqlite date check uses an offset, so for example Feb 1 + 30 days would end up in March instead of an invalid date, so I had to define valid origin ranges incorporating only valid dates. That shouldn't be a hard fix inside a more flexible script than a single SQL query :)

Does the concept make sense? Is that translateable to a checker script?
Re: GC6JHC6 - Pattern matching on the year grid
May 31, 2016 05:02AM
It is certainly possible to code a checker of this type. I doubt there is one coded already, if there is I wasn't able to find it easily.

Please provide the full details of the challenge you want a checker for. If you are wanting multiple checkers for multiple challenges, please provide details and GC codes for each.
Re: GC6JHC6 - Pattern matching on the year grid
May 31, 2016 07:00AM
I have created a script which can check this type of challenge. Once you provide specifics for your challenge I'll tag it.
Re: GC6JHC6 - Pattern matching on the year grid
May 31, 2016 03:47PM
That's great! Thanks. These are the setups I currently have planned; Thresholds are based on my testing with my own find data for DateFound. If possible, I might like to increase the threshold if it's easier to complete the pattern using either DateFound or DatePlaced in the challenge.
After the tags are created, can tag properties be edited or the result output be adjusted?

GC6JHC6 - The Phoon (10x11) 34 spots, All caches qualify (no filter), Threshold 2+ finds/day
(0,2),(0,3),(1,2),(1,3),(2,3),(2,4),(2,5),(2,6),(3,0),(3,2),(3,3),(3,4),(3,7),(4,0),(4,1),(4,4),(4,7),(5,4),(5,5),(6,3),(6,4),(6,5),(7,2),(7,5),(7,6),(7,8),(8,2),(8,3),(8,6),(8,7),(8,9),(9,4),(10,3),(10,4)

GC6JV6Q - "GEOCACHE" (31x5) 74 spots, Physical cache finds (Trad/Multi/Unk/LB/Wherigo), Threshold 2+ finds/day
(0,0),(0,1),(0,2),(1,0),(2,0),(2,2),(3,0),(3,2),(4,0),(4,1),(4,2),(0,4),(0,5),(0,6),(1,4),(2,4),(2,5),(3,4),(4,4),(4,5),(4,6),(0,9),(1,8),(1,10),(2,8),(2,10),(3,8),(3,10),(4,9),(0,13),(1,12),(1,14),(2,12),(3,12),(3,14),(4,13),(0,17),(1,16),(1,18),(2,16),(2,17),(2,18),(3,16),(3,18),(4,16),(4,18),(0,21),(1,20),(1,22),(2,20),(3,20),(3,22),(4,21),(0,24),(0,26),(1,24),(1,26),(2,24),(2,25),(2,26),(3,24),(3,26),(4,24),(4,26),(0,28),(0,29),(0,30),(1,28),(2,28),(2,29),(3,28),(4,28),(4,29),(4,30)

GC6JV6M - "?" (5x9) 11 spots, All non-Traditional cache finds, Threshold 1+ finds/day
(0,1),(0,2),(0,3),(1,0),(1,4),(2,4),(3,3),(4,2),(4,2),(4,2),(6,2)

GC6JV7B - "T" (8x10) 32 spots, All Traditional cache finds, Threshold 2+ finds/day
(0,0),(0,1),(0,2),(0,3),(0,4),(0,5),(0,6),(0,7),(1,0),(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3),(2,4),(3,3),(3,4),(4,3),(4,4),(5,3),(5,4),(6,3),(6,4),(7,3),(7,4),(8,3),(8,4),(9,3),(9,4)

GC6JV7C - "3.0" (9x7) 25 spots, All finds having Difficulty and Terrain both 3.0 or less, Threshold 2+ finds/day
(0,1),(0,2),(1,0),(1,3),(2,2),(3,3),(4,0),(4,3),(5,1),(5,2),(6,4),(0,6),(0,7),(1,6),(1,8),(2,5),(2,6),(2,7),(2,8),(3,5),(3,8),(4,5),(4,8),(5,6),(5,7)

GC6JV7D - "> 3" (8x5) 14 spots, All finds having Difficulty OR Terrain at 3.0 or more, Threshold 1+ finds/day
(0,0),(1,1),(2,2),(3,1),(4,0),(0,5),(0,6),(1,4),(1,7),(2,6),(3,4),(3,7),(4,5),(4,6)

GC6JVBN - 5 shrinking vertical lines (9x6) 20 spots, All finds of size Micro, Threshold 1+ finds/day
(0,0),(1,0),(1,2),(2,0),(2,2),(2,4),(3,0),(3,2),(3,4),(3,6),(4,0),(4,2),(4,4),(4,6),(4,8),(5,0),(5,2),(5,4),(5,6),(5,8)

GC6JVBP - 5 growing vertical lines (9x6) 20 spots, All finds of size Regular or Large, Threshold 1+ finds/day
(0,8),(1,6),(1,8),(2,4),(2,6),(2,8),(3,2),(3,4),(3,6),(3,8),(4,0),(4,2),(4,4),(4,6),(4,8),(5,0),(5,2),(5,4),(5,6),(5,8)

I have two more but those are basic full-year grids with a cache filter, and I believe there's already at least 1 checker that can handle that.
Re: GC6JHC6 - Pattern matching on the year grid
June 06, 2016 01:31AM
GC6JV6Q has been published and is not the challenge cache you listed. Can you please confirm the GC code?
Re: GC6JHC6 - Pattern matching on the year grid
June 06, 2016 03:09PM
Whoah, that's odd. Correct, it should be GC6JV5Q. (checked the others and they're all correct)
Re: GC6JHC6 - Pattern matching on the year grid
June 06, 2016 03:14PM
Cool, I've fixed the tag.
Re: GC6JHC6 - Pattern matching on the year grid
June 01, 2016 02:06AM
Tags can be adjusted easily. Output is trickier as it requires a code change.

I've tagged the first two:
http://project-gc.com/Challenges/GC6JHC6/20981
http://project-gc.com/Challenges/GC6JHC6/20981

I'll work on the others later. The ">3" one will not be possible without some changes to the script, since I'm passing the filters through directly at the moment and D/T restrictions are done as "and" rather than "or".
Re: GC6JHC6 - Pattern matching on the year grid
June 01, 2016 05:30AM
Re: GC6JHC6 - Pattern matching on the year grid
June 01, 2016 05:27PM
Thanks, looks great! I don't see the option for find threshold though, and it looks like that has been hard-coded in (at least to the one script I checked). Is that too difficult to code?

Also the first comment has the same two links; missing GC6JV6Q.

Is it possible to show perhaps a top 'near miss' in the output for a failed check?


FYI: There has been a hitch in the concept review returned to me which I'm still working out. Reviewers have been deliberating. So don't feel the need to make any changes ASAP.
Re: GC6JHC6 - Pattern matching on the year grid
June 02, 2016 03:55AM
I incorporated the find threshold into the pattern, because I thought that would make the script more generic - it allows patterns with different limits for different parts.

Sorry about the missing link, it was a copy/paste error. http://project-gc.com/Challenges/GC6JV6Q/20982

The 'near miss' option I may consider if they are approved.
Re: GC6JHC6 - Pattern matching on the year grid
June 02, 2016 04:59PM
Excellent, thanks!

So for the other two that are year grids, I've been looking for a script that includes an additional filter.
Am I able to tag, or do I have to request a tag as well?

For GC6JVC2, it's going to be a full datefound grid of 1+Finds having Difficulty <=3.0
For GC6JVC3, a full datefound grid of 1+ Finds having Terrain <=3.0

I think the "Multiple test Checker" by "Target." is capable of it.
Re: GC6JHC6 - Pattern matching on the year grid
June 02, 2016 05:14PM
My "Multiple test Checker" is only for multiple test. Every test exist in a separate checker too
http://project-gc.com/Challenges/GC6JVC2/21089
http://project-gc.com/Challenges/GC6JVC3/21090
Sorry, only registered users may post in this forum.

Click here to login