Post History
BQN, 32 bytesSBCS Run online! {∨´∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩} Brute force: tests against all boards up to the number of characters in 𝕩 using Find (⍷). Using the longest dimension is faster b...
Answer
#4: Post edited
# [BQN](https://mlochbaum.github.io/BQN/), 33 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>- [Run online!](https://mlochbaum.github.io/BQN/try.html#code=Q0Mg4oaQIHviiKjCtOKIvjgo4qWKKOKKkOKMvuKlivCdlakp4o23wrfiiaDijJzLnDJ8L+KImOKliinCqDEr4oaV4omg4qWK8J2VqX0KQ0PCqCDin6gKICBbImFhIiwiYWEiXQogIFsiYXFxYWFxIiwicWFhcXFhIl0KICBbImNjY2NjY2NjIl0KCiAgWyJhYmJhYWEiXQogIFsiYyIsImMiLCJkIiwiYyJdCiAjWyJiYmFhYmJhYWJiYWFiYmFhYiJdICAjIFRha2VzIGEgZmV3IHNlY29uZHMKICBbImFiYyJdCiAgWyJhYWJiIiwiYmJjYyJdCuKfqQ==)
- ```
- {∨´∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}
- ```
- Brute force: tests against all boards up to the number of characters in `𝕩` using [Find](https://mlochbaum.github.io/BQN/doc/find.html) (`⍷`). Using the longest dimension is faster but would cost a byte.
- Not explained below, `⊐⌾⥊𝕩` applies [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) [under](https://mlochbaum.github.io/BQN/doc/under.html) [Deshape](https://mlochbaum.github.io/BQN/doc/reshape.html) to convert the argument from characters to numbers. If there are only two unique characters, they'll be 0 and 1, and a third would be 2 and so on. The top-left character is 0, like the top left of the checkerboard, so an 8-square checkerboard will always fit if the argument is valid.
- Also used: [Table](https://mlochbaum.github.io/BQN/doc/map.html#table), [Indices](https://mlochbaum.github.io/BQN/doc/replicate.html#indices).
- ```
- {∨´∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}
- ≠⥊𝕩 # Length of flattened argument
- 1+↕ # Range from 1 to that length
- 8( )¨ # On each size: n
- 8 ⥊ # Take 8 of them n n n…
- /∘ # Each index n times 0 0…0 1 1…1 2 2…2… …7
- 2| # Mod 2 0 0…0 1 1…1 0 0…0… …1
- ·≠⌜ # Not-equals table
- ˜ # with itself, AKA checkerboard
- (⊐⌾⥊𝕩)⍷ # Find the numberized argument
- ⥊ # Convert to list
- ∨´ # Any true in
- ∾ # the join of that?
- ```
- # [BQN](https://mlochbaum.github.io/BQN/), 32 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>
- [Run online!](https://mlochbaum.github.io/BQN/try.html#code=Q0Mg4oaQIHviiKjCtOKIvjgo4qWKKOKKkOKMvuKlivCdlakp4o23wrfiiaDijJzLnDJ8L+KImOKliinCqDEr4oaV4omg4qWK8J2VqX0KQ0PCqCDin6gKICBbImFhIiwiYWEiXQogIFsiYXFxYWFxIiwicWFhcXFhIl0KICBbImNjY2NjY2NjIl0KCiAgWyJhYmJhYWEiXQogIFsiYyIsImMiLCJkIiwiYyJdCiAjWyJiYmFhYmJhYWJiYWFiYmFhYiJdICAjIFRha2VzIGEgZmV3IHNlY29uZHMKICBbImFiYyJdCiAgWyJhYWJiIiwiYmJjYyJdCuKfqQ==)
- ```
- {∨´∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}
- ```
- Brute force: tests against all boards up to the number of characters in `𝕩` using [Find](https://mlochbaum.github.io/BQN/doc/find.html) (`⍷`). Using the longest dimension is faster but would cost a byte.
- Not explained below, `⊐⌾⥊𝕩` applies [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) [under](https://mlochbaum.github.io/BQN/doc/under.html) [Deshape](https://mlochbaum.github.io/BQN/doc/reshape.html) to convert the argument from characters to numbers. If there are only two unique characters, they'll be 0 and 1, and a third would be 2 and so on. The top-left character is 0, like the top left of the checkerboard, so an 8-square checkerboard will always fit if the argument is valid.
- Also used: [Table](https://mlochbaum.github.io/BQN/doc/map.html#table), [Indices](https://mlochbaum.github.io/BQN/doc/replicate.html#indices).
- ```
- {∨´∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}
- ≠⥊𝕩 # Length of flattened argument
- 1+↕ # Range from 1 to that length
- 8( )¨ # On each size: n
- 8 ⥊ # Take 8 of them n n n…
- /∘ # Each index n times 0 0…0 1 1…1 2 2…2… …7
- 2| # Mod 2 0 0…0 1 1…1 0 0…0… …1
- ·≠⌜ # Not-equals table
- ˜ # with itself, AKA checkerboard
- (⊐⌾⥊𝕩)⍷ # Find the numberized argument
- ⥊ # Convert to list
- ∨´ # Any true in
- ∾ # the join of that?
- ```
#3: Post edited
- # [BQN](https://mlochbaum.github.io/BQN/), 33 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>
[Run online!](https://mlochbaum.github.io/BQN/try.html#code=Q0Mg4oaQIHviiKjCtOKImOKIvjgo4qWKKOKKkOKMvuKlivCdlakp4o23wrfiiaDijJzLnDJ8L+KImOKliinCqDEr4oaV4omg4qWK8J2VqX0KQ0PCqCDin6gKICBbImFhIiwiYWEiXQogIFsiYXFxYWFxIiwicWFhcXFhIl0KICBbImNjY2NjY2NjIl0KCiAgWyJhYmJhYWEiXQogIFsiYyIsImMiLCJkIiwiYyJdCiAjWyJiYmFhYmJhYWJiYWFiYmFhYiJdICAjIFRha2VzIGEgZmV3IHNlY29uZHMKICBbImFiYyJdCiAgWyJhYWJiIiwiYmJjYyJdCuKfqQ==)- ```
{∨´∘∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}- ```
- Brute force: tests against all boards up to the number of characters in `𝕩` using [Find](https://mlochbaum.github.io/BQN/doc/find.html) (`⍷`). Using the longest dimension is faster but would cost a byte.
- Not explained below, `⊐⌾⥊𝕩` applies [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) [under](https://mlochbaum.github.io/BQN/doc/under.html) [Deshape](https://mlochbaum.github.io/BQN/doc/reshape.html) to convert the argument from characters to numbers. If there are only two unique characters, they'll be 0 and 1, and a third would be 2 and so on. The top-left character is 0, like the top left of the checkerboard, so an 8-square checkerboard will always fit if the argument is valid.
- Also used: [Table](https://mlochbaum.github.io/BQN/doc/map.html#table), [Indices](https://mlochbaum.github.io/BQN/doc/replicate.html#indices).
- ```
{∨´∘∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}≠⥊𝕩 # Length of flattened argument1+↕ # Range from 1 to that length8( )¨ # On each size: n8 ⥊ # Take 8 of them n n n…/∘ # Each index n times 0…0 1…1 2…2 … 7…72| # Mod 2 0…0 1…1 0…0 … 1…1·≠⌜ # Not-equals table˜ # with itself, AKA checkerboard(⊐⌾⥊𝕩)⍷ # Find the numberized argument⥊ # Convert to list∨´ # Any true in∘∾ # the join of that?- ```
- # [BQN](https://mlochbaum.github.io/BQN/), 33 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>
- [Run online!](https://mlochbaum.github.io/BQN/try.html#code=Q0Mg4oaQIHviiKjCtOKIvjgo4qWKKOKKkOKMvuKlivCdlakp4o23wrfiiaDijJzLnDJ8L+KImOKliinCqDEr4oaV4omg4qWK8J2VqX0KQ0PCqCDin6gKICBbImFhIiwiYWEiXQogIFsiYXFxYWFxIiwicWFhcXFhIl0KICBbImNjY2NjY2NjIl0KCiAgWyJhYmJhYWEiXQogIFsiYyIsImMiLCJkIiwiYyJdCiAjWyJiYmFhYmJhYWJiYWFiYmFhYiJdICAjIFRha2VzIGEgZmV3IHNlY29uZHMKICBbImFiYyJdCiAgWyJhYWJiIiwiYmJjYyJdCuKfqQ==)
- ```
- {∨´∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}
- ```
- Brute force: tests against all boards up to the number of characters in `𝕩` using [Find](https://mlochbaum.github.io/BQN/doc/find.html) (`⍷`). Using the longest dimension is faster but would cost a byte.
- Not explained below, `⊐⌾⥊𝕩` applies [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) [under](https://mlochbaum.github.io/BQN/doc/under.html) [Deshape](https://mlochbaum.github.io/BQN/doc/reshape.html) to convert the argument from characters to numbers. If there are only two unique characters, they'll be 0 and 1, and a third would be 2 and so on. The top-left character is 0, like the top left of the checkerboard, so an 8-square checkerboard will always fit if the argument is valid.
- Also used: [Table](https://mlochbaum.github.io/BQN/doc/map.html#table), [Indices](https://mlochbaum.github.io/BQN/doc/replicate.html#indices).
- ```
- {∨´∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}
- ≠⥊𝕩 # Length of flattened argument
- 1+↕ # Range from 1 to that length
- 8( )¨ # On each size: n
- 8 ⥊ # Take 8 of them n n n…
- /∘ # Each index n times 0 0…0 1 1…1 2 2…2… …7
- 2| # Mod 2 0 0…0 1 1…1 0 0…0… …1
- ·≠⌜ # Not-equals table
- ˜ # with itself, AKA checkerboard
- (⊐⌾⥊𝕩)⍷ # Find the numberized argument
- ⥊ # Convert to list
- ∨´ # Any true in
- ∾ # the join of that?
- ```
#2: Post edited
- # [BQN](https://mlochbaum.github.io/BQN/), 33 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>
- [Run online!](https://mlochbaum.github.io/BQN/try.html#code=Q0Mg4oaQIHviiKjCtOKImOKIvjgo4qWKKOKKkOKMvuKlivCdlakp4o23wrfiiaDijJzLnDJ8L+KImOKliinCqDEr4oaV4omg4qWK8J2VqX0KQ0PCqCDin6gKICBbImFhIiwiYWEiXQogIFsiYXFxYWFxIiwicWFhcXFhIl0KICBbImNjY2NjY2NjIl0KCiAgWyJhYmJhYWEiXQogIFsiYyIsImMiLCJkIiwiYyJdCiAjWyJiYmFhYmJhYWJiYWFiYmFhYiJdICAjIFRha2VzIGEgZmV3IHNlY29uZHMKICBbImFiYyJdCiAgWyJhYWJiIiwiYmJjYyJdCuKfqQ==)
- ```
- {∨´∘∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}
- ```
- Brute force: tests against all boards up to the number of characters in `𝕩` using [Find](https://mlochbaum.github.io/BQN/doc/find.html) (`⍷`). Using the longest dimension is faster but would cost a byte.
- Not explained below, `⊐⌾⥊𝕩` applies [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) [under](https://mlochbaum.github.io/BQN/doc/under.html) [Deshape](https://mlochbaum.github.io/BQN/doc/reshape.html) to convert the argument from characters to numbers. If there are only two unique characters, they'll be 0 and 1, and a third would be 2 and so on. The top-left character is 0, like the top left of the checkerboard, so an 8-square checkerboard will always fit if the argument is valid.
- Also used: [Table](https://mlochbaum.github.io/BQN/doc/map.html#table), [Indices](https://mlochbaum.github.io/BQN/doc/replicate.html#indices).
- ```
- {∨´∘∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}
- ≠⥊𝕩 # Length of flattened argument
- 1+↕ # Range from 1 to that length
- 8( )¨ # On each size: n
- 8 ⥊ # Take 8 of them n n n…
/∘ # Each index n times 0 0…0 1 1…1 2 2…2… …72| # Mod 2 0 0…0 1 1…1 0 0…0… …1- ·≠⌜ # Not-equals table
- ˜ # with itself, AKA checkerboard
- (⊐⌾⥊𝕩)⍷ # Find the numberized argument
- ⥊ # Convert to list
- ∨´ # Any true in
- ∘∾ # the join of that?
- ```
- # [BQN](https://mlochbaum.github.io/BQN/), 33 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup>
- [Run online!](https://mlochbaum.github.io/BQN/try.html#code=Q0Mg4oaQIHviiKjCtOKImOKIvjgo4qWKKOKKkOKMvuKlivCdlakp4o23wrfiiaDijJzLnDJ8L+KImOKliinCqDEr4oaV4omg4qWK8J2VqX0KQ0PCqCDin6gKICBbImFhIiwiYWEiXQogIFsiYXFxYWFxIiwicWFhcXFhIl0KICBbImNjY2NjY2NjIl0KCiAgWyJhYmJhYWEiXQogIFsiYyIsImMiLCJkIiwiYyJdCiAjWyJiYmFhYmJhYWJiYWFiYmFhYiJdICAjIFRha2VzIGEgZmV3IHNlY29uZHMKICBbImFiYyJdCiAgWyJhYWJiIiwiYmJjYyJdCuKfqQ==)
- ```
- {∨´∘∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}
- ```
- Brute force: tests against all boards up to the number of characters in `𝕩` using [Find](https://mlochbaum.github.io/BQN/doc/find.html) (`⍷`). Using the longest dimension is faster but would cost a byte.
- Not explained below, `⊐⌾⥊𝕩` applies [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) [under](https://mlochbaum.github.io/BQN/doc/under.html) [Deshape](https://mlochbaum.github.io/BQN/doc/reshape.html) to convert the argument from characters to numbers. If there are only two unique characters, they'll be 0 and 1, and a third would be 2 and so on. The top-left character is 0, like the top left of the checkerboard, so an 8-square checkerboard will always fit if the argument is valid.
- Also used: [Table](https://mlochbaum.github.io/BQN/doc/map.html#table), [Indices](https://mlochbaum.github.io/BQN/doc/replicate.html#indices).
- ```
- {∨´∘∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩}
- ≠⥊𝕩 # Length of flattened argument
- 1+↕ # Range from 1 to that length
- 8( )¨ # On each size: n
- 8 ⥊ # Take 8 of them n n n…
- /∘ # Each index n times 0…0 1…1 2…2 … 7…7
- 2| # Mod 2 0…0 1…1 0…0 … 1…1
- ·≠⌜ # Not-equals table
- ˜ # with itself, AKA checkerboard
- (⊐⌾⥊𝕩)⍷ # Find the numberized argument
- ⥊ # Convert to list
- ∨´ # Any true in
- ∘∾ # the join of that?
- ```
#1: Initial revision
# [BQN](https://mlochbaum.github.io/BQN/), 33 bytes<sup>[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)</sup> [Run online!](https://mlochbaum.github.io/BQN/try.html#code=Q0Mg4oaQIHviiKjCtOKImOKIvjgo4qWKKOKKkOKMvuKlivCdlakp4o23wrfiiaDijJzLnDJ8L+KImOKliinCqDEr4oaV4omg4qWK8J2VqX0KQ0PCqCDin6gKICBbImFhIiwiYWEiXQogIFsiYXFxYWFxIiwicWFhcXFhIl0KICBbImNjY2NjY2NjIl0KCiAgWyJhYmJhYWEiXQogIFsiYyIsImMiLCJkIiwiYyJdCiAjWyJiYmFhYmJhYWJiYWFiYmFhYiJdICAjIFRha2VzIGEgZmV3IHNlY29uZHMKICBbImFiYyJdCiAgWyJhYWJiIiwiYmJjYyJdCuKfqQ==) ``` {∨´∘∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩} ``` Brute force: tests against all boards up to the number of characters in `𝕩` using [Find](https://mlochbaum.github.io/BQN/doc/find.html) (`⍷`). Using the longest dimension is faster but would cost a byte. Not explained below, `⊐⌾⥊𝕩` applies [Classify](https://mlochbaum.github.io/BQN/doc/selfcmp.html#classify) [under](https://mlochbaum.github.io/BQN/doc/under.html) [Deshape](https://mlochbaum.github.io/BQN/doc/reshape.html) to convert the argument from characters to numbers. If there are only two unique characters, they'll be 0 and 1, and a third would be 2 and so on. The top-left character is 0, like the top left of the checkerboard, so an 8-square checkerboard will always fit if the argument is valid. Also used: [Table](https://mlochbaum.github.io/BQN/doc/map.html#table), [Indices](https://mlochbaum.github.io/BQN/doc/replicate.html#indices). ``` {∨´∘∾8(⥊(⊐⌾⥊𝕩)⍷·≠⌜˜2|/∘⥊)¨1+↕≠⥊𝕩} ≠⥊𝕩 # Length of flattened argument 1+↕ # Range from 1 to that length 8( )¨ # On each size: n 8 ⥊ # Take 8 of them n n n… /∘ # Each index n times 0 0…0 1 1…1 2 2…2… …7 2| # Mod 2 0 0…0 1 1…1 0 0…0… …1 ·≠⌜ # Not-equals table ˜ # with itself, AKA checkerboard (⊐⌾⥊𝕩)⍷ # Find the numberized argument ⥊ # Convert to list ∨´ # Any true in ∘∾ # the join of that? ```