Same Game

Hey, been a while I posted here. I thought to share some of my experiences cloning a game using python 2 and pygame. The game is called Same and got it when I installed Dr.Racket for Lisp. The original game.


After some coding on my mac, I got it to this stage


But on my windows it was showing this

I got reminded the importance of live testing. My code was inefficient but I didnt know because my mac was fast enough.


Final Game


You can find the code here – and also a link to download a .exe of the game

If there is enough of a demand I would go into details of my thought process and how and why I did certain things.

Begin with the End in mind: Code

I have put a lot of effort into becoming proficient with C++ of recent. One of the ways to become confident is to build applications. I decided to write a program to simulate the ATM. Users would be able to withdraw money, deposit, transfer to another customer and check account details. I thought it would be easy but it turns out, it is actually not that easy if you don’t plan it all from the beginning. That’s the most important lesson I have learnt from this. There is a need to have a very clearly defined end-goal and if possible design everything from the beginning with this in mind, top-down. I realized I didn’t have this as I was building. I was still making decisions on what functions to write and how to use them. Part of this has to do with a lack of familiarity with using sqlite3 with C++ (is that really an excuse? ) . I know that next time, I would have to do a lot more design before I code.

Programming Competitions and smartness

​I think this is going to be my last programming competition for a while. I’m done banging my head on problems and not solving them fully. It’s affecting my morale and I have too much of a competitive steak (seeing other people solve it doesn’t make me feel good). I would love to see myself as a smart person. It’s a central part of my identity but these contests keep laughing at me. I don’t feel smart. It’s distracting. 

This is not a I give up.. but rather a I’m giving this a rest. I have high expectations of myself and I’m not meeting them. Maybe I need to read more stuff and then try them out later..  or really… Stop taking these challenges so Seriously!!! Argh! 

There are other things to do. Other stuff to learn. Better ways of spending my time rather than just banging my head repeatedly for hours trying to solve problems that at the moment seem to be intractable or not to be..always so close yet so far away. Argh!. I’m done after this contest. On to more productive stuff. I have to look for projects I can contribute to.

What have I been up to?

I feel bad. I have abandoned blogging for a while. It is just not on my mind anymore and things have changed. Depression set in and all that stuff. So I thought I should write about the stuff I have been doing/done.

So.. I had this interview at this company that starts with a G. 🙂 basically the whole of August was spent preparing for this interview. I had to read up Algorithms and Data structures and all that computer science stuff I hadn’t bothered to learn in depth. I made a mistake ( a mistake I always make) to want to finish a text completely and understand before moving to another and to not just study to the test (i.e look for past questions and base all preparations on them) . I started the Algorithm Design Manual and was stuck on it for a few weeks. I learnt a bit though I believe I still have patiently read and digest it to understand in depth. I finally moved on Cracking the Code interview and Programming Interviews exposed. One of my sources of anxiety was that the interview was to happen in C++ and I wasn’t sure what my level was in C++ ( I thought I knew enough but now know I knew basically nothing…oops. Like sure I need how to write a program that complies in C++ but now that I am taking a look at The C Programming Language by Bjarne Stroustrup, I can see there is so much I didn’t know, I didn’t know. WOW! ). Lesson learnt, I really need to make sure I know my stuff and not add stuff I am not confident about to my CV. I eventually asked to do the interview in python and that request was granted.

The interview happened. I was a little nervous. I don’t think I performed exceptionally. I just managed to solve the first question in the allotted time with help. Not good enough, my gut says. I still don’t know what the result is but I have mentally moved on. The good (or is it bad?) is that it has made me wonder if I shouldn’t go into software instead of hardware. Software is actually exciting and you basically need just your laptop and the internet. Needless to say I have been doing more software of recent. I have become a hackerrank junkie. I just loving solving hard nut problems. That’s one of the reason I liked maths. The mental challenge!

Post-interview.. basically personal stuff. I have been off Facebook for a while now. I am not sure the exact date I logged out ( I think it is the 10th of October) and I have been offline since. I think I would like to keep this streak on! I am surprised I have lasted this long given how much of a Facebook addict I am. The important thing I think is to get into the habit of doing actual stuff instead of spending all that time on Facebook.

I finished the first five chapters of the Elements of Computing systems. By finished, I mean I have completed all the exercises i.e built the hardware platform for a functioning computer from scratch! Tenk you, Tenk you 🙂 . You can find it here Nand2Tetris . I might decide to tackle chapters 6-12 that deal with the software hierarchy later. I really should write a post on how computers works. I can now confidently say that I understand how they work.

It would seem I still like gaining and accumulating knowledge more than actually applying or maybe it is just a confidence thing. I feel there is so much still to learn, I don’t know enough to be dangerous. I desperately need some project ideas or open-source projects to test my powers on.

Books? I am currently Collapse and the Lean Startup. Did I say I have finished my Goodreads book challenge for the year? 🙂  and I read Elon Musk by Ashlee vance (I strongly recommend). And yes, Ifeoma got me the Structure and Interpretation of Computer Programs, one of the classics! Thanks once again.

