On the Subject of The Holy Code

PUNISHMENT IS IMMINENT!

The only way to continue your journey is through the Holy Code in front of you. To solve this module, you must obtain its Solve light and use it within the Holy Code.

By highlighting the top half of the module, you can view your inventory, which will contain four module items. The modules’ names can be seen by highlighting them.

The Holy Code will infinitely scroll through excerpts from two of some modules’ source codes (all of the possible excerpts can be found in Appendix SOURCE-CODE), with exactly one of those modules being an item from this module’s inventory - this module is the Source Module.

The scrolling code will be obfuscated in two ways:

  1. Spaces will occasionally be inserted into/removed from random positions within every displayed line of code.
  2. All variable names will be replaced with random static strings consisting of characters which can be digits 0-9, letters A-F, and the letter X.
    • Same variable names within the same excerpt are replaced with the same strings.

Prepare the grid that will be used for encoding the other modules’ names:

  • Create an empty 4×4 grid. Label its columns A-D left-to-right, and label its rows 1-4 top-to-bottom.
  • For each character of the serial number:
    • If it is a...
      • number, keep it in range 1-4 by adding/subtracting 4.
      • letter, keep it in range A-D by keeping its alphabetical position in range 1-4 by adding/subtracting 4.
    • If the resulting character has already been encountered, keep adding 1 to it or its alphabetical position, still keeping the character in range 1-4/A-D, until it is unique.
    • Take the row/column labeled with the resulting character and fill in all unfilled cells in it in order left-to-right/top-to-bottom (for rows/columns, respectively) with the currently unassigned characters from the string 0123456789ABCDEF.
    • Stop when all characters from the aforementioned string have been exhausted.
    • If all characters from the serial number have been exhausted and the grid has not been fully filled, fill in the rest of the unfilled cells with the remaining unassigned characters in reading order.
  • Duplicate the last column of the grid, placing it to the right of all other columns. Prepend every cells’ contents in this column with an X.
  • Duplicate the last row of the grid, placing it below all other rows. Prepend every cells’ contents in this row with an X.
  • Set the bottom-right-most cell of the grid to XX, and the cell to the left of it - to the top-left-most cell, prepended with an X. The resulting 5×5 grid shows what substring each letter A-Z (excluding the letter J) encodes to, in reading order.

Example

Initial Grid
ABCD
1
2
3
4
R → B → Column B
ABCD
10
21
32
43
3 → 3 → Row 3
ABCD
10
21
34256
43
6 → 2 → Row 2
ABCD
10
27189
34256
43
C → C → Column C
ABCD
10A
27189
34256
43B
2 → 2 → 3 → 4 → Row 4
ABCD
10A
27189
34256
4C3BD
7 → 3 → 4 → 1 → Row 1
ABCD
1E0AF
27189
34256
4C3BD
Filled-in Grid
ABCD
1E0AF
27189
34256
4C3BD
After transforming into a 5×5 grid (by duplicating the last column and row)
E0AFXF
7189X9
4256X6
C3BDXD
XCX3XBXEXX

Referenced
letter grid
ABCDE
FGHIK
LMNOP
QRSTU
VWXYZ

Encoding example on the word HOURGLASS:
H → 8, O → 6, U → XD, R → 3, G → 1, L → 4, A → E, S → B, S → B,
Encoded word: 86XD314EBB

For every non-Source Module item, take its name, leave only the letters, and then encode them by substituting them with the substrings that they encode to.

For two out of the three of those items, there will be some variable within the Source Module’s code excerpt whose random string representation is a substring of the item’s encoded name. For those two items, count the number of letters from the word “TURRON” within their names, and use the item with the higher total (or either in case of a tie). The third of those three items is the Outlier Module.

If a correct item is used, you will receive a “Solve” item in place of the previously used item, and unlock the ability to jump into the Holy Code (by pressing the bottom half of the module).

