Making the pokes
The tape's BASIC loads the game at $6000 and starts it with PRINT USR 27648, the address of START. A poke is best made before that: in the loader, or on a snapshot stopped at START, as the trials below were. The pokes that change the player's record need care after that point, because START copies every object record aside once, to WORLD_COPY, and each new game (NEW_GAME) copies the records back from there -- so each of those pokes changes both copies, and then holds whenever it is made. The hidden road's poke acts when a new game begins. The others change the code and take effect at once.
Most of the trials were staged: the player put straight into a place by writing its location, and objects given the same way (see how the game is driven in notes/hobbit/driving.md). Each was run from the same start with and without the poke, and the same commands gave the same luck both times, so any difference is the poke's.
A strong player
The player's strength is byte 5 of its record, PLAYER: 64, the same as its defence. DO_ATTACK adds a weapon's strength to it, jostles it (see the bug) and sets it against the target's defence; a blow more than 16 over the defence kills. At 255 the blow is more than 16 over any guard in the game -- the trolls' and the dragon's included, bare-handed -- except in the one blow in about 25 that the jostle turns into nothing (read from the code; tried on Thorin). Tested: ATTACK THORIN at the first prompt was wasted against his guard of 129 without the poke; with it, one blow killed him.
Eating adds 10 to strength and kills a player who would reach 128 (DO_EAT); from 255 the sum wraps round past 255 and leaves 9, below the limit. So a strong player who eats is weak again, not dead: tested, EAT FOOD after the fight above took the strength from 255 to 9.
POKE 49440,255: POKE 62469,255
Fights as they were meant
JOSTLE is meant to add -10 to +10 to a blow and to a guard, but it turns every downward jostle into zero (see the bug). Its last eight bytes, from $921C, can be rewritten so that it tests the sign first -- BIT 7,C / JR Z,+1 / CCF / JR NC,+1 / SBC A,A -- and then only a sum that really passes 255 is clamped. No blow or guard is ever zero after that, and fights come out as the rest of DO_ATTACK expects. Tested, with the vicious warg kept beside the player in the treeless opening: without the poke it killed the player with its twelfth blow, when the player's guard came out as 0; with it the player took 61 of its blows, from 46 to 65 against guards from 54 to 74, was wounded once, and was alive at the end. The warg's blow, 55 give or take ten, can never be more than 16 over the player's guard of 64 give or take ten, so the poke makes it harmless in one blow, as it was meant to be.
POKE 37404,203: POKE 37405,121: POKE 37406,40: POKE 37407,1: POKE 37408,63: POKE 37409,48: POKE 37410,1: POKE 37411,159
Never killed in a fight
The player's defence is byte 6 of its record, PLAYER. Made 255, the guard jostles up to 255 and no blow can beat it -- except that the unmended JOSTLE makes a guard of 0 about one time in 25, which any blow over 16 kills. So this poke needs the one above as well; together the player's guard is always 245 or more, and DO_ATTACK can neither kill nor wound the player. It does not help against the dragon's fire, Bard's arrows, the trolls eating, or any of the other deaths, which do not fight. Tested, with the warg kept beside the player: with the defence alone it killed the player at its twelfth blow, as without any poke, when the guard came out 0; with both, all 61 of its blows were wasted against guards of 245 to 255.
POKE 49441,255: POKE 62470,255: POKE 37404,203: POKE 37405,121: POKE 37406,40: POKE 37407,1: POKE 37408,63: POKE 37409,48: POKE 37410,1: POKE 37411,159
Never in the dark
TOO_DARK begins by letting anyone but the player see, with RET NZ at $95F1 after testing who is acting. Make it a plain RET: for the player, too, A is 0 and the carry clear -- "can see" -- so no place is ever dark, with or without the sword. Moves go where they are told, there are no falls, dark places are described, drawn and scored, and a player shut in the barrel can open it. Tested in the trolls' cave with the sword moved out of it: without the poke LOOK was refused as too dark, and three moves each fell in the dark, halving the strength to 8; with it LOOK described the cave, and the same moves were simply refused as having no way out.
POKE 38385,201
A safe forest
Arriving on the forest road or in the forest (locations 2 and 3) runs IN_THE_FOREST, which starts timer 8: the eyes that sting to death a player who leaves, or who stays four turns (see the bug). Make its first byte RET and the timer never starts. Tested from the other forest road, at 46: EAST then WEST back killed the player on arrival without the poke; with it the player went there and back, waited four turns on the forest road, went on into the forest, waited four more, and was alive throughout.
POKE 51165,201
No WAIT unless you type it
GET_KEY counts down PATIENCE, 3000 keyboard scans, while it waits for a key, and when it runs out the game types WAIT for the player and the world moves on. Make the DEC HL at $7253 a NOP and the count never goes down: the game waits at its prompt for as long as the player does. Tested at the first prompt with no key pressed: without the poke the game typed WAIT after 1171 frames, 23.4 seconds; with it nothing had happened after 4000 frames, 80 seconds, and it was still scanning the keyboard.
POKE 29267,0
The hidden road always open
Every new game, NEW_GAME_CHOICES picks one of the five roads in HIDDEN_ROADS and wipes its exit, three bytes of zeros with LD (HL),$00 at $97DB, until Elrond reads the curious map. Change it to LD A,(HL) -- the operand byte, 0, becomes a NOP -- and the loop reads the three bytes instead of wiping them. The road is still chosen, and Elrond still names it, but it is never shut. It acts at the start of the next game. Tested: the trials' game shut the long lake's way east to Lake Town. Without the poke the exit was three zeros, the long lake listed no way east, and EAST was refused; with it the exit was intact and EAST went to Lake Town.
POKE 38875,126
The missing quarter
The fourteen places in VISIT_SCORES are worth 750 tenths of a per cent between them, so no game can score more than 75% (see the bug). Make the lower halls worth 450 instead of 200, and the places add up to 1000. Tested with the player put at the front gate and walked north into the lower halls: the score went from 0 to 200 without the poke and to 450 with it, and SCORE said 45.0%.
The game still cannot say 100%: SHOW_SCORE prints only two digits before the point, so a full 1000 comes out as a colon and 0.0% (see the fact).
POKE 36246,194: POKE 36247,1
Carry anything
The player can carry 64 (byte 3 of PLAYER); CAN_LIFT refuses anything that would go over. Doors, walls and the wooden chest weigh 255, so at 255 the player can lift the chest. Tested in Bag End: TAKE CHEST was refused as too heavy without the poke; with it the player took the chest and carried it east to the lonelands and on to the trolls' clearing. The treasure can then go into the chest anywhere: the game is won wherever the two meet (CHECK_WON).
POKE 49438,255: POKE 62467,255