Projects

Advent of Code 2020

Advent of Code?

Simply put, Advent of Code is a set of 25 puzzles that release for the 25 days of Christmas in December every year. Puzzles increase in difficulty slowly as the month progresses, with Day 25 usually being the most difficult problem. Every day, the puzzle is split into two parts, where the second part always builds on top of the program you made for the first part.
AoC Main Page
Every year there is a story that progresses as each day passes, usually something to do with saving Christmas!

You can do the puzzles in whichever language you please, so in 2019 I got up to Day 13 with C#, and in 2020 I used Python. A friend of mine did each day in a different language in AoC 2020!

Every player can make a private leaderboard, or join some if they have the codes. In 2020, I was in 7 leaderboards. Points are worked out based on your rank of finishing the puzzle, where the first person gets N points (where N is the number of users on leaderboard), second gets N-1 points etc until the final gets 1. This encourages competitiveness although unfortunately it unlocks at 5am UTC (midnight where the creator lives). The good side is that by Day 10, the puzzles reach a difficulty where many people cannot finish them and so it comes about skill rather than speed (although in 2020 all the puzzles were quite easy until Day 15).
AoC2020 Stats Page

AoC 2019

The Advent of Code 2019 event was based around saving Christmas in the Solar System. The first day story context setting reads:

"Santa has become stranded at the edge of the Solar System while delivering presents to other planets! To accurately calculate his position in space, safely align his warp drive, and return to Earth in time to save Christmas, he needs you to bring him measurements from fifty stars. Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck! The Elves quickly load you into a spacecraft and prepare to launch."
This sets the scene of the event quite nicely, as the story is of course very important throughout the event.

The 2019 puzzles were quite a lot more difficult than previous years, and also than 2020. Just compare these stats from both years, how few people have completed the later puzzles (even if number of solvers was taken into account, this is still a lot lower).
AoC2019 Stats Page
This event happened when I was at school, in Year 13. I completed challenges up to Day 13, although skipped Day 9, 11 and 12. I did the challenges using C#. I struggled with these puzzles somewhat because I was not really a very experienced programmer, and starting on Day 2, there was a program that subsequent odd numbered day puzzles built upon. This was called the Intcode Computer, essentially an assembly program built based on sets of rules given each puzzle. I managed to the first challenges on this using hack fixes, but eventually the rules became too complicated for me and I gave up. Maybe I will go back to them at some point.

AoC 2020

Advent of Code 2020 was a bit different, story-wise, than the other events, because it was all about getting Santa to his vacation island for a nice break from constantly saving Christmas! Although he does do some super criminal things along the way... *cough* hacking airport security, stealing passports, getting on plane without bording pass *cough*. Here's the first day story context setting:

After saving Christmas five years in a row, you've decided to take a vacation at a nice resort on a tropical island. Surely, Christmas will go on without you. The tropical island has its own currency and is entirely cash-only. The gold coins used there have a little picture of a starfish; the locals just call them stars. None of the currency exchanges seem to have heard of them, but somehow, you'll need to find fifty of these coins by the time you arrive so you can pay the deposit on your room. To save your vacation, you need to get all fifty stars by December 25th. Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
Many funny moments were had in this story!

This time around, I completed puzzles in Python, a language that is much easier to code these quick and short scripts in, than any typed languages. This is where the Pythonic nature really shines. You can find my Github repository for this event here. I found these puzzles a lot easier than last year, and stayed awake/woke up for 5am every day to compete with my American (and some British!) friends on my leaderboards. This has allowed me to gain some really good global ranks on most days:
AoC Personal Stats Page
The puzzles were definitley much easier than in 2019, only being actually difficult for about 5 different puzzles. On top of this, Day 25 (usually the most difficult problem of the event) was incredibly anticlimatic because it took me about 20 minutes to complete and ended up being a very short 4 liner solution.

GMTK2020 - Backfire

GMTK?

Game Maker's Toolkit (GMTK) is a video game analysis series which examins and explains aspects of video game design to encourage developers to improve their crafts and viewers to appreciate the games they play more. You can find their YouTube channel here. Every year, GMTK host a big game jam on itch.io, with an increasing number of thousands of participants and submissions (5,369 entires and 143k ratings in 2020).

This year, the theme was "Out of Control". The theme could be interpreted in any way. Teams had 48 hours to create a game that could run on Windows or in browser, via any method. The majority of code had to be written during the jam but art and assets can be used within legal rights and credited. Afterwards, the games were rated by the public over a week long period, and then the top 100 rated games sent to the GMTK creator, Mark Brown, to pick his top 20.