I have two outstanding tasks I have been procrastinating on. It is vital I get them done. Wish me luck!

Afrimakers. Next Gen.

I think it is time, I moved on from being the Afrimakers guy. I want to hand over to fresh guys(guys is unisex abeg) , bright minds and committed people and I have started training a new crop. The excitement they feel on getting it to run for the first time is palpable. They are a diverse group not just Electrical engineering students but Mechanical engineering students too, guys and gals in different years. The key would be to get them to keeping going for more. Learning more and spread this virus the rest of the world!

<Insert pic here 🙂 >

Updates on my Education

I am a life-long learner and I believe I will keep learn new things till I die. Some of the things, I have had in mind to learn are C++, Html, Css, Javascript etc. I started html yesterday by skimming through a book on html. I won’t go deep into it, at least not now. I just want to be able to decipher what html means and I feel like I accomplished that objective. The other thing I have had in mind is C++, I have actually started learning C++ but I have faced an obstacle that keeps coming up  – using the language to solve programming problems. Python is my default and I hardly have the strength to grapple with language issues in addition to solving the programming problems. I just like to read, to practise? not so much. It is an old habit that I have.

On the book front, I have reduced my target for the Goodreads reading challenge from 50 to 30 after realizing that reading everything isn’t the key. The key is read stuff and have time to ponder on them and make it count. I am at 26 books  and it is July. It is liberating because I won’t feel under pressure to reading anything new. What is important is to go back to my old notes and ruminate on old stuff I have learnt. Give it time to simmer. Meditate. Focus on Quality not quantity.

I also rediscovered Encylopedia Britannica . I got the app though I am beginning to feel the physical books are better. I liked to flip through the pages and discover new things serendipitously. That is part of Nicholas Carr’s argument in the Shallows.


Book Review : The Shallows: How the Internet is changing our brains

This is an interesting and very relevant book. It talks about how our use of the internet is changing our brains.
It starts with the argument that our brains aren’t fixed. They change over time depending on how we use them or don’t.
With our use of Internet we are honing the skills that are needed to interact with this medium and losing some other skills. The critical point is that there are tradeoffs. Technological gains aren’t all positive.
The authors contrast this new medium with other changes – like when we started writing or the introduction of radio, the printing press and notes how much more encompassing the Internet is.
The problem with the internet is that, promotes a perfunctory interaction with information. There is a lot of width and not enough depth. There is information overload and we are adapting. We are getting used to skimming and losing our ability for deep thought.
The key takeaway is technological progress can have unintended consequences. We need to consider if all the changes that are happening are desireable.
As for, me, I am taking steps like deleting apps and turning off notifications to gain some sanity. I want to get back what I have lost – the ability to concentrate. I am always looking for distractions. I strongly recommend.

Foray into Cybersecurity

So my friend got me to try out for the Global Cyberlympics. I was on his team of six and we got started. I had to learn from scratch.

Cybersecuriy has a couple of domains – Cryptography, Steganography, Web exploitation, Reverse Engineering etc.

My main focus was Cryptography and later on, reverse engineering. Breaking ciphers can be exciting and finding hidden messages, super cool.

We didn’t qualify but at least I can say this is one more thing, I know a little about.

Book Review : Ego is the Enemy

I am a huge fan of Ryan Holiday and as a true fan, I just had to read his latest book. It was awesome. It talks about Ego.

The ego we see most commonly goes a more casual definition: an unhealthy belief in our own importance. Arrogance. Self-centered ambition. That’s the definition this book will use. It’s that petulant child inside every person, the one that chooses getting his or her way over anything or anyone else. The need to be better than, more than, recognized for, far past any reasonable utility – that’s ego. It’s the sense of superiority and certainty that exceeds the bounds of confidence and talent.

The book is divided into three parts. Aspire, Success and Failure.

“To whatever you aspire, Ego is the enemy” . The first part has to do with Talk, talk, talk. This part hit home for me. I am guilty. There is a need to be silent and just do. Talking saps energy. Become a student – this means subdue your ego and seek to improve. “Don’t be passionate” – I struggled a bit with this one because I still believe passion is important but I actually saw the wisdom in this quote. “The critical work that you want to do will require your deliberation and consideration. Not passion. Not naivete”. “Restrain yourself”. “Work, Work, Work”.

“To whatever success you have achieved, Ego is the enemy”. “Do you know how you can tell when someone is truly humble? I believe there’s one simple test: because they consistently observe and listen, the humble improve. They don’t assume, ‘ I know the way'”. ” Don’t tell yourself a story” – Don’t start rounding the edges and forming a mythology around yourself. “Narrative is when you look back at an improbable or unlikely path to your success and say: I knew it all along. Instead of: I hoped”

“To whatever failure and challenges you will face, Ego is the enemy” – “Maintain your own standards” – “It’s a harder road at first but one that ultimately makes us less selfish and self-absorbed. A person who judges himself based on his own standards doesn’t crave the spotlight the same way as someone that lets applause dictate success. A person who can think long term doesn’t pity herself during short-tern setbacks.”

There are lot more lessons in this book. I like that it is short and to the point. I will definitely re-read and I recommend to everyone.