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.

Fixed

Final Game

 

You can find the code here – https://github.com/opethe1st/SameGame 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.

Pro Mini vs. Nano vs. Uno

I recently acquired new hardware components among them are some arduino nanos and pro minis. I got them because I wanted to investigate their use as low-cost alternatives to the uno. The uno is about $25 dollars , and you could get clones for as low as $15 but the nano cost about $2. $2 !!

So what’s the same? 

First, they all (or have a version ) run on a 5v. They share the same microcontroller core- the Atmega328 .They have the same number of analog input pins. Some of the digital pins can do PWM. And A4 and A5 can be used for I2C .

What’s different?

One difference is that the uno has max 20mA per digital I/O pin. The Nano and the Pro mini have max 40mA per digital I/O pin.The pro-mini doesnt have an on-board 3.3v regulator. Asides from that, there are hardly any differences between the boards.

So why the price disparity?

Well, the Uno is bigger and has components that enable it connect to a power jack. I would say if you are cost-conscious and don’t need any specialized functionality, go for the pro-mini or the nano. There are smaller, cost less and are just as cool!

References.

https://www.arduino.cc/en/Main/ArduinoBoardUno

https://www.arduino.cc/en/Main/ArduinoBoardNano

https://www.arduino.cc/en/Main/ArduinoBoardProMini

 

June Review: It’s July already!

June was.. I dunno. It just passed. By all my usual measures of progress, I didn’t make a lot of progress. I can’t recall reading any book or coding or doing some project. It just passed by. I guess I lost a bit of steam. I was tired. I was paralyzed by fear, unreasonable fear that lead to procrastination. It feels like I haven’t got my life in as much order as I thought. All of this might just be post-Nysc blues. I still have a bit of reflection to do. There are issues to be resolved

What do I hope for/what am I doing in July?

I need to be more positive. Get my morning routines. Finish the work on Afrimakers, meet new people. Finish my applications. Participate in the Cyberlympics. Be done with U.I. Read some books. Do some projects. Tinker. Drive. Kiss a girl. Have fun.