// Numbas version: finer_feedback_settings {"name": "Caesar Cipher", "extensions": [], "custom_part_types": [], "resources": [["question-resources/image_hreTKeM.png", "/srv/numbas/media/question-resources/image_hreTKeM.png"], ["question-resources/image_QiXzMJa.png", "/srv/numbas/media/question-resources/image_QiXzMJa.png"], ["question-resources/image_fNfHwRn.png", "/srv/numbas/media/question-resources/image_fNfHwRn.png"], ["question-resources/image_ESH1Fkk.png", "/srv/numbas/media/question-resources/image_ESH1Fkk.png"], ["question-resources/image_k6NDOc1.png", "/srv/numbas/media/question-resources/image_k6NDOc1.png"], ["question-resources/image_lGPa9ZR.png", "/srv/numbas/media/question-resources/image_lGPa9ZR.png"], ["question-resources/image_StpjHXy.png", "/srv/numbas/media/question-resources/image_StpjHXy.png"], ["question-resources/image_K0DXYPm.png", "/srv/numbas/media/question-resources/image_K0DXYPm.png"], ["question-resources/image_zmrWVqr.png", "/srv/numbas/media/question-resources/image_zmrWVqr.png"], ["question-resources/image_LDdYvys.png", "/srv/numbas/media/question-resources/image_LDdYvys.png"], ["question-resources/image_8axacAg.png", "/srv/numbas/media/question-resources/image_8axacAg.png"], ["question-resources/image_aJ5I5mC.png", "/srv/numbas/media/question-resources/image_aJ5I5mC.png"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Caesar Cipher", "tags": [], "metadata": {"description": "

A question that will allow students to check their understanding of the Caesar Cipher by encrypting a short message given a random key. May be updated with a decryption task later.

", "licence": "None specified"}, "statement": "

This question will allow you to check your understanding of the Caesar Cipher by encrypting a short message given a random key. You may find this website of ten letter words useful for this question.

", "advice": "

Recall that plaintext should be entered as lower case and ciphertext should be entered as upper case.

\n

Suppose that your word was \"{plaintext}\". Each character of the word \"{plaintext}\" is encrypted separately, using the key $k = \\var{caesar_key}$: $c_i = m_i + k~(\\operatorname{mod} 26)$. We are mapping letters to numbers by their place in the alphabet, so \"a\" corresponds to $0$, \"b\" corresponds to $1$, ..., \"z\" corresponds to $25$.

\n

For example, the first letter of this word (in position $0$) is \"{plaintext0}\", which corresponds to $\\var{ascii_lower[plaintext0]-97}$. So $c_0 = m_0 + k~(\\operatorname{mod} 26) = \\var{ascii_lower[plaintext0]-97} + \\var{caesar_key}~(\\operatorname{mod} 26) = \\var{mod(ascii_lower[plaintext0]-97 + caesar_key,26)}~(\\operatorname{mod} 26)$. This corresponds to \"$\\var{upper(keys(ascii_lower)[mod(ascii_lower[plaintext0]-97 + caesar_key,26)])}$\".

\n

