Skip to content

Instantly share code, notes, and snippets.

@mfornet
Created April 18, 2023 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfornet/17d235ba2d0af5793fe7fb724e4ce3e2 to your computer and use it in GitHub Desktop.
Save mfornet/17d235ba2d0af5793fe7fb724e4ce3e2 to your computer and use it in GitHub Desktop.
import random
import os
import json
import sys
from typing import List
if __name__ == '__main__':
# Load two random files from the folder data
file1 = random.choice(os.listdir('data/training'))
file2 = random.choice(os.listdir('data/evaluation'))
print("""
You are here to solve problems from ARC dataset (Abstract Reasoning Challenge).
You will be given one training problem and one evaluation problem.
For each problem you will be given a set of input and output examples and one extra input.
Your task is to find the output for the extra input.
Let's start with the training problem.
""")
data1 = json.load(open('data/training/' + file1))
print(file1, file=sys.stderr)
for i in data1['train']:
print('Input:')
in_board = i['input']
print(f'Shape: [{len(in_board)} x {len(in_board[0])}]')
for row in in_board:
print(''.join(map(str, row)))
print()
print('Output:')
out_board = i['output']
print(f'Shape: [{len(out_board)} x {len(out_board[0])}]')
for row in out_board:
print(''.join(map(str, row)))
print()
print('Extra input:')
in_board = data1['test'][0]['input']
print(f'Shape: [{len(in_board)} x {len(in_board[0])}]')
for row in in_board:
print(''.join(map(str, row)))
print()
print('Extra output (for training):')
out_board = data1['test'][0]['output']
print(f'Shape: [{len(out_board)} x {len(out_board[0])}]')
for row in out_board:
print(''.join(map(str, row)))
print("""
Now let's move on to the evaluation problem.
""")
data2 = json.load(open('data/evaluation/' + file2))
print(file2, file=sys.stderr)
for i in data2['train']:
print('Input:')
in_board = i['input']
print(f'Shape: [{len(in_board)} x {len(in_board[0])}]')
for row in in_board:
print(''.join(map(str, row)))
print()
print('Output:')
out_board = i['output']
print(f'Shape: [{len(out_board)} x {len(out_board[0])}]')
for row in out_board:
print(''.join(map(str, row)))
print()
print('Extra input:')
in_board = data2['test'][0]['input']
print(f'Shape: [{len(in_board)} x {len(in_board[0])}]')
for row in in_board:
print(''.join(map(str, row)))
print()
print("""
Now it's your turn to solve the problem.
""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment