It's time to break out our IntCode interpreter and do something useful for once: play breakout.
Day 13 - The Problem
Man, flying through the void is really boring. Good thing those elves are looking out for us and sent us some in-flight entertainment. It seems to be a rudimentary breakout clone. Bounce the ball off your paddle to break all the bricks.
In order to check the status of the code, Part 1 asks us to verify that we see the proper number of blocks on the screen when the game starts.
Part 2 is to actually play the game and report our high score!
Ongoing Meta
Dev.to List of Leaderboards
-
120635-5c140b9a
- provided by Linda Thompson
If you were part of Ryan Palo's leaderboard last year, you're still a member of that!
If you want me to add your leaderboard code to this page, reply to one of these posts and/or send me a DM containing your code and any theming or notes you’d like me to add. (You can find your private leaderboard code on your "Private Leaderboard" page.)
I'll edit in any leaderboards that people want to post, along with any description for the kinds of people you want to have on it. (My leaderboard is being used as my office's leaderboard.) And if I get something wrong, please call me out or message me and I’ll fix it ASAP.
There's no limit to the number of leaderboards you can join, so there's no problem belonging to a "Beginner" and a language specific one if you want.
Neat Statistics
I'm planning on adding some statistics, but other than "what languages did we see yesterday" does anyone have any ideas?
Languages Seen On Day 12
Under construction
Top comments (5)
Surprisingly simple! No modifications needed to the IntCode after the Robot problem, so just plug in the interpreter and tell it how to play the game!
Kotlin solution:
This was much easier indeed!
Part One
The only thing I've given for granted is that the machine, on the first part, never overwrites a tile, but I was ready to track that down eventually. I'm reporting just the relevant parts in JavaScript:
Part Two
I don't know if you noticed the hidden message in the text: "You do have crew quarters, but they won't fit in the machine." 😂
Anyway, after the initial confusion about "how to play this game?!", I realized this is just Arkanoid/Breakout! 😄 I just have to move the paddle left and right to reach the ball.
The only change I did to the main routing was to set a fixed input value instead of a stack of values (
joystickPosition
).Get my input at my repo.
Pretty straightforward today, which was nice after yesterday's tricky part 2 that I haven't solved yet (I didn't have as much time as usual). I adapted the idea from the painting robot to screen drawing, and used a very simple input logic for part 2 to make the paddle track the ball's x coordinate.
Job done!
Clojure solution:
As always, full code: github.com/jkoenig134/AdventOfCode...
No change in OpCode computer and it runs smoothly now.
Swift solution here
Opcode can be found here in GitHub -> github.com/rizwankce/AdventOfCode/...