The Creation of Backfire

For me and my 2 friends, this was our second game jam. Our first was during GMTK 2019, where we created a small game about morse code saving a sinking ship. It wasn't very good but it was the first time any of us had built anything complete in Unity (I had worked on projects before but never finished them).

So for this year, at least we had more experience with Unity, coding in general, and game design. We spent the first evening brainstorming for ideas and came up with a good few. But the best idea was the most simplistic: You shoot a bullet and it ricochets forever. That way, if you shoot too many bullets, you lose control of the level and you make things very difficult for yourself (to not get hit by your own bullet).
Bakfire Main Menu
We decided on a top-down view, and the levels would be simple to get through - just kill all the enemies and reach the goal under a certain amount of time, without being hit by one of your own or an enemy's bullets. This ended up being quite fun. We had another of our friends make the music (he is very talented, go check him out) and another friend make the art for the main menu, level tiles, bullet, goal and character/enemy models. Overall there were 4 of us working on the project; Me and Daman56100 on programming, Senor_Saas on art & programming, and Evan on music. We all went to the same school. You can watch a short demo of me playing it here:

You can view the GMTK submission page for the game here, or the main game page here (only downloadable for Windows... sorry Linux users. We tried to get a WebGL version working but couldn't get the resolutions right). Overall, we placed 605th out of 5,300 submissions! I think that was a very good result given our lack of experience making games.

Boolean Expression Simplifier

What is this for?

This is the project that I chose to take on for my University's Term 1 Python Project. The projects could be anything of sensible scope. I chose this project because I wanted to do something mentally challenging that would solve an actual problem (and I didn't want to do a text-based adventure game that half the year was doing).

What does it do?

For another course module, I noticed that there weren't any online Boolean Expression Simplfiers that produced the Sum of Products (SOP) simplification. Therefore, I set out to create a solution that would not only solve this, but also be quick given many, many variables. This was especially important, given that the typical method to obtain a SOP simplification is through Karnaugh maps which is simple for a human to visualise and work through, but is terribly inefficient after 5 or 6 variables. Because I wanted my program to work for 10 or 20 variables, I had to use the Quine-McCluskey algorithm. I also used Petrick's method for further SOP simplification.

How does it work?

First, the user must input their expression of choice.
BES Console
The program supports 4 different tokens per operation, and three operations, as you can see in the image above. They can be used interchangably. The variables don't just have to be single letters - they can be any words or digits as long as there is no space seperating them (otherwise they would cause a parse error).

Then, the program will parse the expression into an Abstract Syntax Tree (AST) that the rest of the program can then read.
BES AST Diagram
In order to carry out the QM algorithm, the program must then work out the context of the variables in the truth table and whether or not each row is True or False. Using this truth table generated from the expression, the program can then generate the required minterms (prime implicants) to be grouped through the algorithm. The algorithm is then run on the minterms to work out the essential prime implicants, Petrick's method is applied to further reduce these, and the output is produced.

My Personal Website

This Website?

Yes. I created this originally for my University's Term 1 Web Dev project, but I decided that I liked the layout and kept building upon it. At the time of writing this section, I chose to complete the website and all the features I currently wanted, within just basic HTML/CSS/JS. However, in the future, I would like to use frameworks, probably React + Styled Components. If you are interested in the code used for this website, everything is open-source.
Website Code

Haiku Generator

What is a Haiku?

Haikus are a type of poetry, originally from Japan. They must contain 17 (Japanese) syllables over 3 lines, in a 5-7-5 pattern.

How does the generator work?

The program takes in 4 inputs; 2 nouns, an adjective and a verb. The program will then use these words alongside a word bank to create the poem. Every poem generated, even with the same set of words will be different (unless you get lucky and see the exact same one twice in a row, but given the number of words to pick from those chances are very low.) The program will also automatically replace your words with words from the word bank if your word is too many syllables for the line. It will also try to keep to 17 (Japanese) syllables although is not yet perfect.
Haiku Example
Ok... it isn't perfect... :)

BobbyBot

What is BobbyBot for?

BobbyBot is a small little bot for Discord I made in 2018. Coded in JS using discord.js, it's small and only offers a few useless but perhaps fun (for 5 minutes) commands. I used it to teach me JavaScript, JSON parsing (for the weather checker) and so I could get in on the useless Discord bot action.
BobbyBot Maths
Useless commands include:

  1. Ping checker
  2. Coin flipper
  3. Checks users' roles
  4. Checks users' avatar and profile info
  5. Weather checker
  6. Multiply any lengths of ints or floats together
  7. A super duper secret command
  8. A half working, half broken music player