Within the Holy Code, you must find (using the arrow buttons to look through the doors) and enter the correctly-colored door (by pressing it):

  • Take the Outlier Module’s first and last letters, and convert them into their alphabetical positions to obtain X and Y respectively.
  • Take X modulo the number of variables within the Source Module’s code excerpt, then add 1. Take the Xth variable within the Source Module’s code excerpt in reading order (only counting the variables’ first occurrences).
  • Take Y modulo the number of letters within the previously obtained variable’s name, then add 1. Take the Yth letter within the obtained variable’s name, then take the color that the letter corresponds to in the table below. This is the color of the door you should enter within the Holy Code to solve the module.
AAmber
BBlue
CCyan
DDandelion
EEmerald
FForest
GGreen
HHazel
IIndigo
JJade
KBlack
LLime
MMagenta
NBrown
OOrange
PPurple
QQuartz
RRed
SRose
TTeal
UUltramarine
VVanilla
WWhite
XXotic
YYellow
ZAzure

If an incorrect item is used before jumping into the code, a strike will be given, but the module will only fully reset if the incorrectly used item was the Source Module item. Choosing an incorrect door in the Holy Code will also give a strike and will fully reset the module.

Appendix SOURCE-CODE

All first occurrences of variable names are bolded, underlined, and written in italic in the table below. Certain lines (to be exact, all comment and logging lines) have been removed from the excerpts. The number within brackets after every module name indicates the number of variables found in the module’s excerpt.

ENA Cipher
(12)
string output = "";
for (int i = 0; i < word.Length; i += 3)
{
  string currentSet = word.Substring(i, 3);
  int[] row = currentSet.Select(x => key.IndexOf(x) / 5).ToArray();
  int[] col = currentSet.Select(x => key.IndexOf(x) % 5).ToArray();
  int cMin = col.Min();
  int cMax = col.Max();
  int cRange = cMax - cMin;
  col = col.Select(x => (cMin + cRange - x + cMin) % 5).ToArray();
  for (int j = 0; j < 3; j++)
  {
    output += key[(5 * row[j] + col[j]) % 26];
  }
}
return output;
Pip-Nado (5) countdownTimer = false;
int finalNumber = int.Parse(dispNumbers[0].ToString() + dispNumbers[1].ToString() + dispNumbers[2].ToString());
if (finalNumber == calculatedNumber)
{
  StartCoroutine(solveStuff());
}
else
{
  string strike = "Expected " + calculatedNumber.ToString() + ", but inputted " + finalNumber.ToString() + ".";
  strikeMessage(strike);
}
Synapse Cipher
(7)
var finalEncrypted = "";
for (var p = 0; p < word.Length; p++)
{
  var offsetCurLetter = (keyC.IndexOf(superPositionKW[1][p]) - keyC.IndexOf(superPositionKW[2][p]) + 26) % 26;
  finalEncrypted += keyC[(keyC.IndexOf(encrypted[p]) + offsetCurLetter) % 26];
}
encrypted = finalEncrypted;
Stroop’s Test
(9)
while (true)
{
  var textIx = rnd.Range(0, colors.Length);
  var colorIx = rnd.Range(0, colors.Length);
  if (wordList.Count > 20 && colorList.Count > 20)
  {
    for (var i = 0; i < 10; i++)
    {
      wordList.RemoveAt(i);
      colorList.RemoveAt(i);
    }
  }
  if (wordList.Count >= 1 && colorList.Count >= 1)
  {
    isActivated = true;
    while (wordList.Last() == textIx && colorList.Last() == colorIx)
    {
      textIx = rnd.Range(0, colors.Length);
      colorIx = rnd.Range(0, colors.Length);
    }
  }
  wordList.Add(textIx);
  colorList.Add(colorIx);
screenText.text = colorNames[textIx];
  screenText.color = colors[colorIx];
  yield return new WaitForSeconds(1.55f);
}
Quantum Passwords
(3)
for (int i = 0; i < 2; i++)
{
  int[] shiftValue = new int[2];
  shiftValue[i] = rnd.Range(1, selectedWords[i].Count());
  if (shiftValue[0] == shiftValue[1])
  {
    while (shiftValue[0] == shiftValue[1])
    {
      shiftValue[i] = rnd.Range(1, selectedWords[i].Count());
    }
  }
  selectedWords[i] = shiftingText(selectedWords[i], shiftValue[i]);
}
Starmessage
(9)
int ix = rnd.Range(0, wordList.Count());
selectedWord = wordList[ix];
selectedValue = digitTable[ix, Bomb.GetSerialNumberNumbers().Last()];
string modified = string.Empty;
var shuffleThing = new List<int>() { 0, 1, 2, 3 };
shuffleThing.Shuffle();
for (int i = 0; i < 4; i++)
{
  modified += selectedWord[shuffleThing[i]];
}
RGB Chess
(8)
for (int i = 0; i < genPieceAmount; i++)
{
randomPosition = Rnd.Range(0, 6).ToString() + Rnd.Range(0, 6).ToString();
  while (randomPositions.Contains(randomPosition))
  {
    randomPosition = Rnd.Range(0, 6).ToString() + Rnd.Range(0, 6).ToString();
  }
  randomPositions.Add(randomPosition);
randomColor = Rnd.Range(0, 2).ToString() + Rnd.Range(0, 2).ToString() + Rnd.Range(0, 2).ToString();
  while (randomColor == "000")
  {
    randomColor = Rnd.Range(0, 2).ToString() + Rnd.Range(0, 2).ToString() + Rnd.Range(0, 2).ToString();
  }
randomColors.Add(randomColor);
randomPieces.Add(pieceShortNames[Rnd.Range(0, 5)].ToString());
}
Cornflower Cipher
(13)
var brailleNibbles = new int[(word.Length * 3 + 1) / 2];
for (int i = 0; i < word.Length; i++)
  for (var dot = 0; dot < 6; dot++)
    if (brailleDots[word[i] - 'A'][dot])
      brailleNibbles[(dot % 3 + 3 * i) / 2] |= 1 << ((dot % 3 + 3 * i) % 2) * 2 + dot / 3;
