Skip to content

Instantly share code, notes, and snippets.

@p-i-
Created July 12, 2024 22:00
Show Gist options
  • Save p-i-/9ebed4917d5ea61674e536896fe0aa83 to your computer and use it in GitHub Desktop.
Save p-i-/9ebed4917d5ea61674e536896fe0aa83 to your computer and use it in GitHub Desktop.
ARC Challenge example
train:
- input: |-
πŸ”΅ πŸ”΄ 🟒 ⚫️ ⚫️ ⚫️ ⚫️
πŸ”΄ 🟒 ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
🟒 ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
output: |-
πŸ”΅ πŸ”΄ 🟒 πŸ”΅ πŸ”΄ 🟒 πŸ”΅
πŸ”΄ 🟒 πŸ”΅ πŸ”΄ 🟒 πŸ”΅ πŸ”΄
🟒 πŸ”΅ πŸ”΄ 🟒 πŸ”΅ πŸ”΄ 🟒
πŸ”΅ πŸ”΄ 🟒 πŸ”΅ πŸ”΄ 🟒 πŸ”΅
πŸ”΄ 🟒 πŸ”΅ πŸ”΄ 🟒 πŸ”΅ πŸ”΄
🟒 πŸ”΅ πŸ”΄ 🟒 πŸ”΅ πŸ”΄ 🟒
πŸ”΅ πŸ”΄ 🟒 πŸ”΅ πŸ”΄ 🟒 πŸ”΅
- input: |-
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ βšͺ️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ βšͺ️ πŸ”΅
⚫️ ⚫️ ⚫️ ⚫️ βšͺ️ πŸ”΅ 🟑
⚫️ ⚫️ ⚫️ βšͺ️ πŸ”΅ 🟑 ⚫️
⚫️ ⚫️ βšͺ️ πŸ”΅ 🟑 ⚫️ ⚫️
output: |-
πŸ”΅ 🟑 βšͺ️ πŸ”΅ 🟑 βšͺ️ πŸ”΅
🟑 βšͺ️ πŸ”΅ 🟑 βšͺ️ πŸ”΅ 🟑
βšͺ️ πŸ”΅ 🟑 βšͺ️ πŸ”΅ 🟑 βšͺ️
πŸ”΅ 🟑 βšͺ️ πŸ”΅ 🟑 βšͺ️ πŸ”΅
🟑 βšͺ️ πŸ”΅ 🟑 βšͺ️ πŸ”΅ 🟑
βšͺ️ πŸ”΅ 🟑 βšͺ️ πŸ”΅ 🟑 βšͺ️
πŸ”΅ 🟑 βšͺ️ πŸ”΅ 🟑 βšͺ️ πŸ”΅
- input: |-
⚫️ ⚫️ ⚫️ ⚫️ πŸ”΄ 🟒 ⚫️
⚫️ ⚫️ ⚫️ πŸ”΄ 🟒 ⚫️ ⚫️
⚫️ ⚫️ πŸ”΄ 🟒 ⚫️ ⚫️ ⚫️
⚫️ πŸ”΄ 🟒 ⚫️ ⚫️ ⚫️ 🟑
πŸ”΄ 🟒 ⚫️ ⚫️ ⚫️ 🟑 ⚫️
🟒 ⚫️ ⚫️ ⚫️ 🟑 ⚫️ ⚫️
⚫️ ⚫️ ⚫️ 🟑 ⚫️ ⚫️ ⚫️
output: |-
🟑 πŸ”΄ 🟒 🟑 πŸ”΄ 🟒 🟑
πŸ”΄ 🟒 🟑 πŸ”΄ 🟒 🟑 πŸ”΄
🟒 🟑 πŸ”΄ 🟒 🟑 πŸ”΄ 🟒
🟑 πŸ”΄ 🟒 🟑 πŸ”΄ 🟒 🟑
πŸ”΄ 🟒 🟑 πŸ”΄ 🟒 🟑 πŸ”΄
🟒 🟑 πŸ”΄ 🟒 🟑 πŸ”΄ 🟒
🟑 πŸ”΄ 🟒 🟑 πŸ”΄ 🟒 🟑
test:
- input: |-
⚫️ βšͺ️ ⚫️ ⚫️ ⚫️ ⚫️ πŸ”΅
βšͺ️ ⚫️ ⚫️ ⚫️ ⚫️ πŸ”΅ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ πŸ”΅ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ πŸ”΅ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ πŸ”΅ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ πŸ”΅ ⚫️ ⚫️ ⚫️ ⚫️ 🟑
πŸ”΅ ⚫️ ⚫️ ⚫️ ⚫️ 🟑 ⚫️
output: |-
πŸ”΅ βšͺ️ 🟑 πŸ”΅ βšͺ️ 🟑 πŸ”΅
βšͺ️ 🟑 πŸ”΅ βšͺ️ 🟑 πŸ”΅ βšͺ️
🟑 πŸ”΅ βšͺ️ 🟑 πŸ”΅ βšͺ️ 🟑
πŸ”΅ βšͺ️ 🟑 πŸ”΅ βšͺ️ 🟑 πŸ”΅
βšͺ️ 🟑 πŸ”΅ βšͺ️ 🟑 πŸ”΅ βšͺ️
🟑 πŸ”΅ βšͺ️ 🟑 πŸ”΅ βšͺ️ 🟑
πŸ”΅ βšͺ️ 🟑 πŸ”΅ βšͺ️ 🟑 πŸ”΅
filename: 05269061.json
hint: |-
Diagonals cycle
howto: |-
Observations:
- Examining the inputs, we see we are always given 3 diagonals, each a different colour.
- Examining any output, the pattern is obvious; diagonal stripes that cycle 3 colours.
Thinking:
- If we flatten the output grid, we get a repeating A B C A B C ... pattern.
- So if position k has colour U, then position k + 3*i also has colour U.
solution: |-
The output is repeating tricolour diagonals on a 7x7 grid emanating from the top left, which can be considered as a colouring where (r, c) -> ColourTable[(r+c) % 3]. 3 diagonals of different colour are provided in the input, which is sufficient to populate the colour table and generate the output.
code: | #.py
def solve(g):
C = np.zeros(3).astype(int)
for i, c in enumerate(g.flatten()):
if c != 0:
C[i % 3] = c
return np.tile(C, 49)[:49].reshape((7, 7))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment