The ISAT 252
Spring Break
Challenge

"Slave power crushes freedom of speech and of opinion. Slave power degrades labor. Slave power is arrogant, is jealous and intrusive, is cruel, is despotic, not only over the slave but over the community, the state."
 

Elizabeth Van Lew

Spy and Anti-Slavery Activist

Code has been around... even before computers...

Code-breaking was even the inspiration and motivation behind the creation of one of the very first working computers...

The Challenge

Write a program that can encode a message using the following algorithm:

  1. Remove all spaces and punctuation
  2. Convert all letters to lowercase
  3. Divide the message up into rows using the following rules:
    1. If the number of characters is a perfect square, i.e. 4, 9, 16, 25, 36, ..., there should be an equal number of rows and columns
    2. Otherwise, choose the number of columns that corresponds to the smallest square larger than the number of characters in the message.
  4. Create a new set of "words" by going down the columns, i.e. the first word would be the first letter in each row, starting at the top, the second word would be the second letter in each row, etc.
  5. Return the resulting set of "words" separated by spaces

An Example

To encode the following quote:

We must let go of the life we have planned, so as to accept the one that is waiting for us.

First, remove all spaces and punctuation:

Wemustletgoofthelifewehaveplannedsoastoaccepttheonethatiswaitingforus

Second, convert to all lowercase:

wemustletgoofthelifewehaveplannedsoastoaccepttheonethatiswaitingforus

Third, break the letters up into a series of "words" and put them in rows so that there are an even number of rows and columns...

An Example

There are 69 letters in this string, so we would create a "square" with 9 columns and 8 rows, like so:

wemustlet

gooftheli

fewehavep

lannedsoa

stoaccept

theonetha

tiswaitin

gforus

Hint: Take the square root of the message length, and round up!

Fourth, create new "words" by taking the letters from each column, then (fifth) output them separated by spaces

wgflsttg eoeathif mownoeso ufenaowr sthecnau thadceis levsett eleophi tipatan

Requirements

  • Do this in teams of no more than 3 people
  • Your solution must be saved online in a GitHub repo
  • You must use TDD, so there should be a reasonable set of tests that accompany your code
  • You should write your program in two different programming languages of your choice
  • It must be done by the time class starts on the Friday following Spring Break
  • Each team should plan a presentation that lasts no more than 5 minutes

Suggestions

  • Start early
  • Make plans to meet with your team during our scheduled class times so that you can take full advantage of your time to work together
  • Break the program up into small pieces and write a function (which you can test!) to implement each piece
  • You will have to use coding skills that we haven't yet covered in class, so you will have to make use of the internet to figure out how to do this
  • I recommend looking at tutorials on loops, arrays, and string manipulation

The Team with the Best Program in Each class will get 7 points for each team member

The ISAT 252 Spring Break Challenge

By Morgan Benton

The ISAT 252 Spring Break Challenge

This is a programming challenge problem for students in my intro programming class.

  • 1,180