var colSeq = sequencing(kw3.Substring(0, 4));
var rowSeq = sequencing(kw3.Substring(4));
var polybius = (bits[0] ? (kw3 + "ABCDEFGHIJKLMNOP") : "ABCDEFGHIJKLMNOP".Except(kw3).Concat(kw3)).Distinct().Where(ch => ch <= 'P').Join("");
encrypted = brailleNibbles.Select(nibble => polybius[colSeq[nibble % 4] + 4 * rowSeq[nibble / 4]]).Join("");
Simon Subdivides
(12)
int s = Random.Range(0, 4);
int t = ((r + 1) * 4) + s;
sequences[0].Add(arrange[r + 1, s]);
sequences[1].Add(grids[(gridselect + subnum) % 5, sequences[0][i], sequences[0][i + 2]]);
if (split[r + 1][s])
{
  int u = Random.Range(0, 4);
  sequences[0].Add(arrange[t + 1, u]);
  sequences[1].Add(grids[(gridselect + subnum) % 5, sequences[0][i], sequences[0][i + 3]]);
flashseq[0].Add(((t + 1) * 4) + u);
  flashseq[1].Add(arrange[t + 1, u]);
  i += 2;
}
else
{
  flashseq[0].Add(t);
  flashseq[1].Add(arrange[r + 1, s]);
  i++;
}
Off-White Cipher
(12)
int aX = Array.IndexOf(_orphanage, a) % 5;
int aY = Array.IndexOf(_orphanage, a) / 5;
int bX = Array.IndexOf(_orphanage, b) % 5;
int bY = Array.IndexOf(_orphanage, b) / 5;
int xChange = Mod(bX - aX, 5);
int yChange = Mod(bY - aY, 5);
int cX = (bX + xChange) % 5;
int cY = (bY + yChange) % 5;
char c = _orphanage[5 * cY + cX];
Bamboozling Button
(4)
answerKey[0] = table[randomiser[0]][randomiser[5] - randomiser[3]] + table[14 - randomiser[0]][randomiser[6] - randomiser[4]];
answerKey[1] = table[randomiser[1]][randomiser[7]] + table[randomiser[2]][randomiser[8]];
if (randomiser[10] == 1)
{
  int temp = answerKey[0];
  answerKey[0] = answerKey[1];
  answerKey[1] = temp;
}
switch (randomiser[9])
{
  case 0:
    answerKey[0] = (answerKey[0] + 20) % 10;
    answerKey[1] = (answerKey[1] + 20) % 10;
    break;
  case 1:
    answerKey[0] = ((answerKey[0] + 27) % 9) + 3;
    answerKey[1] = ((answerKey[1] + 27) % 9) + 3;
    break;
  case 2:
    answerKey[0] = (((2 * answerKey[0]) + 54) % 9) + 3;
    answerKey[1] = (((2 * answerKey[1]) + 54) % 9) + 3;
    break;
}
Decolour Flash
(9)
var rndHex = hexes.Where(h => !_goals.Any(g => g.Neighbors.Contains(h))).PickRandom();
_startPos.Add(rndHex);
hexes.Remove(rndHex);
var rndHex2 = hexes.Where(h => rndHex.Neighbors.Contains(h)).PickRandom();
_startPos.Add(rndHex2);
hexes.Remove(rndHex2);
var rndHex3 = hexes.Where(h => rndHex.Neighbors.Contains(h) && rndHex2.Neighbors.Contains(h)).PickRandom();
_startPos.Add(rndHex3);
_currentPos.AddRange(_startPos);
Ultimate Team
(11)
var scores = ScoringSystem.baseScores(Bomb.GetSerialNumber());
var ixes = new[] { "Easy", "Medium", "Hard", "VeryHard" };
for (var expIx = 0; expIx < 6; expIx++)
  foreach (var modIx in expertProficiencies[expIx])
    scores[expIx] += virtualBomb[modIx].ExpertDifficulty == "Extreme" ? 4 : Array.IndexOf(ixes, virtualBomb[modIx].ExpertDifficulty) + 1;
