Loop Invader by Ale

Skip around through the video below to see different strategies for playing the game:
https://www.youtube.com/watch?v=LgOGZiY_fXY
There are invaders hiding among your data! Use your observation skills and code blocks to track them down and hit 'em with your ZAPPER!
PERFORMANCE ISSUES: if you are experiencing lag, please download the native version for your operating system. The HTML5 version seems to struggle a bit.
How to play (TL;DR version)
Each level has a bunch of balls in a grid. One or more of those balls are an "invader". You need to figure out which balls are invaders, and then zap them with your zapper! (spacebar)
This is how/why the ball's numbers change:
- When a ball touches an invader, its number goes up after a 1 second delay
- When that ball touches another non-invader ball, its number goes down immediately.
- A ball’s number will never fall below its original value, and will never go above 9
- an invader's number will never change
Hints:
When an invader touches a regular ball, that ball's number will go up exactly 1 second later, but the invader's number will never change.
Trying to spot the invaders with your eyes alone is not going to be easy because there is usually too much going on.
Create while blocks to trap balls, and create if blocks to create barriers. This enables you to control the movement of the balls, and makes it easier to spot the invader(s)
An easy trick to narrow the search for the invader is to collect each number into a separate while block (easier said than done!). If you manage to do this, you'll know what the invader's number is by looking at the while block that is leaking data.
Since an invader's number can never change, it will always be stuck in a while loop ;)
Code block syntax
The game is pretty lenient when it comes to whitespaces, so add as many as you want. However, you must use parentheses, and you can't have a whitespace between <= or >=. Here are some examples of valid code blocks:
if(1): a barrier that blocks balls with the value 1while( <= 2): a while loop that collects balls with a value less than or equal to 2while (>2): a while loop that collects balls with a value greater than (but not equal to) 2if(!0): a barrier that blocks everything, since the lowest possible value is 1while (!3): a while loop that collects balls with a value that is NOT 3
Known bugs
- If you place two code blocks right next to each other (so they're touching), the balls inside might leak out erroneously. For example, an
if(1)block touching awhile(2)block could result in the2balls in thewhileloop to leak out when they touch theifblock. To be safe, make sure there is at least one empty space around all code block!
Proof that it's winnable:

it's actually pretty easy once you get the hang of it
Ratings
| Overall | 311th | 3.427⭐ | 77🧑⚖️ |
| Fun | 330th | 3.233⭐ | 77🧑⚖️ |
| Innovation | 43th | 4.058⭐ | 79🧑⚖️ |
| Theme | 322th | 3.552⭐ | 79🧑⚖️ |
| Graphics | 533th | 2.717⭐ | 78🧑⚖️ |
| Audio | 389th | 2.791⭐ | 76🧑⚖️ |
| Humor | 422th | 2.054⭐ | 67🧑⚖️ |
| Mood | 467th | 2.796⭐ | 73🧑⚖️ |
| Given | 111🗳️ | 152🗨️ |
- the web version locked up when I completed the first level.
- made for a very nice puzzle game after figuring out the gameplay loop and the goal state of the game.
I like the options that you have for sorting out and detecting the bad data. The only real problem was the repetitiveness of the whole experience. The music loop is a little too short and once you come up with a good solution you just apply it over and over again to every level.
I really like the concept and the idea of writing equations to physically sort data is super cool! It would be great to use this same concept in another game also!
My favorite trick is once I've figured out what number the imposters are, let's say "3", then I do a "while(3)" on one side with a "while (!0)" next to it. When the good guys get knocked out of while(3), then they get scooped up by the while (!0). Very quickly it becomes very easy to see who the bad guy is. Finished level 10!
(EDIT) I forgot to mention, but the glitch of the barriers not funtioning properly when touching each other is frustrating, it would be easier if you could realy seal areas of fully without some of the balls slipping out, but even this bug is fairly minor and could even be considered something that adds to the challenge.
My challenge with the game is the keyboard layout, I'm not using a US layout (or keyboard for that matter)
Maybe you could add an option to enable some buttons after you create or edit a code block?
Like:
- if(
- while(
- 1
- 2
- 3
- <=
- \>=
- )
so basically a small on-screen keyboard that let's you input all possible combinations?
Update: Managed to get through a few levels and kind of got the hang of it, but it starts feeling a bit tedious to me... I wanted to like it, but maybe my brain just doesn't quite gel with this game. I am also left wishing I had more powerful tools to separate the balls... like a wall that only lets things through one way depending on the requirements.
I do feel like being a bit of a curmudgeon: are there any loops in this game? The "while" blocks don't really behave anything like loops in this game.
* When a ball touches an invader, its number goes up after a 1 second delay
* When that ball touches another ball, its number goes down immediately.
* A ball's number will never fall below its original value, and will never go above 9
I wanted to add some more tools besides just `if` and `while` blocks, but I didn't want to overwhelm the player with too many options, and I didn't want to risk making the game too easy with overpowered tools. I figured that most players would simply struggle with learning the rules of game (which so far seems to be the case based on all the feedback I've seen!). If I continue to work on the game, I'd want to try experimenting with other gameplay elements, like obstacles, balls with different behaviors, etc. before adding more tools.
BTW, in the youtube video I posted above, at around 3:20 you can see how I made a pseudo one-way block using a while and an if. The invader in the while(3) block changes the 3s to 4s, so they pass through the if(3). If they hit another ball on the other side, they go back down to 3, and can no longer pass over the if(3) block.
and RE: loops...you kinda have to use your imagination :laughing:. You could imagine the while blocks as being the main loop of a simulation (visualized by the balls inside bouncing around)... Plus, the invaders will always be **stuck in a** while **loop** since their numbers can never change!
Still this is a really innovative concept, I really liked trapping them slowly and figuring out who is the invader. Really interesting design.
Unfortunately, like other people have commented, I had a bit of trouble playing the game because it assumes an american (or at least western) keyboard layout. My parenthesis keys aren't on '9' and '0' so I kept accidentally inputting the wrong symbols... :sweat_smile:
The colour-coding of the blocks is clever, but `<2` and `>2` mean completely different things but are both highlighted in the same colour. On the other hand, I can't immediately think of a better way of colouring the blocks...
The gameplay is unique enough that it would really benefit from an interactive tutorial, or at least a bit of hand-holding in the first couple of levels. It would have also been nice to see more variety in the levels. Maybe some with pre-existing walls, or balls of varying sizes, that sort of thing. As it stands, the later levels are like the early levels, just with more balls; they don't expand upon the core idea any further.
Fortunately these are minor issues that don't interfere with enjoyment of the game, especially once you get the hang of the idea. I also quite like the music. It works well as soothing, "thinking" music.
Good job.
A bug, or maybe something I missed was I didn't know how to get back to the levels menu after I win or lose. I had to refresh the page.
Also, I wonder what more mechanics and depth you could add onto this. The idea of having a bad cell, is cool, and it is interesting trying to find it. Like maybe different values behave differently. Maybe some impostors do a specific kind of change of number - like maybe some reduce the value of others? I'm really curious where you can take this. Thank you for the game :)
I've always enjoyed sniper deduction games. I actually have quite a bit of hours into https://store.steampowered.com/app/303590/Hidden_in_Plain_Sight/
I've always wanted a single player version of that, but I couldn't figure out a way for the AI to be interesting. You bypassed that altogether by having the invader have unique properties vs a unique deduction system. You managed to create a rare, single player sniper deduction game which I didn't think was possible.
The game is super fun with lots of emergent gameplay. I had fun tinkering with code blocks, though admittedly I played it safe lots of times with simple leakers and letting it run. I didn't mind that because I found it fun and challenging to try to spot the invaders manually to some degree. I did peek at the video you provided which I'm grateful for. You showed a lot of concepts I wouldn't have thought of otherwise.
One of the few LD47 games I plan to try more in the future. I'll be browsing your older games in hopes it's just a much a gem as this one :)
Also thanks for putting so much effort into the tutorial and the video!
LDpage > TL;DR > Play > Easy zap first level > Impossible level 2 > Check Youtube video > Realizing you can impact the playing field > Struggle with non-english keyboard
So it is like the best LDgame Ive tried but the onboarding was really rough (for me).
Feels like "if(<4)" is the most useful block around and just helps to eventually jail every invader cell, provided you bisect the space well.
Graphics is simple but informative - and you don't need much more than that in such a game. Music is perfect, even though the loop is short, it does not interfere but creates a great background.
If I had one complaint, it would be that I wish I could shrink/grow already created boxes.
Done and done :smile:

I kept using if(!9) blocks to isolate sections, that worked so well I barely used anything else.
Moreover, the music is really nice, and relaxing! :)
Overall, gg for your work!
I'll start by saying that, after I've understood it, it's a nice concept. Being a compo game I can understand it's not so polished, and it works enough to be playable and show off what your concept is.
My biggest complaint is about learning how to play.
To be honest I've made a huge mistake, I thought that I could learn how to play just by playing, something I always try to do, so I skipped the tutorial in game (though I read a bit the description of this page).
This game totally can't be learned by playing it, it's not so dramatic, but you really need to make the tutorial mandatory.
What I was not getting (before looking at the tutorial in game) is:
1. You can drag with the mouse to create a big block: at first I made the if block and while with only one little block and I was like "no way", after I discovered I could create a larger block it all made a lot more sense
2. the hp goes down and the red icon goes down too if you hit something (hp for errors, red icon for successes), here the problem is a lack of sign & feedback, because it's not very visible that hp are going down and you have to explicitly look at them, but that happens only after you know you have to look at them to see the result of your action. A simple yet ugly text in the center of the screen that says (error/success) would have helped
The other issue I had was with writing while/if block. In the html version my keyboard was not working so I was confused. I then decided to download the window version and it went """fine""". I say fine that way because the keys were not the one on my keyboard, and parenthesis or > symbol were somewhere else (heck I've not even managed to find the = symbol), so I struggled every time I had to type something. I don't know how u parsed the keyboard input but maybe there should be a universal way that does not rely on the kind of keyboard you have (I've an italian one). Also, creating a block, cancel your action, deleting them, etc..., is not very intuitive and a bit clunky.
I didn't want to quit the game, I really try to give almost every entry a huge chance before dropping, and that's what made me going forward. I also was a bit curious because it was clear I was missing something. Reading the tutorial in game surely helps, even though I don't know how much for a "fresh" player since I really played it a bit before reading it and was easier to understand to me (at some point I just forgot it was there otherwise I would have looked at it sooner).
After all of this I finally knew how to play and the game worked well enough (I'm not sure but maybe sometimes they managed to exit the while loop if there were too many balls in it).
After completing the first levels, I just found a strategy that seemed the only one needed, nothing complex just a while(x) block, a huge vertical if(x) block and another while(!x) block. This led me to find the impostor just by waiting, so I went straight to the level 10 and won it.
This sadly show off another issue: the levels themselves are not very different to play, and the difficulty after the first 2-3 levels, if you've understood the game mechanics, is just about how patient you are, not about using a lot of blocks in a weird way (as said, I went straight to level 10 because the in between levels seemed a bit pointless to play).
Being a compo game, the real big issues for me is just about teaching the mechanics, the "difficulty" thing is not a real issue since in 48hours and being alone is not easy to create a compelling progression, I pointed it out just to let you know what I thought about it.
Don't take my words too harshly, I just like to give a detailed view of what my thoughts are, hoping they can help you to improve the game, but only if you think it should be improved in the first place.
My strategy was to create if statement that blocks all balls ( if(>0) ) and try to spot ball that is not incrementing.
Music is great and fits perfectly. Definitelly gave me puzzle game vibe.
Cheers!
I can see this as a tabletop game as well.
So, by level 3 or 4 I basically used the same solution for all the puzzles.
I would start with a while(< 4) block on the left and a if(> 3) wall next to it. All the balls would get stuck inside unless they were higher than 4, which I then captured in a while(< 7) block on the other side. Eventually there would be only a few 3s left and I could determine if it was an invader, and I could decrease the left code blocks by 1 (while(< 3), if(> 2)), and wait again for 3s to filter out.
Could see starting the game with more restrictions as a tutorial, since typing code can be tough for some.
Nice job!