Python Challenge - Level 25
- Link: http://www.pythonchallenge.com/pc/hex/lake.html
- Username: butter
- Password: fly
Problem

The puzzle provides a grid of puzzle pieces and mentions downloading WAV files: lake1.wav through lake25.wav.
Each audio file contains raw sample data. Inspecting the number of frames reveals: 60 × 60 pixels × 3 bytes per pixel (RGB) = 10,800 bytes. The 25 audio files correspond to a 5 × 5 jigsaw grid of 60 × 60 pixel sub-images, assembling into a single 300 × 300 image.
Solution
- Download all 25 audio files (
lake1.wavtolake25.wav). - Read the raw frames (10,800 bytes each).
- Treat each frame chunk as an uncompressed 60 × 60 RGB image.
- Paste the 25 pieces into a 5 × 5 grid (300 × 300 canvas).
- The assembled image reveals the word decent.
Python
import wave
from PIL import Image
canvas = Image.new("RGB", (300, 300))
for i in range(1, 26):
with wave.open(f"lake{i}.wav", "rb") as w:
frames = w.readframes(w.getnframes())
piece = Image.frombytes("RGB", (60, 60), frames)
col = (i - 1) % 5
row = (i - 1) // 5
canvas.paste(piece, (col * 60, row * 60))
canvas.save("decent.png")
Go
package main
import (
"fmt"
"image"
"image/color"
"image/png"
"os"
)
func main() {
canvas := image.NewRGBA(image.Rect(0, 0, 300, 300))
for i := 1; i <= 25; i++ {
data, err := os.ReadFile(fmt.Sprintf("lake%d.wav", i))
if err != nil {
panic(err)
}
// Raw 10800-byte RGB payload is after the 44-byte standard WAV header
rawPixels := data[44:]
col := (i - 1) % 5
row := (i - 1) / 5
baseX := col * 60
baseY := row * 60
idx := 0
for y := 0; y < 60; y++ {
for x := 0; x < 60; x++ {
r := rawPixels[idx]
g := rawPixels[idx+1]
b := rawPixels[idx+2]
canvas.Set(baseX+x, baseY+y, color.RGBA{r, g, b, 255})
idx += 3
}
}
}
out, _ := os.Create("decent.png")
defer out.Close()
png.Encode(out, canvas)
}
Rust
use image::{ImageBuffer, Rgb, RgbImage};
use std::fs;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut canvas: RgbImage = ImageBuffer::new(300, 300);
for i in 1..=25 {
let data = fs::read(format!("lake{i}.wav"))?;
let raw_pixels = &data[44..]; // Skip 44-byte RIFF header
let col = (i - 1) % 5;
let row = (i - 1) / 5;
let base_x = (col * 60) as u32;
let base_y = (row * 60) as u32;
let mut idx = 0;
for y in 0..60 {
for x in 0..60 {
let pixel = Rgb([raw_pixels[idx], raw_pixels[idx + 1], raw_pixels[idx + 2]]);
canvas.put_pixel(base_x + x, base_y + y, pixel);
idx += 3;
}
}
}
canvas.save("decent.png")?;
println!("Saved decent.png");
Ok(())
}
Language Comparison
| Feature | Python | Go | Rust |
|---|---|---|---|
| Raw Frame Deserialization | Image.frombytes('RGB', ...) creates image directly from memory buffer |
Slicing 3 bytes per pixel into color.RGBA |
Indexing slices into Rgb([r, g, b]) |
| Image Patch / Subgrid Assembly | canvas.paste(piece, (x, y)) |
Coordinate offsetting with canvas.Set() |
Coordinate offsetting with canvas.put_pixel() |
| File I/O Loop | wave.open() |
os.ReadFile() |
std::fs::read() |
Key insight: Storing raw image pixels inside a WAV container disguises data behind multimedia headers. Because uncompressed PCM and raw image pixels are both uncompressed byte streams, skipping the 44-byte RIFF WAV header gives instant direct access to the RGB byte raster.
Next Level
The image spells decent:
Recommended Reading
SponsoredPython Challenge Solutions
Python Challenge Solutions

