Scratchy “Cloak of Darkness” on Scratch

“Scratchy Cloak of Darkness” is based on the “Cloak of Darkness” specification — a very simple pattern, designed to help programmers compare the strengths and weaknesses of various coding environments.

“Cloak of Darkness” is not going to win prizes for its prose, imagination or subtlety. Or scope: it can be played to a successful conclusion in five or six moves, so it’s not going to keep you guessing for long. (On the other hand, it may qualify as the most widely-available game in the history of the genre.) There are just three rooms and three objects.

  • The Foyer of the Opera House is where the game begins. This empty room has doors to the south and west, also an unusable exit to the north. There is nobody else around.
  • The Bar lies south of the Foyer, and is initially unlit. Trying to do anything other than return northwards results in a warning message about disturbing things in the dark.
  • On the wall of the Cloakroom, to the west of the Foyer, is fixed a small brass hook.
  • Taking an inventory of possessions reveals that the player is wearing a black velvet cloak which, upon examination, is found to be light-absorbent. The player can drop the cloak on the floor of the Cloakroom or, better, put it on the hook.
  • Returning to the Bar without the cloak reveals that the room is now lit. A message is scratched in the sawdust on the floor.
  • The message reads either “You have won” or “You have lost”, depending on how much it was disturbed by the player while the room was dark.
  • The act of reading the message ends the game.

And that’s all there is to it…

Below is my Scratch implementation. On the Scratch site, you can see all the code (along with my annotation).

Scratchy “Cloak of Darkness” on Scratch.

There is already a canonical Inform 7 version of Cloak of Darkness (it’s part of the documentation), but I’ll post more on that soon. (Coming — Linky, Blendy, and Texty “Cloak of Darkness.”)