←back to thread

296 points reverseCh | 1 comments | | HN request time: 0s | source

I recently came across the concept of "useless" programs - pieces of code that serve no practical purpose but are fun, creative, or challenging to write. These could be anything from elaborate ASCII art generators to programs that solve imaginary problems. I'm curious to hear about the most interesting or creative "useless" programs the HN community has written. What was your motivation? What unexpected challenges did you face? Did you learn anything valuable from the experience? Some examples to get the ball rolling: 1. A program that prints the lyrics of "99 Bottles of Beer" in binary. A text-based game where you play as a semicolon trying to find its way to the end of a line of code. A script that translates English text into Shakespearean insults. Share your creations, no matter how quirky or impractical. Let's celebrate the joy of coding for coding's sake!
Show context
tholman ◴[] No.41920017[source]
I love a good useless program, I may have written more useless ones than useful. Here's a few of my faves from the last 10 years!

- A password strength page that insults you based on strength https://trypap.com/

- Minesweeper with 1 square https://onesquareminesweeper.com/

- Adding elevator music to "go to top" buttons https://tholman.com/elevator.js/

- CSS Animation library of obnoxious over the top animations https://tholman.com/obnoxious/

- A fake mosquito with the web audio api https://tholman.com/mosquito-js/

replies(7): >>41920050 #>>41920056 #>>41920147 #>>41921402 #>>41921787 #>>41922463 #>>41923456 #
Loughla ◴[] No.41920056[source]
I will admit that I clicked the one square in the mine sweeper.

Not sure what I expected.

replies(2): >>41920745 #>>41922467 #
gazook89 ◴[] No.41920745[source]
Seems to me it would already be solved by Minesweepers rules, the clock should be stopped.
replies(1): >>41923204 #
symmetricsaurus ◴[] No.41923204[source]
Also first click is never a mine (if there's one where you click it's moved to the top left corner).
replies(2): >>41923781 #>>41924042 #
dotancohen ◴[] No.41924042{3}[source]
Does this mean that the top left corner had a higher probability of being a mine? Or even a lower probability, seeing as the dev would have had to ensure that it's not a mine before the user clicks.

Now that I think about it, the dev strategy of leaving the spot without a mine but moving one there, probably does not affect the probability that there will be a mine there during gameplay.

replies(1): >>41926274 #
ohwellhere ◴[] No.41926274{4}[source]
I don't think the dev would leave the top left without a mine until one is moved there, as that would always be a safe square to click first.

So if the probability of finding a mine at any given spot is given by p, then the probability of finding a mine in the top left during gameplay for cases where one does not click it first (in which case it is 0?) is 1 for the case where you clicked on a mine first with probability p, and then p for the remainder.

So the total probability p' is p * 1 + (1 - p) * p, or 2p - p^2.

Wikipedia says

> Beginner is usually on an 8x8 or 9x9 board containing 10 mines, Intermediate is usually on a 16x16 board with 40 mines and expert is usually on a 30x16 board with 99 mines; however, there is usually an option to customise board size and mine count.

  8x8   10 mines  p = 0.16 p' = 0.29 ratio = 1.84
  9x9   10 mines  p = 0.12 p' = 0.23 ratio = 1.88
  16x16 40 mines  p = 0.16 p' = 0.29 ratio = 1.84
  30x16 99 mines  p = 0.21 p' = 0.37 ratio = 1.79
I was curious to see the concrete effects for no reason other than to procrastinate.
replies(1): >>41926295 #
1. dotancohen ◴[] No.41926295{5}[source]

  > I don't think the dev would leave the top left without a mine until one is moved there, as that would always be a safe square to click first.
All squares are safe to click first, that's the point.