A weird game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Zed A. Shaw b9025be45b After trying a few SFM libraries I found they're just too much for what I need, so here's the start of a simple one I can use. 2 months ago
assets GUI mostly laid out but the code needs more refining and cleanup. Currently it creates too many assets in the render function. 3 months ago
patches First drop the game's core mechanic that compiles. 4 months ago
scripts Coroutines are mostly working but they're kind of junk anyway. Feel free to tinker with this if you like. 3 months ago
tests Big cleanup of rampant using std. 2 months ago
.gitignore A really bad quick SFML based UI to get started with the FTXUI removal, and a slight reworking of the default .tarpit.json so that it's just a sample and I can use my own config for my dev and have different sounds. 3 months ago
.tarpit_sample.json A really bad quick SFML based UI to get started with the FTXUI removal, and a slight reworking of the default .tarpit.json so that it's just a sample and I can use my own config for my dev and have different sounds. 3 months ago
.vimrc_proj Coroutines are mostly working but they're kind of junk anyway. Feel free to tinker with this if you like. 3 months ago
LICENSE First drop the game's core mechanic that compiles. 4 months ago
Makefile Reworked the builder code to setup for more async running of the build. 2 months ago
README.md Add information on configuration to the README.md 2 months ago
audiotest.cpp Sounds are working...BUT...I have to make ones I own so hang on until I do that. 3 months ago
badref.cpp Forgot file, it will go away soon though. 2 months ago
builder.cpp Now using a std::async and future to do an async popen but I also need the FILE read in read_line to be async, so now I'm at a point where I have to refactor into a better statemachine. 2 months ago
builder.hpp Reworked the builder code to setup for more async running of the build. 2 months ago
coro.hpp Big cleanup of rampant using std. 2 months ago
corotest.cpp Big cleanup of rampant using std. 2 months ago
dbc.hpp Big cleanup of rampant using std. 2 months ago
efsw.wrap Now I can play a sound! Yay! 3 months ago
escape_turings_tarpit.cpp Working config file also configures the build and git dir. 3 months ago
fsmtest.cpp After trying a few SFM libraries I found they're just too much for what I need, so here's the start of a simple one I can use. 2 months ago
ftx_thread_test.cpp Got a simple GUI layout working for the most part. 3 months ago
ftxtest.cpp Got a simple GUI layout working for the most part. 3 months ago
game_engine.cpp Coroutines are mostly working but they're kind of junk anyway. Feel free to tinker with this if you like. 3 months ago
game_engine.hpp Big cleanup of rampant using std. 2 months ago
gui.cpp First step in refactoring out the build running from the gui for later thread fiascos. 2 months ago
gui.hpp Big cleanup of rampant using std. 2 months ago
jsontest.cpp Big cleanup of rampant using std. 2 months ago
libgit2.wrap Now I can play a sound! Yay! 3 months ago
meson.build After trying a few SFM libraries I found they're just too much for what I need, so here's the start of a simple one I can use. 2 months ago
regtest.cpp The watchgit works but I don't think I really need libgit2 at all if I can just process the .gitignore correctly. 4 months ago
sfmlgui.cpp Big cleanup of rampant using std. 2 months ago
sfmlgui.hpp Big cleanup of rampant using std. 2 months ago
threadtest.cpp Now using a std::async and future to do an async popen but I also need the FILE read in read_line to be async, so now I'm at a point where I have to refactor into a better statemachine. 2 months ago
watcher.cpp Big cleanup of rampant using std. 2 months ago
watcher.hpp Big cleanup of rampant using std. 2 months ago
xmake.lua Quick attempt at an xmake.lua build. Doesn't work. 4 months ago

README.md

About Turing's Tarpit

This is a game for programmers. The eventual goal is to make a small game that makes programmer development live streams more exciting, but also makes it fun to try to keep your code bug free.

How It Works

  1. You start with 100 Hit Points (HP).
  2. Turing's Tarpit (TT) watches your git repo.
  3. If you save any files in your git then TT will run your build.
  4. It then uses a regex to detect errors, warnings, and notes from your compiler.
  5. Every error is 4 HP of damage. Warnings and Notes are 1 HP.
  6. If you successfully build with no errors then you get 10% HP back (healed).
  7. It keeps track of your rounds, and your longest streak. A streak is how many builds have run without producing an error.

