Project briefing illustration for ascii transforms: a flat tactical intelligence sheet in the style of Star Fox Assault.
ACADEMIC PROJECT / Computer Science Course

C ASCII Image Transformer

I revisited an unfinished ASCII-image skeleton and completed a clearly labeled 2026 interpretation, working through exact-width spaces, coordinate transforms, bounded enlargement, and layered tests.

CASCII artCoordinate transformsProperty testingArchive reconstruction

Why I started from the unfinished skeleton

When I reopened this C project, I had an image structure, fixed 100-by-100 storage, and command dispatch for rot, flip, inv, and stretch, but the operation bodies were empty. I wanted to complete a useful interpretation without hiding that unfinished starting point.

I started from the unfinished March 2024 skeleton. In October 2026, I implemented operation bodies, added input validation, normalized a fixture, and checked the coordinate transforms in layers. The behavior below is a reconstruction; an original prompt could establish different intended semantics.

THE CHALLENGE

The challenge: treating spaces as image data

I first stated the interpretation's rules: * is foreground and a literal space is background; rotation is clockwise in multiples of 90 degrees; horizontal reflection swaps left and right; vertical reflection swaps top and bottom; and stretching uses nearest-neighbor enlargement by a positive integer factor.

The parsing challenge was that spaces are image data, including leading and trailing spaces. I defined canonical input as a rows-and-columns header followed by exactly that many rows of exactly that width. Reading with %s would discard that structure, so I used fgets and validated dimensions and row lengths.

I also supported the compact two-digit header 55 as a documented legacy form. The preserved fixture declares a five-by-five image but ends with a six-character row. I retained it as invalid evidence and made a separate normalized fixture with 5 5 and the extra trailing blank removed. That gave me a deliberate working example without silently changing the original.

How I mapped a clockwise rotation

PROJECT STEPS

How I make a quarter-turn inspectable

Project briefing illustration for ascii transforms: a flat tactical intelligence sheet in the style of Star Fox Assault.
STEP 01 OF 04
Read exact-width rows

For my 2026 interpretation, I check the dimensions and read exactly the declared number of rows at their declared width, preserving spaces at both ends. Reading only separated words would lose those background pixels. I keep the malformed original example separately and use a corrected example for the demonstration rather than silently cutting rows to fit.

Select a step to follow the project.
Read all step descriptions
  1. Read exact-width rows

    For my 2026 interpretation, I check the dimensions and read exactly the declared number of rows at their declared width, preserving spaces at both ends. Reading only separated words would lose those background pixels. I keep the malformed original example separately and use a corrected example for the demonstration rather than silently cutting rows to fit.

  2. Map each source pixel

    I define a clockwise quarter-turn by moving the character at row r and column c to row c and column rows − 1 − r, where rows is the original row count. Writing this rule explicitly lets me trace how even a non-square image moves. I implemented this behavior in 2026 from an unfinished skeleton, with support for multiples of 90 degrees rather than resampling at arbitrary angles.

  3. Write a fresh image

    I put the rotated characters in a fresh image and exchange the row and column counts, so earlier writes cannot destroy characters I still need to read. I keep this interpretation’s two-symbol image format, stars and spaces, within its 100-by-100 storage limit. I output the dimensions with the result so it can be read as the input for another transformation.

  4. Verify the movement

    I first compare the reconstructed rotation with a specific expected non-square image, where a dimension mistake is easier to see. I then check that four quarter-turns return the original image. This adds a consistency check, but I still need the explicit expected result because a program that never moved any characters would also return the original after four operations.

2026 interpretation: preserve exact-width input before applying a documented coordinate mapping.

For a clockwise quarter-turn, I map source (r, c) to destination (c, rows - 1 - r) and swap the row and column counts. I write into a fresh image so an early destination write cannot destroy a source pixel I still need.

I use a synthetic two-by-three image to make the dimension change visible. In the example below, a dot represents a background space only for readability:

Illustrative text example
Before       Clockwise 90 degrees
*..          **
***          *.
             *.

I keep actual files space-based, not dot-based, and identify this as an illustrative coordinate example rather than a historical screenshot. In the implementation, I normalize angles and repeat the quarter-turn for multiples of 90, including negative values. I do not include arbitrary-angle resampling in this contract.

How I defined reflection, inversion, and enlargement

I define horizontal reflection as destination (r, c) reading source (r, columns - 1 - c), and vertical reflection as reading (rows - 1 - r, c). I spell out the axes because a label like horizontal flip can otherwise be interpreted in different ways.

For inversion, I exchange foreground and background and reject other symbols instead of inventing brightness values for them. That keeps the operation explicitly binary rather than a general printable-character transform.

For an integer scale factor k, I read source (r / k, c / k) for destination (r, c), using integer division. Each input pixel becomes a k-by-k block. I check the factor and both output dimensions before copying, because a valid image can still request an enlargement exceeding the storage limit of 100 in either dimension.

I include dimensions followed by exact-width pixel rows in the output so one operation's result can become the next operation's input. I label that header as another 2026 reconstruction choice: the incomplete original printed only rows.

How I combined exact answers with identities

I compare non-square rotation, both reflections, inversion, and enlargement with explicit expected outputs in the restoration tests. I use non-square images because they reveal failures to swap dimensions that a square fixture could conceal.

I also check identities on several deterministic images: four clockwise quarter-turns restore the input, two inversions restore it, and two reflections on the same axis restore it. Those checks cover many pixels and dimensions without requiring a handwritten picture for every intermediate step.

I do not rely on identities alone. A function that leaves every image untouched would pass the four-rotation identity too. I use known answers to establish the intended movement, then identity tests to check consistency across compositions; that combination provides stronger evidence than either by itself.

My negative cases cover unsupported angles and axes, missing arguments, excessive scaling, and malformed rows. I keep the original malformed fixture in that set: rejecting it confirms that the parser does not quietly truncate evidence just to make a demo work.

What I completed and learned

I newly implemented all four transform bodies in October 2026, together with signature corrections, required headers, validation, dimensioned output, and the test material. The resulting tool handles binary ASCII images up to 100 by 100; it has no color, file-format codecs, arbitrary-angle interpolation, or graphical interface.

I learned how explicit coordinate rules, composable output, and layered tests can make a small image-processing program verifiable. The recovered artifact remains an unfinished skeleton; the working behavior described here is my later specified interpretation.

PROJECT WALKTHROUGH

The March 2024 artifact is an unfinished skeleton. I implemented four operations and validation in October 2026; those semantics remain a later interpretation because the original prompt was not recovered.

Validation & limitations

  • The March 2024 artifact is an unfinished skeleton. I implemented four operations and validation in October 2026; those semantics remain a later interpretation because the original prompt was not recovered.

Project records

  • Project artifacts and historical records, March 2024, approximate month
  • Restoration and public documentation, October 1, 2026
END OF PROJECT FILE RETURN TO ARCHIVE