Skip to main content

Questions tagged [stateful]

Challenges involving behaviour that depends on previous invocations of the solution.

Filter by
Sorted by
Tagged with
19 votes
13 answers
2k views

Schrödinger's cat program [closed]

Sandbox Your challenge is to write a program that when first run, will do one of the actions below at random with equal chances of both: A cat program A standard cat program: read everything from <...
CreaZyp154's user avatar
14 votes
6 answers
1k views

Save my secrets!

I have so many secrets and nowhere to keep them! The goal is simple: write a program that lets you save a string and have it be protected by a password. The program will take an alias, password and (...
Quinn's user avatar
  • 1,353
14 votes
11 answers
4k views

A greeting bot for a colleague from work

I have a colleague at work that works from home every Tuesday and Thursday. At around 8:00 AM he sends us a message with the following text: Hello today I'm working from home In order to relieve ...
Charlie's user avatar
  • 12.9k
49 votes
41 answers
14k views

Shortest code in your language to persist a string across a reboot

Your Programs: You'll write two programs (both in the same language). The storage program takes a string from STDIN and stores it somewhere persistent (see below) and then exits without error. The ...
Jared K's user avatar
  • 893
12 votes
4 answers
414 views

How many instances are running?

Write an indefinitely-running program that reports how many instances of itself are currently running. Each instance of the program should also report the order in which it was opened out of all other ...
darrylyeo's user avatar
  • 7,907
12 votes
4 answers
663 views

Entropic Quine!

Your task is to write a program or function which: When run for the first time, outputs its source code. On subsequent executions, it should output what it output previously, but with one random ...
Esolanging Fruit's user avatar
14 votes
15 answers
2k views

Permanently self-modifying code

Now, we all know most languages have very simple ways to "self-modify" code. However, what if you were to actually modify the code and edit parts of it...on disk? Your goal is to make code that ...
Twilight Sparkle's user avatar
23 votes
9 answers
743 views

Incremental Quine

​Your task is to write a program or function that outputs the first character of its source code, then the second, then the third... each time it is run. For example, if your program was ...
Conor O'Brien's user avatar
47 votes
30 answers
5k views

3... 2... 1... Crash off!

Your task is to write a full program that will continue to count down from 10 every time it is run. The first time you run the program, it should print 10. The ...
Esolanging Fruit's user avatar
12 votes
5 answers
1k views

Monkey Island: The Head of the Navigator

Warning: This challenge contains some mild spoilers for The Secret of Monkey Island. Towards the end of the game, you're being led through the catacombs by a magically preserved head of a navigator: ...
Martin Ender's user avatar
251 votes
82 answers
83k views

Code that will only execute once

Goal The goal of this challenge is to write code that will execute once and only once. This means basically that it damages the program, script, or environment in some way. If rebooting the system ...
ojblass's user avatar
  • 2,837
10 votes
3 answers
802 views

Use NVM to tenaciously resume operation whenever aborted

Summary The aim of this challenge is to write a tenacious program. This is a stateful program designed to output a given string, but for which, if the program is aborted at any point during the ...
fgrieu's user avatar
  • 615
4 votes
6 answers
708 views

Write a program to perform set operations.

Your task is to write a program to perform set operations. The operations and arguments are taken from command line in the format program operation [argument]. ...
Alexandru's user avatar
  • 6,134