We carry on to do this for each letter, which for the word \"{plaintext}\" would eventually give the ciphertext \"{ciphertext}\".

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"caesar_key": {"name": "caesar_key", "group": "Ungrouped variables", "definition": "random(1..25)", "description": "", "templateType": "anything", "can_override": false}, "plaintext": {"name": "plaintext", "group": "Ungrouped variables", "definition": "\"pacesetter\"", "description": "", "templateType": "string", "can_override": true}, "plaintext1": {"name": "plaintext1", "group": "Ungrouped variables", "definition": "plaintext[1]", "description": "", "templateType": "anything", "can_override": false}, "plaintext2": {"name": "plaintext2", "group": "Ungrouped variables", "definition": "plaintext[2]", "description": "", "templateType": "anything", "can_override": false}, "plaintext0": {"name": "plaintext0", "group": "Ungrouped variables", "definition": "plaintext[0]", "description": "", "templateType": "anything", "can_override": false}, "plaintext3": {"name": "plaintext3", "group": "Ungrouped variables", "definition": "plaintext[3]", "description": "", "templateType": "anything", "can_override": false}, "plaintext4": {"name": "plaintext4", "group": "Ungrouped variables", "definition": "plaintext[4]", "description": "", "templateType": "anything", "can_override": false}, "plaintext5": {"name": "plaintext5", "group": "Ungrouped variables", "definition": "plaintext[5]", "description": "", "templateType": "anything", "can_override": false}, "plaintext6": {"name": "plaintext6", "group": "Ungrouped variables", "definition": "plaintext[6]", "description": "", "templateType": "anything", "can_override": false}, "plaintext7": {"name": "plaintext7", "group": "Ungrouped variables", "definition": "plaintext[7]", "description": "", "templateType": "anything", "can_override": false}, "plaintext8": {"name": "plaintext8", "group": "Ungrouped variables", "definition": "plaintext[8]", "description": "", "templateType": "anything", "can_override": false}, "plaintext9": {"name": "plaintext9", "group": "Ungrouped variables", "definition": "plaintext[9]", "description": "", "templateType": "anything", "can_override": false}, "ciphertext0": {"name": "ciphertext0", "group": "Ungrouped variables", "definition": "keys(ascii_upper)[ascii_upper_cipher[upper(plaintext0)]-65-13]", "description": "", "templateType": "anything", "can_override": false}, "ascii_lower": {"name": "ascii_lower", "group": "Ungrouped variables", "definition": "dict(\"a\":97,\"b\":98,\"c\":99,\"d\":100,\"e\":101,\"f\":102,\"g\":103,\"h\":104,\"i\":105,\"j\":106,\"k\":107,\"l\":108,\"m\":109,\"n\":110,\"o\":111,\"p\":112,\"q\":113,\"r\":114,\"s\":115,\"t\":116,\"u\":117,\"v\":118,\"w\":119,\"x\":120,\"y\":121,\"z\":122)", "description": "", "templateType": "anything", "can_override": false}, "ascii_upper": {"name": "ascii_upper", "group": "Ungrouped variables", "definition": "dict(\"A\":65,\"B\":66,\"C\":67,\"D\":68,\"E\":69,\"F\":70,\"G\":71,\"H\":72,\"I\":73,\"J\":74,\"K\":75,\"L\":76,\"M\":77,\"N\":78,\"O\":79,\"P\":80,\"Q\":81,\"R\":82,\"S\":83,\"T\":84,\"U\":85,\"V\":86,\"W\":87,\"X\":88,\"Y\":89,\"Z\":90)", "description": "", "templateType": "anything", "can_override": false}, "ascii_upper_cipher": {"name": "ascii_upper_cipher", "group": "Ungrouped variables", "definition": "dict(\"A\":(65 + mod(caesar_key + ascii_upper[\"A\"],26)),\"B\":(65 + mod(caesar_key + ascii_upper[\"B\"],26)),\"C\":(65 + mod(caesar_key + ascii_upper[\"C\"],26)),\"D\":(65 + mod(caesar_key + ascii_upper[\"D\"],26)),\"E\":(65 + mod(caesar_key + ascii_upper[\"E\"],26)),\"F\":(65 + mod(caesar_key + ascii_upper[\"F\"],26)),\"G\":(65 + mod(caesar_key + ascii_upper[\"G\"],26)),\"H\":(65 + mod(caesar_key + ascii_upper[\"H\"],26)),\"I\":(65 + mod(caesar_key + ascii_upper[\"I\"],26)),\"J\":(65 + mod(caesar_key + ascii_upper[\"J\"],26)),\"K\":(65 + mod(caesar_key + ascii_upper[\"K\"],26)),\"L\":(65 + mod(caesar_key + ascii_upper[\"L\"],26)),\"M\":(65 + mod(caesar_key + ascii_upper[\"M\"],26)),\"N\":(65 + mod(caesar_key + ascii_upper[\"N\"],26)),\"O\":(65 + mod(caesar_key + ascii_upper[\"O\"],26)),\"P\":(65 + mod(caesar_key + ascii_upper[\"P\"],26)),\"Q\":(65 + mod(caesar_key + ascii_upper[\"Q\"],26)),\"R\":(65 + mod(caesar_key + ascii_upper[\"R\"],26)),\"S\":(65 + mod(caesar_key + ascii_upper[\"S\"],26)),\"T\":(65 + mod(caesar_key + ascii_upper[\"T\"],26)),\"U\":(65 + mod(caesar_key + ascii_upper[\"U\"],26)),\"V\":(65 + mod(caesar_key + ascii_upper[\"V\"],26)),\"W\":(65 + mod(caesar_key + ascii_upper[\"W\"],26)),\"X\":(65 + mod(caesar_key + ascii_upper[\"X\"],26)),\"Y\":(65 + mod(caesar_key + ascii_upper[\"Y\"],26)),\"Z\":(65 + mod(caesar_key + ascii_upper[\"Z\"],26)))", "description": "", "templateType": "anything", "can_override": false}, "ciphertext1": {"name": "ciphertext1", "group": "Ungrouped variables", "definition": "keys(ascii_upper)[ascii_upper_cipher[upper(plaintext1)]-65-13]", "description": "", "templateType": "anything", "can_override": false}, "ciphertext2": {"name": "ciphertext2", "group": "Ungrouped variables", "definition": "keys(ascii_upper)[ascii_upper_cipher[upper(plaintext2)]-65-13]", "description": "", "templateType": "anything", "can_override": false}, "ciphertext3": {"name": "ciphertext3", "group": "Ungrouped variables", "definition": "keys(ascii_upper)[ascii_upper_cipher[upper(plaintext3)]-65-13]", "description": "", "templateType": "anything", "can_override": false}, "ciphertext4": {"name": "ciphertext4", "group": "Ungrouped variables", "definition": "keys(ascii_upper)[ascii_upper_cipher[upper(plaintext4)]-65-13]", "description": "", "templateType": "anything", "can_override": false}, "ciphertext5": {"name": "ciphertext5", "group": "Ungrouped variables", "definition": "keys(ascii_upper)[ascii_upper_cipher[upper(plaintext5)]-65-13]", "description": "", "templateType": "anything", "can_override": false}, "ciphertext6": {"name": "ciphertext6", "group": "Ungrouped variables", "definition": "keys(ascii_upper)[ascii_upper_cipher[upper(plaintext6)]-65-13]", "description": "", "templateType": "anything", "can_override": false}, "ciphertext7": {"name": "ciphertext7", "group": "Ungrouped variables", "definition": "keys(ascii_upper)[ascii_upper_cipher[upper(plaintext7)]-65-13]", "description": "", "templateType": "anything", "can_override": false}, "ciphertext8": {"name": "ciphertext8", "group": "Ungrouped variables", "definition": "keys(ascii_upper)[ascii_upper_cipher[upper(plaintext8)]-65-13]", "description": "", "templateType": "anything", "can_override": false}, "ciphertext9": {"name": "ciphertext9", "group": "Ungrouped variables", "definition": "keys(ascii_upper)[ascii_upper_cipher[upper(plaintext9)]-65-13]", "description": "", "templateType": "anything", "can_override": false}, "ciphertext": {"name": "ciphertext", "group": "Ungrouped variables", "definition": "join([ciphertext0,ciphertext1,ciphertext2,ciphertext3,ciphertext4,ciphertext5,ciphertext6,ciphertext7,ciphertext8,ciphertext9],\"\")", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["caesar_key", "plaintext", "plaintext0", "plaintext1", "plaintext2", "plaintext3", "plaintext4", "plaintext5", "plaintext6", "plaintext7", "plaintext8", "plaintext9", "ascii_lower", "ascii_upper", "ascii_upper_cipher", "ciphertext0", "ciphertext1", "ciphertext2", "ciphertext3", "ciphertext4", "ciphertext5", "ciphertext6", "ciphertext7", "ciphertext8", "ciphertext9", "ciphertext"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Word Entry", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Encryption", "rawLabel": "", "otherPart": 1, "variableReplacements": [{"variable": "plaintext", "definition": "interpreted_answer[0]"}], "availabilityCondition": "", "penalty": "", "penaltyAmount": 0, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Ten-letter Word", "prompt": "

Please enter a ten letter word in lower case: [[0]].

", "gaps": [{"type": "patternmatch", "useCustomName": true, "customName": "Plaintext", "marks": "0", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Ten-letter Word", "answer": "\\[a-z]{10}", "displayAnswer": "E.g., abandonee, fabricator, pacesetter.", "caseSensitive": true, "partialCredit": 0, "matchMode": "regex"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Encryption", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Encryption", "prompt": "

You are provided with the key $\\var{caesar_key}$ and your ten letter word was \"{plaintext}\". Encrypt your word using the Caesar Cipher, which should be entered in upper case: [[0]].

", "gaps": [{"type": "patternmatch", "useCustomName": true, "customName": "Ciphertext", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{ciphertext}", "displayAnswer": "", "matchMode": "exact"}], "sortAnswers": false}], "partsMode": "explore", "maxMarks": 0, "objectives": [{"name": "Ten-letter Word", "limit": 0}, {"name": "Encryption", "limit": 1}], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Alexander Corner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5328/"}]}]}], "contributors": [{"name": "Alexander Corner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5328/"}]}