Please enable JavaScript to use CodeHS

  • Autograded

Tumor Scanner

In this project, students use 2D arrays to simulate a scan to find a tumor. Students will need to use pattern matching and array manipulation to solve this problem.

Hard

7 Hours

High School

Project Description

Background

Doctors are always looking for ways to detect and diagnose tumors at an early stage. One of the problems can be that a tumor may not be easy to spot, especially if it is in the middle of other tissue or oriented in a different angle. Using computer science algorithms, doctors can now compare scans and tumors in much more detail.


In this project, you are going to create a program that can take a known tumor and use it on a patient scan to determine if the patient has a possible tumor.


Inputs

We will represent both the tumor and the patient scan as square grids of binary values (1s and 0s). Here is a sample graphic scan and tumor:


Scan:


Input:

In this case, the scan would be represented by

1100
0001
1100
0100

and the tumor by

11
01


A possible tumor is detected starting at the first column of the third row since the pattern for the tumor matches starting at that corner.


Your Task

Your job is to check each orientation of the tumor, starting from the orientation from the input and then rotating the tumor 90 degrees clockwise 4 times. Each time you should either print out that no tumor is detected or the coordinates for where the tumor is detected.

Project Demo

Explore this program before assigning it!

Project Overview

Here is an outline of the project activities: