Jump to content

Execute HQ9+: Difference between revisions

added Inform 7 solution
No edit summary
(added Inform 7 solution)
Line 129:
 
See [[RCHQ9+/Haskell]].
 
=={{header|Inform 7}}==
 
<lang inform7>HQ9+ is a room.
 
After reading a command:
interpret the player's command;
reject the player's command.
 
To interpret (code - indexed text):
let accumulator be 0;
repeat with N running from 1 to the number of characters in code:
let C be character number N in code in upper case;
if C is "H":
say "Hello, world!";
otherwise if C is "Q":
say "[code][line break]";
otherwise if C is "9":
repeat with iteration running from 1 to 99:
let N be 100 - iteration;
say "[N] bottle[s] of beer on the wall[line break]";
say "[N] bottle[s] of beer[line break]";
say "Take one down, pass it around[line break]";
say "[N - 1] bottle[s] of beer on the wall[paragraph break]";
otherwise if C is "+":
increase accumulator by 1.</lang>
 
=={{header|J}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.