arckit icon indicating copy to clipboard operation
arckit copied to clipboard

Feature: Added print_grid function, print grid to terminal

Open Rafaelblsilva opened this issue 2 years ago • 1 comments

@mxbi Thanks for the awesome project!

I Haphazardly added a function to print the grid to the terminal. It is based on the rich library.

Example:


import arckit
import arckit.vis as vis
train_set, eval_set = arckit.load_data() # Load ARC1 train/eval

task = train_set[0]

for ex in task.train:
    print("Input: ")
    grid = vis.draw_grid(ex[0])
    vis.print_grid(grid)
    print('Output: ')
    grid = vis.draw_grid(ex[1])
    vis.print_grid(grid)
    print()

Should print to the terminal:

image

Rafaelblsilva avatar Oct 15 '23 20:10 Rafaelblsilva

Awesome! I really like the printing style.

I'm wondering whether we can extend this to take in numpy arrays (the standard grid format for Task) rather than essentially inverting the draw_grid call, which might have some weird behaviour if called on the result of draw_task, for example.

mxbi avatar Oct 16 '23 16:10 mxbi

I'm closing this in favour of #12 - thank you for the suggestion!

mxbi avatar Nov 11 '24 13:11 mxbi