Homework 5 – Rigged Elections
Due Date: Monday 11:59 PM Dec 5th, 2016
There are 2000 voting machines set up for the RPI presidential elections. All machines start off in working order. 2000 hackers are hired for the elections, each one with their ID number, looking to cause chaos.
When a machine is “hacked” it’s state changes from normal to rigged. Each machine can only be in one of those two states.
The hacker with ID 1 hacks all 2000 machines. The students with ID 2 then hacks all machines whose machine numbers are multiples of 2. The student with ID number 3 hacks of all machines whose numbers are multiples of 3 and so on for all 2000 students.
Use arrays, no crashes. No pseudocode this time but please include a document with the answers to the questions below. IPO and TOE are still required. You can design your own user interface for this homework (it’d be cool to see a representation of the machines flipping back and forth but its certainly not required). Don’t make it take forever to run the program.
Your task is to find:
1. Is machine 1337 normal or rigged?
2. Which tables will be rigged at the end?
1. If you had to list off the first 5-10 machines that were rigged at the end, without your program for help, could you? What is the rule/pattern? What is the explanation for the pattern?
3. Which machine was hacked the most times?
1. How did you store the data for this? Think about how you store the information helps you
to answer the question.
4. How many machines, and which ones, were hacked exactly twice?
5. How many of the even numbered machines are normal? How many odd numbered machines?
Extra Credit
Some of the machines are ✧magic ✦ machines. Each time machines 1999 and
3501 are touched, add 1000 more machines. The old machines keep their states and the new machines start off in normal mode. Do not reset the current operating hacker number. Aka when hacker #9 touches machine 702, she should continue with machine 711 after the new machine are made (then #10 goes after).
Hint: Use ReDim