Questions tagged [stateful]

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

Filter by
Sorted by
Tagged with
14
votes
6answers
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 (...
14
votes
12answers
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 ...
48
votes
40answers
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 ...
13
votes
4answers
307 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 ...
12
votes
4answers
599 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 ...
14
votes
13answers
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 ...
23
votes
9answers
674 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 ...
47
votes
30answers
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 ...
11
votes
5answers
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: ...
223
votes
75answers
75k 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 ...
4
votes
6answers
686 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]. ...