for (var expIx = 0; expIx < 6; expIx++)
  for (var modIx = 0; modIx < virtualBomb.Count; modIx++)
    if (virtualBomb[modIx] != null && (
      currExpertPrefDiffs[expIx] == virtualBomb[modIx].ExpertDifficulty ||
      (currExpertPrefDiffs[expIx] == "VeryHard/Extreme" && (virtualBomb[modIx].ExpertDifficulty == "VeryHard" || virtualBomb[modIx].ExpertDifficulty == "Extreme"))))
      scores[expIx]++;
scores = ScoringSystem.modifyingScores(Bomb, virtualBomb, realBomb, scores, experts.ToArray());
XO
(13)
answer = wordBank[UnityEngine.Random.Range(0, wordBank.Count)];
int snKey = alphabet.IndexOf(Bomb.GetSerialNumber()[3]) - Bomb.GetSerialNumberNumbers().Sum();
while (snKey < 0) snKey += 26;
moduleKey = alphabet.Substring(snKey, 27 - snKey) + alphabet.Substring(0, snKey);
moduleKey = moduleKey.Substring(14, 13) + moduleKey.Substring(0, 14);
boardPool.Shuffle();
for (int i = 0; i < 6; i++) {
backupBoardPool.Shuffle();
  int pointer = 0;
  int currentPosition = moduleKey.IndexOf(answer[i]) / 3, currentPiece = moduleKey.IndexOf(answer[i]) % 3;
  while (!IterateBoards(currentPosition, pieces[currentPiece], pointer)) pointer++;
}
Inselectables
(4)
for (int i = 0; i < 7;)
{
  int temp = Rnd.Range(0, 26);
  if (!chosenLetters.Contains(temp))
  {
    if (i < 3)
    {
      chosenLetters.Add(temp);
      i++;
    }
    else if (!chosenLetters.Contains(temp) && !decoyLetters.Contains(temp))
    {
      decoyLetters.Add(temp);
      i++;
    }
  }
}
Mystic Maze
(7)
string serialNo = bomb.GetSerialNumber();
List<int> mappingIndex = new List<int>();
foreach (var c in serialNo)
  mappingIndex.Add((c >= '0' && c <= '9') ? (c - '0') : (c - 'A' + 1));
for (int i = 0; MappedLetters.Count < 19; i++)
{
initialLetter += mappingIndex[i % 6];
  for (; initialLetter > 'Z';)
    initialLetter -= 26;
  while (MappedLetters.Contains((char)initialLetter))
  {
    initialLetter += 1;
    for (; initialLetter > 'Z';)
      initialLetter -= 26;
  }
  MappedLetters.Add((char)initialLetter);
}