Google Code-in 2019: Week 7

If I'm being perfectly honest, I kinda want GCI to end. It has been a crazy 45 days, and I'm tired of being stressed out and working till 12AM or 1AM in the night and ending sleeping for only 5-6 hours. But, I know we're on the home stretch now, and I should give it my best. Last week was kinda slow, and I completed only 4 tasks, that too Julia Academy ones. I really need to get on my tippy toes if I want to do well.

After all, GCI is an endurance contest. Unlike CP (Competitive Programming) or Game Jams where you need to give your best for a few hours, GCI requires you to put in considerable and consistent effort over a month and half or so. This is also one reason I really like GCI to other CP or Game Jams.

I'll do another review blog post thanking everyone and everything that helped me reach here, but I don't know when. Might be after the winners come out, might be next week, idk.

Writing this final week blog post, I kinda want to reflect on why I started this.
Initially, I had the idea of just 'free writing': writing whenever you feel like it and writing about anything you want. I like the freedom of this format since I have weekly exams and I can allot time for writing as required. This idea was at the beginning of August. I used to do this in 2016, 2017, and even 2018, but that was for school work. I wanted to do this on my own.

Timewarp to December Google Code-in happened, and I saw Abhinav Kaushalya's blog posts. I found that really cool since I really liked the experience of GCI last year, but I had no memories of the time except for the work I made. This was my last time for sure, and I wanted to make it a memorable one. So, this.

Anyways, more background stuff in the review post, so hope you look forward to that.

After claiming my task "Post a question and answer on Stackoverflow.com with the Julia Tag", I started thinking about some common questions one may have with Julia. I tried going through the docs, but most questions that I came up with had already been asked. I could still come up with a question with this method, but I needed a question quickly. I looked through my previous work in GCI that could be applied elsewhere, and surely enough, I found an algorithm called "flood fill" that I wrote for my minesweeper game, and I realized it could be used in Image Manipulation programs in the paint bucket tool. Bingo!

Another plus point of this question was that the answer used recursion cleverly. So, it could be classified as a recursion question. I quickly wrote my question and answered my own question. I submitted this at 2:30PM, and it was accepted at 6PM.

I then claimed the task "Write a tic-tac-toe game in Julia" at 6:30PM after taking a short break for cycling. I came back pumped, and I started writing my game.

Note that the task asked us to make a TicTacToe with two modes: Two-player and Singleplayer. The singleplayer mode should also have an AI that plays.

I started with drawing the board, then I moved to making moves, then I added a way for the computer to make a move (random empty spot for now). After that, I wrote the win checking algorithm, my game was already complete here, and I could simply copy-paste the singleplayer code and make some changes to it, and be done with it. But, I continued. I wrote a minimax algorithm for the AI and wrote a way for the AI to make the best move, then I wrote a way for the AI to make the best move sometimes, and make some mistakes, then I finally wrote a way for the AI to make the worst move. This allowed me to implement varying difficulty levels.

After that, I was done with singleplayer. I packaged the single-player code a little better in a function. This helped me write the multiplayer code very easily. I added the multiplayer mode, finally added input scrubbing, and ended with writing a play again function that allowed the user to play again after the end of a game.

I commented the code, and I wrote the README for my game. I tested it and added snippets of the game being played in the console to the README. I was finally done! I looked up for stretching, and the Ikea wall clock caught my gaze: It was almost 3AM. WHAT?!!!

I checked my laptop for the correct time, and yes, it was 3AM. I submitted my task and went to sleep. Crazy day: I started with picking up an easy task (StackOverflow) and ended with doing another task until 3AM.

I asked Logan if I could add it to the JuliaGaming org since I felt I spent a lot of time and effort on this. He agreed, and I added it to the org the next morning. The task was accepted overnight, and I woke up at 7AM. The weird thing is, those 4 hours felt exactly like the 6 hours I used to get. I guess I just had good quality sleep or the last 1-2 hours really make or break the sleep.

Editor's note: No idea what I was doing until 3:30PM on Jan 14th when I claimed my task. Probably watching useless YouTube videos, scrolling through memes or studying for APs.

I claimed my next task at 3:30PM on Jan 14th: "Create a "How To" YouTube video about an aspect of the Julia Language". I was making the tutorial on making games in Julia since I had lots of fun making games in Julia. I decided I'll do one on making TicTacToe since it was advanced enough for the task since it used recursion and minimax. I started recording videos, and I finished the game in 10 videos each 20 minutes long (uncut). Recording took really long, and I finished recording on 15th Jan.

I started editing the beasts and I cut them to about 11 minutes each. I realized how much I ramble on,  make grammatical mistakes and use filler words when speaking. My table was getting really hot since my dinky little processor tried to render the 1080p 60fps video, and I was editing the next tutorial at the same time. I don't have a desktop, and my laptop doesn't have a GPU (i5 6300U if you're wondering). My processor is built to run on very low power, (hence the 'U' standing for Ultra-low-power, and it was on the verge of crashing. Sweatily (sorry for the image), I edited my videos one by one, and I was done with rendering them all at 10PM on Jan 16th. I uploaded them to YouTube and submitted my task. I had some extra time, so I decided I'll do what I enjoyed the most in GCI: Writing the test generator for exercism/julia.

Sascha Mann had reviewed my code, and I added his suggestions to my code. I ran my generator on all the exercism exercises in exercism/problem-specifications, and I got 42/115 passes! I went to sleep, and my YouTube task was accepted overnight.

The next day (17th Jan), I had school, so I could only start working on GCI at 6PM. I claimed the "Generate docs for Slack.jl" task at 6:30PM. I generated the docs and hosted them on GitHub pages, and I submitted my task at 11PM. My task was approved the next morning when I was in school.

That day (18th Jan) I came home at 3PM (because Saturday), and I claimed the "Make a rock-paper-scissors game in Julia without if/else statements" task. I thought about this task long and hard, and I finally settled on an OOP solution. I made objects that point to each other, showing the object that they win against. (Rock and Scissors are both Objects, and Rock's wins_against field points to the Scissors object since it wins against it.) I finished my game, and submitted my task at 5PM.

I went back to the test generator code, and I made some changes that massively increased the number of exercises my code passes on: from 13/46 to 34/46 on the julia exercises and from 42/115 to 84/115 on all the exercism exercises.

I went back to working on the generator after a break for cycling and dinner. I made some more changes, and the test generator worked on 42/46 exercises on the Julia exercises, and 106/115 exercises in all of exercism. ~92%! Wow! I decided this was enough work, and I requested a review from Sascha Mann. At the time of writing, (8PM Jan 26th), Sascha said he was busy and will have a look at it soon.

The next week is going to be the last week of GCI. I made a lot of progress this week, and I'm proud of it. Right now, I'm at 33 tasks with another one pending review. I'm pumped for the next week. I really wanted to hit 42 tasks, but I won't have much time next week, and I don't think it can be done.

Comments

Popular posts from this blog

Google Code-in 2019: Week 5

Google Code-in 2019: Week 1

Google Code-in 2019: Week 2