Eventually this will become more complex as I add in a few more mechanics, but this is the general game loop. Some of the ideas for future mechanics:

  1. I have a real trash Brainfuck compiler. I want to have that in there somewhere.
  2. I like the way Shotgun Roulette works where you get some items per round and can use them to gain an advantage.
  3. I want streaks to be some kind of reward, either you just get some healing after a certain number, or you can "cash them in" for a special item.
  4. It needs to detect when you don't make enough changes to be worth it, but I might try to punish you if you just change a file's timestamp.
  5. Running your unit tests as well to analyze the TAP output and punish you for test failures.

Platforms

Currently this only works on Windows but there's nothing in this that will stop it from working anywhere else. It uses FTXUI to make a TUI so that means it's very portable. I just haven't spent the time to try to port it yet.

It's also only been test with GCC and C++. I'm betting the regex will be crazy wrong for any other language. BTW, where's the TAP output for compilers?

Compiling Setup

WARNING These instructions are off the top of my head right now so they're probably wrong. I need to do a clean build in a fresh VM.

To build this you'll need to install winlibs and meson but I believe my build process downloads everything else.

If you want to get setup quickly with a C/C++ build environment then you can use my installer scripts. Start a NORMAL user PowerShell to run this. If you're walking around the internet as a raw Administrator user then you might as well just inject ebola infected blood straight into your eye you idiot. No, UAC will not save you. Listen to Zed.

Now, in your NORMAL user PowerShell do this:

irm https://learncodethehardway.com/setup/base.ps1 -outfile base.ps1
powershell -executionpolicy bypass .\base.ps1

Do not go anywhere. You have to enter in passwords for your Administrator user. You do have a second user that's an administrator right? Seriously, what's your problem. Do you just like having your neighbor install a RAT tool to spy on you? Make two accounts already.

Now that you have this you can install the compiler tools:

irm https://learncodethehardway.com/setup/cpp.ps1 -outfile cpp.ps1
powershell -executionpolicy bypass .\cpp.ps1

For a bit of extra nice things, run my extras.ps1 too:

irm https://learncodethehardway.com/setup/extras.ps1 -outfile extras.ps1
powershell -executionpolicy bypass .\extras.ps1

Building

Once you have all of that you should be able to check out the code from this git:

git clone https://git.learnjsthehardway.com/learn-code-the-hard-way/turings-tarpit.git

Then change into the directory and run my setup script:

powershell -executionpolicy bypass .\scripts\reset_build.ps1

That should setup your meson build with everything you need, so now you run it:

meson compile -C builddir

One thing I ran into is that there's an error in libgit2's code. If you get a build error in utils\process.h then run this command to fix it:

cp .\patches\process.h .\subprojects\libgit2-1.8.1\src\util\process.h

The next dumb as hell thing is even though I've told meson to build a static binary it refuses. You have to copy a couple .dll files to your local directory for the easiest way to play with it:

cp .\builddir\subprojects\libgit2-1.8.1\*.dll .
cp .\builddir\subprojects\efsw\*.dll .
ls *.dll

You should then see the libefsw.dll and liblibgit2package.dll files in the local directory which will let you run the escape_turings_tarpit.exe game locally.

WARNING The reason you're copying all these files to the local directory is so you can run the game and the DLLs but also run the build on the code. Windows locks executables when they're active, so when you build builddir/escape_turings_tarpit.exe it'll fail if you're also running it. Copy it all up and then you can run builds in the game while you work on the game.

Then hang out for a while and it should build. You can then do your first run. First, run the tests:

.\builddir\runtests

If those run then try to run the game on its own code:

cp .\builddir\escape_turings_tarpit.exe . ;  .\escape_turings_tarpit.exe .\ "meson compile -C builddir"

Now it's playing, so all you have to do is open one of the .cpp files, make a mistake, save it, and watch the game play.

Configuration

There's a file .tarpit.json that configures everything for the game. You can set your own sounds, the build directory, and the build command to use. Just open it and you'll see. If you don't want to hear me laughing at you then set the sounds to nothing.mp3 and it'll be silent.

I have an example file tarpit_example.json which you can copy to .tarpit.json to get started:

cp tarpit_example.json .tarpit.json

You can edit this file to change the build command and sounds used during building, just in case my silky smooth radio quality voice is not to your liking.