CWU CS Code Challenge
Complete the CS quarter/bi-monthly Code Challenge for a chance to win a fabulous prize, and be forever immortalized among your peers for being a guru problem solver extraordinaire.
Submit your answer/solution via email to jagodzinski [at] cwu.edu, with the subject Code Challenge Submission
The first correct answer and person who submitted it will be announced here. Extra creative, and/or especially unique approaches at answering the challenge, will also be posted. If your code is especially elegant, then submit it, too, so that it can be posted and marveled at.
2015

Task : Write a program that takes as input n integers, separated by commas, where n ≥ 8. Successive pairs of input integers are the x-y coordinates of the vertex points of a closed polygon. The program outputs inside if the last pair of input integers represent an x-y coordinate that is inside the closed polygon. The program outputs outside if the last pair of input integers are the x-y coordinates of a point that is not inside of the closed polygon. A final point that is on one of the lines of the closed polygon should be considered outside the polygon, and the interior of the closed polygon must be a continuous space. Sample input and outputs, and explanation diagrams, are shown in the below table.

This challenged in inspired by a discussion with Gabriel Ratener, a graduate student at CWU.

Input Output Coordinate
0,0,4,0,4,4,0,4,1,1 Inside

0,2,0,0,4,0,-2,2 Outside

4,0,4,4,2,1,-1,3,0,0,1,0 Outside

0,0,4,0,3,3,2,0,0,2,3,1 Not allowed

Submission instructions : email jagodzinski@cwu.edu your code source file(s). Also include instructions for compiling and/or running the program. The subject of the email should be "Code Challenge Submission"

Submissions may be individual or by pairs of people. The prize for the first correct answer is a $20 gift certificate to the CWU bookstore.

2015

Scenario : You are a new hire at a cryptography firm. For your first job task, the below text has been intercepted by your fellow network engineers. One thing that is known for certain is that spaces have been preserved.

ng ngnlicpc bo hum embyitpwbgjvlmpv nvpe objge pg hum mhuqbpe zbqmt nge fns wbgmc vbgoptqme hunh hum cdmlmhnl btpapgc smtm qbch lpdmli bo njchtnlbrphumvjc btpapg

Task : Decrypt the message. Use any standard programming language that you want.

Submission instructions : email jagodzinski@cwu.edu your code source file(s) as well as any accessory text files you may have used. Also include in the email the plain text decrypted message. The subject of the email should be “Code Challenge Submission”

Submissions may be individual or by pairs of people. The prize for the first correct answer is a $20 gift certificate at the CWU bookstore.


Winner (first correct submission) : Mitchell Hansen
The decrypted message : an analysis of the deoxyribonucleic acid found in the ethmoid vomer and jaw bones confirmed that the skeletal origins were most likely of australopithecus origin
. There are many approaches that might have decrypted the original message. A brute-force approach with a dictionary file was a commonly-submitted solution. Another approach would have leveraged the fact that one of the words is a 16-letter word, of which there are fewer than 12 in the English language.
2014

Task: You are a programmer for a cybersecurity company, and you are part of a project team in need of prime numbers. Such numbers are often-used ingredients for encrypting data (want to know more, take the CS450 course offered in the fall). Your boss is a bit eccentric, and he's in need of not "just" prime numbers, but what he calls "super primes." They are numbers which are prime, and whose digits sum to a prime number, too.

For example, the number 61 is a super prime, because 61 is prime and 6+1=7 is prime, too. However the number 59 is not super prime, because although 59 is prime, 5+9=14 is not.

As this is the first programming challenge of the year, it is suitable for introductory level students (those just now taking CS110), but suitable for higher-level students, too.

Write a program that computes the list of super prime numbers less than 1 million and outputs that list to a text file. Your program cannot rely on a list of hard-coded (either placed physically into your code, or retrieved from a file that you fine online) prime numbers.

Submit:

  • Your program code (written in java, C, C++, lisp, python, etc., or some other "normal" language)
  • Instructions (a single paragraph should suffice) on how to run your program
  • The count of how many numbers your program computes to be super prime
  • The list of super primes

Prize: $10 gift certificate to the CWU bookstore to the first correct answer.


Winner (first correct submission) : Jon Goodgion

2014

None of the submissions for the March 2014 code challenge were fully correct. The April 2014 code challenge is the same as the code challenge for March 2014. However more sample cases are given below, and the award prize has increased.

Task: Write a program or script that takes as input four coordinates from the x-y plane, and determines if those four points lie on the perimeter of a triangle, are the four corners of a square, or if the four points are random points (they neither lie on the perimeter of a triangle nor are they the four corners of a square).

For example, the following inputs generate the following outputs (the coordinate plots are shown for illustration purposes only, and your program does NOT need to generate these)

Input Output Coordinate
(0,-1)
(0,1)
(0,4)
(-1,3)
On the perimeter of a triangle

(1,1)
(3,1)
(1,3)
(3,3)
Corners of square

(0,0)
(4,0)
(0,1)
(2,1)
On the perimeter of a triangle

(0,0)
(0,-2)
(0,1)
(0,3)
On the perimeter of a triangle

(2,0)
(0,2)
(0,-2)
(-2,0)
Corners of a square

Your program should be able to receive as input the coordinates of the four points in any order. The program can receive as input the coordinate of the four points either via from the command line, or from a file. Code using any "standard" programming language will be accepted.

Prize: $30 $20 gift certificate to the CWU bookstore


Winner (first correct submission) : James Tunnell

2014

Task: Identify all of the words in the English language that have an even number of letters, such that the letter at index i of the word, where i is an even integer, immediately precedes alphabetically the letter that is at position i+1 of the word.

For example, one such word is STOP, because the letter S precedes the letter T in the alphabet, and the letter O precedes the letter P. However, the word LION is not one of these words, because L does not precede I, and O does not precede N. The word ABET is also not one of these words, because although A precedes B alphabetically, E is not immediately followed by T in the alphabet.

Prize: $10 gift certificate to the CWU bookstore


Winner (first correct submission) : Emily Wallen