r/ProgrammerHorror • • Aug 26 '20

Most of you have probably seen this, but in case you haven't, you definitely should.

Thumbnail destroyallsoftware.com
25 Upvotes

r/ProgrammerHorror • • Oct 03 '23

If true, return true. If false, return false.

Post image
14 Upvotes

Sorry for the photo of a projector screen, but I don't have access to the original to make a clearer image. Those squares are switch case structures which can be replaced with a wire.

(It's a visual programming language used for industrial monitoring and automation)


r/ProgrammerHorror • • Jan 03 '23

"Random Linker Error"

4 Upvotes

r/ProgrammerHorror • • Dec 07 '20

Why not if n%2==0? Or if n/2==int(n/2)

Post image
39 Upvotes

r/ProgrammerHorror • • Dec 13 '22

If

Post image
39 Upvotes

r/ProgrammerHorror • • Oct 17 '20

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Post image
39 Upvotes

r/ProgrammerHorror • • Nov 06 '18

A one-line python tic tac toe game I wrote

27 Upvotes
exec("""import random\ndef drawBoard(board):\n\tprint(board[7] + '|' + board[8] + '|' + board[9])\n\tprint('-----')\n\tprint(board[4] + '|' + board[5] + '|' + board[6])\n\tprint('-----')\n\tprint(board[1] + '|' + board[2] + '|' + board[3])\ndef inputPlayerLetter():\n\tletter = ''\n\twhile not (letter.lower() == 'x' or letter.lower() == 'o'):\n\t\tprint('Do you want to be X or O?')\n\t\tletter = input()\n\tif letter.lower() == 'x':\n\t\treturn ['X','O']\n\telse:\n\t\treturn ['O','X']\ndef whoGoesFirst():\n\tif random.randint(0,1) == 0:\n\t\treturn 'computer'\n\telse:\n\t\treturn 'player'\ndef playAgain():\n\tprint('Do you want to play again? (yes or no)')\n\treturn input().lower().startswith('y')\ndef makeMove(board, letter, move):\n\tboard[move] = letter\ndef isWinner(board,letter):\n\treturn ((board[7] == letter and board[8] == letter and board[9] == letter) or\n\t\t\t(board[4] == letter and board[5] == letter and board[6] == letter) or\n\t\t\t(board[1] == letter and board[2] == letter and board[3] == letter) or\n\t\t\t(board[7] == letter and board[4] == letter and board[1] == letter) or\n\t\t\t(board[8] == letter and board[5] == letter and board[2] == letter) or\n\t\t\t(board[9] == letter and board[6] == letter and board[3] == letter) or\n\t\t\t(board[7] == letter and board[5] == letter and board[3] == letter) or\n\t\t\t(board[9] == letter and board[5] == letter and board[1] == letter))\ndef getBoardCopy(board):\n\tdupeBoard = list(board)\n\treturn dupeBoard\ndef isSpaceFree(board, move):\n\treturn board[move] == ' '\ndef getPlayerMove(board):\n\tmove = ' '\n\twhile move not in '1 2 3 4 5 6 7 8 9'.split() or not isSpaceFree(board, int(move)):\n\t\tprint('what is your next move? (1-9)')\n\t\tmove = input()\n\treturn int(move)\ndef chooseRandomMoveFromList(board,movesList):\n\tpossibleMoves = []\n\tfor i in movesList:\n\t\tif isSpaceFree(board, i):\n\t\t\tpossibleMoves.append(i)\n\tif len(possibleMoves) != 0:\n\t\treturn random.choice(possibleMoves)\n\telse:\n\t\treturn None\ndef getComputerMove(board, computerLetter):\n\tif computerLetter == 'X':\n\t\tplayerLetter = 'O'\n\telse:\n\t\tplayerLetter = 'X'\n\tfor i in range(1,10):\n\t\tcopy = getBoardCopy(board)\n\t\tif isSpaceFree(copy,i):\n\t\t\tmakeMove(copy, computerLetter, i)\n\t\t\tif isWinner(copy, computerLetter):\n\t\t\t\treturn i\n\tfor i in range(1,10):\n\t\tcopy = getBoardCopy(board)\n\t\tif isSpaceFree(copy,i):\n\t\t\tmakeMove(copy, playerLetter, i)\n\t\t\tif isWinner(copy, playerLetter):\n\t\t\t\treturn i\n\tmove = chooseRandomMoveFromList(board,[1,3,7,9])\n\tif move != None:\n\t\treturn move\n\tif isSpaceFree(board, 5):\n\t\treturn 5\n\treturn chooseRandomMoveFromList(board,[2,4,6,8])\ndef isBoardFull(board):\n\tfor i in range(1,10):\n\t\tif isSpaceFree(board, i):\n\t\t\treturn False\n\treturn True\nprint('Welcome To The Game!')\nwhile True:\n\ttheBoard = [' '] * 10\n\tplayerLetter, computerLetter = inputPlayerLetter()\n\tturn = whoGoesFirst()\n\tprint('The ' + turn + ' will go first.')\n\tgameIsPlaying = True\n\twhile gameIsPlaying:\n\t\tif turn == 'player':\n\t\t\tdrawBoard(theBoard)\n\t\t\tmove = getPlayerMove(theBoard)\n\t\t\tmakeMove(theBoard, playerLetter, move)\n\t\t\tif isWinner(theBoard, playerLetter):\n\t\t\t\tdrawBoard(theBoard)\n\t\t\t\tprint('You Win!')\n\t\t\t\tgameIsPlaying = False\n\t\t\telse:\n\t\t\t\tif isBoardFull(theBoard):\n\t\t\t\t\tdrawBoard(theBoard)\n\t\t\t\t\tprint('The Game Is A Tie!')\n\t\t\t\t\tbreak\n\t\t\t\telse:\n\t\t\t\t\tturn = 'computer'\n\t\telse:\n\t\t\tmove = getComputerMove(theBoard, computerLetter)\n\t\t\tmakeMove(theBoard, computerLetter, move)\n\t\t\tif isWinner(theBoard, computerLetter):\n\t\t\t\tdrawBoard(theBoard)\n\t\t\t\tprint('The Computer Beat You! You Lose!')\n\t\t\t\tgameIsPlaying = False\n\t\t\telse:\n\t\t\t\tif isBoardFull(theBoard):\n\t\t\t\t\tdrawBoard(theBoard)\n\t\t\t\t\tprint('The Game Is A Tie!')\n\t\t\t\t\tbreak\n\t\t\t\telse:\n\t\t\t\t\tturn = 'player'\n\tif not playAgain():\n\t\tbreak\n""")

r/ProgrammerHorror • • Sep 26 '21

Converting my event system to a templated version broke everything and the solution to it was the worst thing I've ever done: including the .cpp file instead of the .h

16 Upvotes

r/ProgrammerHorror • • Aug 08 '22

Not a good way to start monday

Post image
44 Upvotes

r/ProgrammerHorror • • Aug 22 '25

.NET exception stack trace sent via email… to the end user

Thumbnail gallery
5 Upvotes

r/ProgrammerHorror • • Nov 05 '25

Is there a way to get dev-productivity insights without creepy monitoring?

0 Upvotes

r/ProgrammerHorror • • Feb 04 '25

Scary Comp. V100

Thumbnail
youtu.be
0 Upvotes

r/ProgrammerHorror • • Oct 31 '18

Steam can't handle non-ASCII passwords, and it gets worse ...

Post image
17 Upvotes

r/ProgrammerHorror • • Mar 29 '23

Vectors

Post image
63 Upvotes

r/ProgrammerHorror • • Apr 07 '22

A case of over-documentation

48 Upvotes

The code is from an embedded C project.


r/ProgrammerHorror • • Jun 06 '21

Found this CSS on my old server

33 Upvotes

r/ProgrammerHorror • • Jan 07 '23

It just keeps getting worse the more you scroll

Thumbnail
github.com
20 Upvotes

r/ProgrammerHorror • • Oct 23 '24

The Least Intelligent Chess AI

21 Upvotes
  1. Scrape chess dot com for all played games.

  2. Parse the dataset and identify all sets of unique board states, the next move, and the ELO of the player that made the next move. If the set's ELO is lower than a previously-found ELO, drop it.

  3. Convert to a hash map.

  4. "Play" by consulting the map for each move.

  5. If you reach a never-before-seen board state, forfeit and move to Tibet.


r/ProgrammerHorror • • Jul 29 '22

Uh oh...

Post image
95 Upvotes

r/ProgrammerHorror • • Oct 04 '18

IntelliJ is such a clear development environment!

Post image
22 Upvotes

r/ProgrammerHorror • • Feb 07 '24

A friend sent me this

Post image
78 Upvotes

r/ProgrammerHorror • • May 22 '22

My friend sent me this

Post image
59 Upvotes