Question: Formalizing the Problem Formally, the ( correct ) exam answers consist of 2 0 true / false responses. We can represent these responses as a
Formalizing the Problem Formally, the correct exam answers consist of truefalse responses. We can represent these responses as a binary array B where Bi if the correct answer to question i is true, and Bi if the correct answer to question i is false. Given the array B your friend must determine a message M that she sends to you. We can similarly encode M M as a binary array containing only values. Given the message M you must determine your corresponding answers to the questions which we can represent as a binary array of length A The challenge is to determine an encoding scheme: An encoding function e : from which your friend computes her message from the correct answers. That is M eB
A decoding function d : from which you determine your exam answers from your friends message. That is A dM Given exam solutions B and your answers A your score on the exam is scoreB A HAB where HABi Ai Bi is the Hamming distance between A and B Your goal is to define encoding and decoding functions e and d that maximize your guaranteed score. That is you wish to maximize the value G min scoreBdeBB in Note that this expression is the worstcase ie lowest score that your encoding scheme provides over all possible exam solutions.
implement an encoding scheme as described above in the Python programming language. To this end, you must complete the program examcheatcode.py by implementing two functions: encodesolutions: listint listint that takes as input a list of binary values representing the correct solutions to the exam B and returns a list of binary values representing the message M to be relayed to you during the exam. decodemessage: listint listint that takes as input a list of binary values representing the message M you receive from your friend, and returns a list of binary values representing the solutions A you submit for the exam. Your completed examcheatcode.py will be tested using the program examtester.py This program iterates over all possible exam solutions and finds the lowest score guaranteed by your implementation of the encoding and decoding functions.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
