Visualizing r/place in Excel
TL, DR: Download the spreadsheet from here. 🧮
On April’s fools 2017 Reddit launched r/place, a social experiment with simple rules:
There is an empty canvas.
You may place a tile upon it, but you must wait to place another.
Individually you can create something.
Together you can create something more.
A dataset was released afterwards with information about every single edit, all 16 567 567 of them. (Un?)surprisingly, it is possible to visualize the result in Excel.
The first step was to get the final canvas from the history. I initially tried (and failed) to do everything in PowerQuery. Either it would process data for hours before showing an error, or it would just collapse.
I wrote a small Python script to filter the most recent changes and pivot the columns horizontally. This step also reduced the csv file size from about 857 MB to less than 3 MB.
import pandas as pd
raw_df = pd.read_csv("tile_placements_sorted.csv")
# Calculate the most recent timestamp for each pair of coordinates
last_changes = raw_df.pivot_table(index=["x_coordinate", "y_coordinate"], values="ts", aggfunc=max)
# Use consistent indexes to allow joining
raw_df.set_index(["ts", "x_coordinate", "y_coordinate"], inplace=True)
last_changes.set_index("ts", append=True, inplace=True)
# Join the color for the most recent change
last_changes = last_changes.join(raw_df, on=["ts", "x_coordinate", "y_coordinate"], how="left")
# Export to csv
last_changes.sort_values(["x_coordinate", "y_coordinate", "color"], inplace=True)
last_changes = last_changes.pivot_table(index="y_coordinate", columns="x_coordinate", values="color", aggfunc=min, fill_value=0)
Importing the data in Excel
I don’t blame Excel for being unable to process hundreds of megabytes of csv. It would habe been a clear example of using the wrong tool for the purpose. What Excel is (strugglingly) able to do is importing the 1000 by 1000 csv with PowerQuery. Now it was time to show some colours.
... ... ... ... ... ...
Colours with conditional formatting
To hide the numbers I just applied a number format with a single white space.
There were 16 colours available, each code corresponding to a hex triplet. For each colour I defined a separate conditional format.
That’s it, r/place in Excel in all its glory. If you want to play with it, you can download it from here.