19
1
Background
Boggle is a board game where the players have to find English words on a 4-by-4 board of random alphabets. Words can be constructed by selecting sequentially adjacent cells on the board. ("adjacent" means horizontally, vertically or diagonally adjacent.) Also, same cell can't be used more than once in a word.
The following is an example board:
I L A W
B N G E
I U A O
A S R L
On this board, BINGO
, ORANGE
and WEARS
are valid words, but SURGE
and RUSSIA
are not:
SURGE
: There's no adjacent pair on the board havingRG
.RUSSIA
:S
cannot be used twice.
Modified Boggle is a modified version of Boggle, with the following rules:
- The board size is
n
-by-n
, wheren
can be any positive integer. - Each cell can contain any one byte between 0 and 255 inclusive.
- A cell can be used more than once, but not twice in a row.
Using the example board above, in addition to BINGO
, ORANGE
and WEARS
, LANGUAGE
becomes a valid string (since G
is used twice, but not twice in a row) but RUSSIA
is still not (due to SS
pair).
Here is another example using a code fragment. The string from itertools import*\n
can be found on the following board, but not from itertoosl import*
or from itertools import *
:
f i ' ' s
r t m l
e o o p
\n * t r
Note that you need two o
's in order to match the oo
sequence.
Challenge
Write a function or program that, given a Modified Boggle board B
(of any size) and a string s
, determines if s
can be found on B
.
Restrictions
Your code itself should also fit on a Modified Boggle board b
. That is, you must show the board b
in your submission along with your code, so that your function/program outputs true if it is given b
and your code as input.
Scoring
The score of your submission is the side length of the smallest board b
where you can fit your code. Ties are broken by the usual code-golf rules, i.e. the length of your code in bytes. The submission with the lowest score (for both criteria) wins.
For example, from itertools import*\n
has the score of 4 (using the board above) and code length of 23 bytes.
Input and Output
For input, you can take any convenient method for both B
and s
. This includes list of chars and list of charcodes, 2D or flattened or whatever makes sense. Also, you can optionally take the board size as a part of the input.
For output, you can choose one of the following:
- Truthy and falsy values following your language's convention, or
- One predefined value for true and false respectively.
Please specify your input/output method in your submission.
I suspect some esolang that has a very tiny charset that can fit on a 2x2 will win xD – HyperNeutrino – 2018-05-20T23:25:00.323
And any Unary program is going to score 4 but is almost guaranteed to lose because of the tie rule against a language efficiently using 4 distinct symbols.
– Arnauld – 2018-05-20T23:26:10.353@Arnauld I was thinking maybe tinyBF and when you need two adjacent symbols you just do a
– HyperNeutrino – 2018-05-20T23:29:18.960+=+=
or something like that. The problem is the==
output function...If it wasn't a standard loophole, you create a pseudolanguage by encoding an existing language in a fixed-width base 3 encoding, and then mapping each base 3 digit to a horizontal, diagonal or vertical move on the 2x2 board. – Neil – 2018-05-20T23:43:53.127
Fair warning: The fact that the board can contain a null byte will make it a lot harder for brainfuck (and derivatives), as well as a few other esolangs – Jo King – 2018-05-21T00:51:47.117
What do "twice in a row" mean? – l4m2 – 2018-05-21T05:40:42.087
@l4m2 You can't "stand still" on the same cell, say
S
, to matchSS
inRUSSIA
. – Bubbler – 2018-05-21T05:58:39.563winner will of course be some base-2 or base-3 language? – l4m2 – 2018-05-21T06:57:21.120
http://esolangs.org/wiki/Binaryfuck – l4m2 – 2018-05-21T06:58:01.303
2@l4m2 Solving with such a language is always welcome, but beware Jo King's warning above. – Bubbler – 2018-05-21T07:02:37.223
3Is this really [tag:restricted-source]? I think it's just a two-fold challenge (more for non-golfing languages), where you're supposed to find both code and the smallest possible Boggle board in which the code fits. – Erik the Outgolfer – 2018-05-21T13:00:24.103
@EriktheOutgolfer I added it when the challenge asked for fitting the code into 4x4 board (while in the sandbox). Removed the tag as it's no longer the case now. – Bubbler – 2018-05-22T13:18:05.657
A solution in BF is almost guaranteed to score 3 if you could solve it. – mbomb007 – 2018-05-22T17:58:35.620
Do we have a tag for "fewest unique characters" challenges? – 12Me21 – 2018-05-23T16:32:38.880
@mbomb007 you of course can solve it with a length input or some encoded symbol – l4m2 – 2018-05-24T12:05:08.193