关键词 > Nonograms/MIPS

Assignment 1: Nonograms in MIPS

发布时间:2025-07-23

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Assignment 1: Nonograms in MIPS

Aims

to give you experience writing MIPS assembly code

to give you experience translating C to MIPS 

to give you experience with data and control structures in MIPS

Getting Started

Create a new directory for this assignment called nonograms, change to this directory, and fetch the provided code by running these commands:

$ mkdir -m 700 nonograms

$ cd nonograms

$ 1092 fetch nonograms

If you're not working at CSE, you can download the provided files as a zip file or a tar file.

This will add the following files into the directory:

nonograms.s : a stub MIPS assembly file to complete.

nonograms.c : a reference implementation of nonograms in C.

nonograms. simple.c : a copy of the reference implementation of nonograms, for you to simplify.

input.txt : example input file.

nonograms.mk : a make fragment for compiling nonograms.c.

Nonograms: The Puzzle

nonograms .cis an implementation of a program to play nonogroms (also known as Picross).

A nonogram puzzle takes place on a 2D grid, where the player must mark a set of cells, according to number clues placed on the edge of the puzzle.

Each row and column contains a sequence of numbers which correspond to the correct lengths of consecutive runs of marked cells in that row/column. For example, the numbers 2 3 1 mean that row/column has a run of 2 marked cells, then 3 marked cells, then 1 marked cells, with gaps of at least one cell between them.

The mcommands allows the player to mark, unmark or cross out (indicate that the cell should definitely be unmarked) a cell based on the row (lowercase letter) and column (uppercase letter).

An example game of nonograms can be seen to the right.

To get a feel for this game, try it out in a terminal:

$ dcc nonograms.c -o nonograms

$ ./nonograms

You should read through nonograms.c. There are comments throughout it that should help you understand what the program is doing itotion needed—which you'll need for the next part of the assignment.