I’ve been doing game development for a while now- Double Bounce, Blindfold, Rockets are some of the games I developed for android and which are available on the Play Store. I have also been curious about the field of quantum computing, and have had a lot of fun playing around with the IBM Quantum Experience.
I am pursuing a double major in physics and computer science at Birla Institute of Technology and Science, Goa, and I often find myself discussing quantum computing with a physics classmate, Cheshta. During one such fascinating conversation, I found out about Quantum Tic-Tac-Toe, a version of the old game which made it much more interesting!
Since our conversation, we started brainstorming ideas for games that revolve around quantum physics. One such idea that we came up with was QLogic, a puzzle game that offers an interface similar to the IBM Quantum Experience. One of the biggest problems we’ve seen with the platform is that even though it’s fun to try out the quantum gates, you need to think of an experiment before being able to do anything meaningful.
To overcome this challenge, QLogic offers a series of puzzles that you can solve to have fun with quantum gates.
While QLogic is an amazing game for people already learning quantum computing, it is also a fantastic puzzle game for those who just want some brain exercise and don’t want to get their hands into quantum computing. The game is easy enough to understand, although the levels progressively get difficult.
Having come up with the game concept, we approached Namita, a UX designer, who came up with the screen designs and user flows, which we developed in React Native.
QLogic is already on the Play Store, with 45 puzzles, a Time Attack mode and a playground. So while we work on adding more levels and some really fun features, you can start playing! Do let us know if you like the game, and pass it on to your friends to see who completes the challenges fastest!
You can also join us on Instagram and Twitter for the latest updates. In case you have any feedback on the game, you can get in touch directly with the QLogic team on the Telegram channel.
For those of you who don’t know, VTalk is a mobile app that I developed to facilitate communication between Deaf-Mute people and speaking-hearing people. This article is about the story of how Vtalk was developed, the challenges I faced and the super awesome journey till now. Before that, let me just explain how the app works.
The Deaf person (we use the word Deaf for people who are Deaf-Mute, since the absence of hearing means that they are not very comfortable speaking either) holds his/her phone with Vtalk open, and when the speaking-hearing person says something, the Deaf person can see it as a message on his/her screen. To respond, the Deaf person types his/her response, and when he/she hits send, the device speaks out those words for him.
As far as the User Interface (UI) is concerned, it looks exactly like a messaging app, but the purpose here is completely different. The two people involved in the conversation are standing face-to-face. This is how it looks:
Originally, I did not set out to create any such app. I was just playing around with the speech recognition and synthesis libraries in React Native to see what I could do with them. One day, my parents told me that they came across a Deaf person working at a cash counter in a store. I listened to them tell me how he asked for their phone number by handing them a calculator and gesturing the word “phone” with his hand.
That was when I thought I could do something for the Deaf by making a mobile app using these libraries.
I set out to develop this, and my first version did exactly what I’ve mentioned till now, plus it allowed a user to save conversations. For those of you interested in the technical side of things, I used an SQLite database on the mobile itself to store these conversations.
Before I went ahead with more development, I wanted to see how this worked. I went to the store that my parents had mentioned, and tried to get in touch with one of the Deaf people there. However, my first attempt was not very successful, since none of them were on duty that time. Another place I visited in an attempt to test my app was a Deaf school near my house, and I requested the teachers to let me interact with the students.
The teachers were very helpful, and were happy to facilitate my trials. We decided on a time, and a teacher there called some students for my demo. I had asked him to selectively take students who were accustomed to using smartphones, and he did the same. However, we later realized that not all students there were pursuing their studies in English, and that was the only language my app supported!
Luckily, I was able to get a student who knew English and was also tech savvy. After the teacher introduced the concept of the app to him using sign language, I was able to have an amazing conversation with him- we talked about topics ranging from his school and studies to cricket.
My takeaway from that test was that VTalk needed to support languages. Especially if I wanted people in India to try it out, I needed to support Hindi and as many regional languages as possible. And that’s one of the features that I developed immediately after that. VTalk now supports all languages for which the device contains a voice.
Another thing that I realized I needed, was a visual indicator for when the app was listening to speech from the speaking-hearing person. Although there was a beep that indicated that it had started listening, there had to be a visual indicator for the Deaf person holding the phone.
After this, I was able to get a meeting with members from Ability Foundation, Chennai- an organization that works with Deaf people. They were impressed with the speed and accuracy of the app, and how smoothly it enabled a dialogue. The meeting itself was in July 2019, and they told me to attend an event called EmployAbility in December of the same year for some trial runs.
Super excited about these trials, I added several features to the app to make it more suited to an interview setting. Users could now enter a code given to them by Ability Foundation, which took them to a special chat screen in the app. These interview chats were now saved on a server, and Ability Foundation could use an admin login to view interview conversation. This would enable them to find out how the app performed, and also give them and me a record of the interview conversations done through the app.
With all of this ready, I was demonstrating the app to a friend, and after he had taken a look, he immediately pointed out, “The phone’s mic is at the bottom, which means that it is pointing towards the person holding the phone! If the person standing in front is the speaker, why not point the mic towards him?”
This was an interesting point, and I set it right by giving the app a reverse-portrait orientation. This means that whenever you’re using this app, you need to be holding your phone upside-down.
With an improved app, I ran several trials at the employment fair in Chennai in December 2019. I was able to have some good conversations through the app, and gain valuable feedback. A highlight of my visit there was that one of the people I interacted with was so impressed, that he handed me his phone and requested that I install the app for him! My app wasn’t store-ready at the time, but I gave him a pre-release, and he was delighted.
Immediately after my trial runs in Chennai, I had a presentation to give in Nagpur. I had gotten in touch with some ENT surgeons, since they frequently deal with patients with hearing impairments and trouble with speaking. One of them told me that I should let all ENT surgeons know that such an app existed, so that they might be able to recommend it to their patients. He was happy to give me a presentation slot at AOICON, the national conference of ENT surgeons.
I also wanted to put the app on the Google Play Store before my presentation, so that I could tell the doctors that their patients could download it from there. So I spent my winter break preparing the presentation as well as making the app store-ready.
One key change to make was the user interface, the looks of the app. Luckily, my sister was in Nagpur in December, and she works as a UX designer in Michigan. With her help, I refined the looks of the app, and got it ready for the store in time for my presentation.
My presentation went fantastic too! Although I’ve always had stage fright, I was able to deliver it well, and among all the doctors present there, I was the only non-doctor to get the honor of speaking at the conference!
One of the speakers who spoke right before me said to my parents later, “The kid stole the spotlight!” That was one of the most delightful things I’d ever heard! Another huge joke from the conference was that every time the anchor called out my name, he gave me the title of doctor! 😛
Not just that, but even my certificate from the conference has “Dr Shreyas Nisal” written on it!
At the conference, one of the ENT surgeons told me about how there were surgeries that affected people’s voice boxes, and that the surgeries result in a loss of voice for the patients! He told me that it would be pretty cool if I could have a patient record his voice before surgery, and then have VTalk synthesize his voice itself. That’s one of the toughest tasks that I have listed with me, but I really hope that I’m able to do that someday!
Right now, there are several feature that I plan on adding. Some of them involve using natural language processing to make the app intelligent. Other than making improvements in the app, I also want to learn the sign language, so that I can communicate better with Deaf people, explain the app to them and encourage them to use it!
It’s been a beautiful journey so far, and it could not have been possible without so many people helping me out. So a big, big thank you to everyone who played a part in getting this app to where it is now. And I hope I am able to improve this further, and develop an app that truly makes a huge difference in the lives of Deaf people around the globe!
You can also take a look at the app on the Google Store if you have an android device. Do drop a like if you had fun reading about my journey, and share the article with your friends and the app with people who you think might benefit from it!
Speech Programmer is one of my most exciting projects, if not the most. Although it’s still at a very primitive stage, I wanted to get it out for everyone to take a look, and if possible contribute as well, since it is completely open-source.
What is Speech Programmer?
Speech Programmer is a web app which generates code from speech. A user can say “integer test equals 10”, and the app generates the code int test = 10;
The app currently supports only C code, and the user has to follow very specific rules when speaking. Also, I haven’t added support for looping constructs yet. My aim is to support different programming languages and get rid of specific rules on the part of the speaker too.
However, the progress I have made also works really well, and you can take a look at that from the video below. You could try out the application here.
Whether it be for users who are just too lazy to type and want their code typed out for them, or whether it be for those without hands to be able to code, the Speech Programmer has several applications.
To be honest, I came up with the app because I often felt like just lying in bed, but at the same time I wanted to do something productive like working on a project. In times like these I would often wonder if I could get someone to type out code while I dictated it. One day, I thought- why not make my computer listen to me and type code on it’s own? It’s not as if it can’t listen to me, Cortana does that anyways!
There have often been times when I wanted to write the code for Speech Programmer itself by using the app and speaking code, but unfortunately I haven’t progressed so much in the app to be able to do that. Nevertheless, I’m sure we’ll get there some day, when the next version of the app can be done using the app itself!
One of the primary reasons I wanted to put this out there is because Speech Programmer is completely open-source. You can head over to my GitHub repository and take a look at the code.
And I would love to work with you if you want to contribute to this project. I want to include machine learning and natural language processing to this app some day, so whether you’re a web developer or an ML enthusiast, I’m sure you’ll bring something new to the project!
Hope you find the project as awesome as I did, and hope you join in on contributing to this project! Looking forward to seeing you on GitHub! And don’t forget to drop a like on this post!
If you code in multiple languages, you probably have a favorite language. Although Whitespace is not my favorite language (I doubt it is for anyone), I found the concept behind it both fascinating and ridiculous, and hence this article devoted to this programming language.
Whitespace is based on a very interesting concept. Programs in this language are written with only whitespaces, so just space, tab and newline! You can write an entire whitespace program using just your spacebar, the tab key and the enter key. One hilarious thing I realized when I first read about this language, was that if you opened a whitespace program in any normal text editor (notepad, sublime text, atom, etc) you would just see a blank file!
Released on 1st April 2003, the language seemed just like an elaborate April Fool’s prank. Added to this was the fact that the idea for the language came up during a conversation in a pub!
However, other than being a joke, languages like Whitespace do have a purpose. Languages like these are designed to demonstrate how it is possible to come up with a language using just a couple of characters. Languages like this are also often considered as software art.
One interesting thing about Whitespace is that when an interpreter (an interpreter can be thought of as what runs a piece of code) works on whitespace code, it completely ignores non-whitespace characters. What makes this fact even more interesting is that most other programming languages ignore whitespaces, or would treat a space and a tab as being completely interchangeable. With these two pieces of information, what one could do is write a whitespace program in a file that actually contains another program.
So let’s say I write a Java program, but I include tabs and spaces in each line such that they form a meaningful Whitespace program as well, I could run the same file as a Java program or as a Whitespace program!
For those of you who might be interested in taking a look at Whitespace programs, head over to this link– it is an online Whitespace IDE that I found, and it highlights spaces and tabs differently for us to be able to read the program. Also, if you liked the article, do give it a like, and follow my blog if you haven’t already!
I have a strong belief that in modern times, it is becoming essential for everyone to learn coding. Just as we learn mathematics, biology, physics, chemistry, social sciences till high school, I think coding in some language or the other must be made as important a course as these other courses. In this article, I’m going to talk about just this- “coding for everyone”. I’ll talk about questions like why and how much we should learn coding.
Why Learn Coding
I think this is the first question I should answer- why should everyone learn coding. The answer is actually pretty simple- because you will probably need it. Whether you plan on handling a business, becoming a doctor, or something else, there’s a lot you can do with coding. The simplest example that comes to mind is building your own website; it could be a website for your business, or for you clinic/hospital, or maybe even a personal website. Of course, you can get a website developed for you, but you’re going to be paying for it, and it’s maintenance is just another bill that you’re going to keep paying. Instead, if everyone learns to code, they can make any website they want themselves, and maintain it themselves too!
Another excellent example of why you might need coding is to do something extraordinary relevant to your field. I know of a doctor who used a 3D printer and came up with algorithms himself, which allowed him to get something similar to 3D x-rays of his patients. I know of another doctor, an otolaryngologist, who came up with an app to facilitate communication for the Deaf.
How Much Coding to Learn
There might be people more interested in teaching a beginner how to convert any algorithm in his/her head to code, and I think it’s a good starting point. Coding is simply the art of explaining something to a machine, possibly similar to how you would explain something to a child. Just as there are limited things that a child understands, there are limited things that a machine understands. Note that this does not mean that there are a limited things that a child/machine can do– as long as you can break even a herculean task down to a million everyday tasks, a child or a machine can do it! In the end, coding is just breaking the task down into small tasks that the computer knows how to perform.
Although I agree to a large extent with people who think converting an algorithm to code is sufficient coding, I also feel that the most important thing in teaching coding is removing a block from a person’s mind. Let’s just say you notice a problem relevant to your field of work, or maybe even an everyday, common-man problem, and you think there is a tech solution to the problem. At the end, building mobile or web applications is just identifying a problem and developing something to solve it, and it is not necessary that only a developer would be able to identify a problem.
I think any person who identifies a problem and realizes that an app could solve it, should be able to develop the app himself. And often, even with people who know basic coding, there is a block in their mind that prevents them from getting started with a new technology. And I believe that in teaching coding, it is this block that we need to remove. We need to give every individual the confidence to start a new technology with the belief that whatever problems come up, they would be able to use the resources available and find a solution!
In summer 2015, I already knew how to solve a Rubik’s cube using the beginner’s method. Not just that, I had spent quite some time teaching my classmates how to solve it. Having watched a video of someone solving it blindfolded, I decided to take it to the next level and learn the blindfolded solve.
I started my search online, and sure enough, there were several resources on blindfold solving. In this article, I’m going to discuss what I found on the internet, give you a brief idea on how exactly a blindfold solve is done, and how I devised a slightly different method myself.
So let’s start with what exactly we try to achieve in a blindfold solve. In a Rubik’s cube, there are “algorithms”, sequences of moves that achieve certain positions. For example, if you want to rotate a corner, there would be a sequence of moves to do this. The algorithm is written using alphabets that represent which layer to move.
Here is a simple algorithm: R’ D’ R D. What this algorithm tells me to do, is first rotate the right layer, then the down layer, then the right layer again, and finally the down layer. However, when I talk about the right layer, there are two possible directions of rotation. To distinguish between these directions, we use the R’ (read as right-inverted) and R. The former refers to a counter-clockwise rotation, whereas the latter refers to a clockwise one.
When we do a regular solve of a cube, we use algorithms that achieve a certain transition at a time, while disturbing the rest of the cube. Only towards the very end, we make sure to use algorithms that achieve transitions without disturbing the rest of the pieces.
In a blindfold solve, we focus on using algorithms that do not disturb the rest of the cube, from the beginning itself. This means that there is a certain piece on the cube, and we call this the shooting location, from where we move a piece to another location. You can understand this better through an example.
In a cube, we have two kinds of pieces- edge pieces and corner pieces. In the image below, A, B, C and D are the edge pieces, whereas 1, 2, 3 and 4 are the corner pieces.
In this scenario, let’s just say that I choose B as my shooting position. This means that whatever algorithm I have in memorized will move the piece which is right now at B, to another position (say D). Suppose the scrambled cube is such that the piece at B needs to be moved to position C, I would bring the piece C to the position D using some moves, then perform my algorithm, and move the piece back to C. While doing all of this, I make sure not to disturb the rest of the cube at all.
When I do the above, the piece at C now comes at B, meaning that the algorithm I know is a swapping algorithm. So, I just look at what piece is present at C, and where that needs to go in a solved cube. Let’s say it needs to go to a position O (not shown on the cube), and the piece at O needs to be at position M. Then, in my head, I have the alphabet sequence C-O-M. I have already named all my pieces such that when I say an alphabet, I know where that piece is.
Thus, I shoot from B to C, and the piece at C comes to B. Now I shoot from B to O, and the piece at O comes to B. Finally, I shoot from B to M, and the cube is solved! I follow a similar method for the corners.
In summary, what I have in my mind is just a sequence of plus and minus, which represents the rotation of corner pieces, followed by a sequence of numbers, which tells me the shooting positions for my corners, and at the end a sequence of alphabets which tells me the shooting positions for my edge pieces. Typically, the +/- sequence has 7 characters, there are around 6 or 7 numbers, and around 10 alphabets. By remembering all of these together with 5 algorithms (2 pairs of algorithms are very similar to each other, and 1 separate algorithm), I am able to solve a Rubik’s cube with my eyes closed!
The following section goes more into detail about how I devised my own algorithm by eliminating the parity condition and reducing the number of algorithms required.
When looking up online, I found an algorithm called the Y-perm to solve the corners. This algorithm takes care of the corner rotation as well as position. However, I was having some difficulty using this algorithm. Hence, I used a corner rotating algorithm, which was much simpler, and paired it with a the L-perm algorithm to solve corners. The L-perm simply swaps the corner positions 1 and 2, while at the same time swapping the edges B and A. To solve corners, I simply make sure that my corners are rotated correctly, and then use the L-perm to shoot from the position 1.
Parity is a special condition that comes up when I finish solving the corners. Since my corner swapping algorithm also swaps edges B and A, I get a slightly disturbed cube if I solve an odd number of corners. So out of 8 corners, let’s say 3 were already in their correct positions, and I just had to solve 5. In such a scenario, I end up getting the piece A at my shooting position instead of the piece B.
Traditional blindfold solving methods dictate that one must use an algorithm called the R-perm to eliminate parity. However, the R-perm was another algorithm that I found difficult to apply. Hence, I devised a simple solution. When memorizing the cube, I take note of whether I’m solving an odd number of corners or not. If I am, instead of looking at where my piece B needs to be in a solved cube, I simply look at where my piece C needs to be, and start my alphabet memorization from there. This trick eliminates the need for a parity algorithm!
Hope you were able to get a general idea of how a Rubik’s cube is solved blindfolded, and liked the method that I devised using improvisations to the traditional methods!
P.S. I successfully solved the Rubik’s cube blindfolded in front of an audience of around a hundred people in summer 2015 during an adventure camp!
Summer of 2017, I had finished my entrance exams, and I was back from a US trip. I had time on my hands, and I approached my uncle for something I could work on. He gave me a task, and it took me quite some hours of research to get it done. Basically, he wanted me to learn how to create static and dynamic linking libraries in C++, both from the command line as well as using an IDE (Integrated Development Environment) such as Netbeans.
My task for the first day was just to create a static linking library using from the command line. The next morning, when I went to him with the task done. He just asked me how much effort it took, and I said a lot. He smiled and told me that I did not have a new task for the day. Instead, I just had to recall everything I did the previous day, and make a documentation of the steps needed to create a static linking library from the command line. Over the next week, I would do a task every other day, and spend the rest of the days documenting the previous day’s work.
Documenting is something that has saved me a lot of time over the last few years. Not just that, it has also been helpful for my fellow developers!
I would also try to develop different games, some of which turned out good, others not so much. Whenever I told my elder sister about a game idea that I had even just tried to make a game out of, irrespective of whether it turned out good, she would ask me, “And where is the report for this game?”
She would ask me to include things like what the game was, what new things I had to learn to develop the game, what turned out difficult, why the game did/did not turn out very well, and what my takeaway from the project was. Another important thing she had me include in my reports was what I would do differently if I had to do the same project again. In some cases, it was the code design that I thought I could have done better, at other times it was how I should have done it in a team instead of attempting it alone.
It so turns out that quite a few of these things are potential interview questions that I might have to answer, related to the projects that I put on my resume. Also, when I document my small projects, it becomes a habit, and the habit makes sure that I do it for my larger projects too!
The fact that I document things has also been appreciated by some people. I did a 15 day workshop on networking in my first year, and after a few days of learning the basics, we had started to do things like creating DNS servers, or mail servers. Every night, after the workshop, I would document whatever we did. I also sent it to my instructor for feedback, and he really liked the fact that I was documenting my work.
Other than that, I also created documentations when it took me hours to solve some error, which was especially the case with react native. I also post these articles on medium, and a few days ago, I found out that it ranks among the top links when you google the error. If you want, try looking up “Duplicate Resources error React Native”.
I’ll also post some of my old documentations sometime, and you can take a look at them. However, the next time you work on a project, whether it be a small, personal project or a big one that you do as a member of a team, try documenting your role in the project. I promise you it’ll be a huge help in the future.
That’s it for this article- if you think documenting is a good idea, drop a like. Also, if you start documenting because of this article and it saves you time or turns out to be a useful habit, don’t forget to drop a like!
I’ve developed several games till date, mostly android games, and to come up with these games, I’ve had to develop several more prototypes which did not turn out so well. In this article I’m going to discuss how I came up with some game development ideas, along with why I started game development in the first place.
Why I Started Game Development
As a kid, I was totally addicted to PC games. I was always pestering my parents to buy me new games. Once, I asked my dad for a new game, and he said, “You want a new game? Then make one!” Somehow, this line stuck with me for years.
It was 2013 when I did my first programming course, on C programming. During the course, I built a very simple puzzle game that is played on a console itself (a black and white screen). Later, in late 2014, I got introduced to visual Basic, with forms where I could add shapes and a timer. With no idea about game development and how it was done, I intuitively started moving shapes by writing the code to do so within a timer itself. For those of you who don’t know about game development, that is roughly how actual games do things too!
I created several games in visual basic itself, before moving on to the Unity game engine, which I used to create android games. One of the first games I built for android was called “Survival”, a pong-like game where the user controls both paddles! Double Bounce, another android game, is an improved version of Survival, and is still on the play store.
It turns out that long before I created Survival, I had already created the same game in VB. I had forgotten all about it when I developed Survival, but I think it was still somewhere in my subconscious, since the VB game was also called “Survive”.
Here is an image of Survive, the VB game I developed.
So what gave me the idea for this game where the paddles move in opposite directions but the player has to control them both. I think this idea came to me because of the old Pong game, as well as brick breaker games like Atari breakout or DX-Ball (which I’ve played a lot as a kid).
Why You Should do Game Development
Other than just being a very interesting field, there are other reasons why you may want to pursue game development as a career. One reason could be the dopamine rush that you get when you see someone play a game that you’ve played a role in creating. Another reason why game development might be interesting is because you get visual feedback on what you’ve made, unlike some software development field where you’re just working on code that does not produce something like a webpage, app or game.
In case you’re interested from a monetary point of view, there is a lot to gain from game development there as well. Supercell, a company based in Helsinki, Finland, has developed multiple popular games including Clash of Clans and Clash Royale. Both of these are free to download, and contain no advertisements. Their primary source of revenue is in-game purchases, which is people buying in-game gems using real money. Despite being free and devoid of ads, Clash Royale made $2.3 billion in the first year of its launch.
Some More Game Ideas
Another game I have on the play store is Blindfold, a game that you play primarily based on auditory feedback and rhythm. It basically relies on your sense of timing, with the screen showing just the score. For a few seconds initially, you can see the game elements, after which the screen goes blank. This is one of the most unique ideas that I’ve come up with, and the game has the maximum downloads among all my games. I visited a place run by blind people, where they give us an experience of darkness, and how we can do things like play cricket (or a simpler version of it) in complete darkness. It was then that I realized that I could make a game out of this too- a game that can be played with a blank screen, or without having to look at the screen!
Another idea that I tried but which did not turn out very well was a modified version of the classic Snake game. The entire concept was the same, the only difference being that in my game, the snake could only turn left!
So this is my story about game development, and even today, I keep thinking about new ideas and writing them down or sketching them to see if I can make a fun game out of it! I have some more ideas, but I will skip talking about those in the hope that you would get to see the actual game instead of having to just read an idea.
Hope you liked reading this article! If you liked the idea behind some of my games, you can check them out here (if you’re an Android user). All of my games are ad-free and free to download, so no strings attached. Just download and give them a try! Also, don’t forget to share this article and these games with you gamer friends!
As a child, I was always interested in codes and ciphers. Encrypting stuff so that nobody could read it, and coming up with a secret language with some friends! I think we’ve all done this or at least tried to. And most of us have seen movies where these encrypted messages are sent and received by secret agents, or used by military units during wars. But have you ever wondered how exactly these codes and ciphers work, what the difference between these is, and what makes a code/cipher strong?
Let’s take a look!
Code vs Cipher
If you asked someone what the difference between a code and a cipher is, they would most likely say nothing. However, there is a slight difference between these two. In a code, we convert a word or a sentence to something else, which is usually shorter. Codes are usually useful for saving time when sending messages. For example, we may say that the word “slap” stands for the sentence “please proceed to the next line”. To make meaning out of something written using a code, we would need a codebook. A codebook is simply a mapping of a sentence and the short word that represents that sentence.
Ciphers, on the other hand, deal with individual characters. In a cipher, we convert a letter to another letter or symbol, and by doing this with each character, we make our message unreadable to someone who does not know how the encryption was done. One popular cipher is the Morse Code, which is a cipher, contrary to its name. It converts alphabets to sequences of dots and dashes. In this article, we would be focusing more on ciphers.
Transposition and Substitution Ciphers
Ciphers can broadly be categorized into transposition and substitution ciphers, although we can also create ciphers that are both.
In a transposition cipher, we just change the order of alphabets, while leaving the alphabets themselves unchanged. For example, consider the word “tasoiinrnpsto”. Here, I just took the word “transposition”, and rearranged the alphabets. I took all odd indexed alphabets from the word (t is the 1st, a is the 3rd, and so on) and arranged them first. After I had run out of the entire word, I took all even indexed alphabets and arranged those. In doing this, I did not change the alphabets themselves, but only their order.
Another very common example of a transposition cipher is where a strip of paper is wrapped around a pipe of some diameter, and the message is then written on this strip. When the strip is taken off the pipe, it is unreadable. When your own ally wants to decipher what is written, he wraps it around a pipe of the same diameter.
In a substitution cipher, an alphabet is exchanged with another alphabet or symbol. For example, consider the word “ifmmp”. Here, I just substituted every character from my message by the character that follows it. So an ‘a’ becomes a ‘b’, a ‘b’ becomes a ‘c’ and so on. To decipher the message, we just have to replace every character in “ifmmp” by the character that comes before it. Thus, we get the word “hello”. This is an example of a Caesar cipher, where we shift every letter by a constant number of alphabets.
Decryption of message is always a difficult task. Decryption is important for a party that intercepts a message. So let’s say a military unit uses radio for communication, and we, their enemies, have figured out the frequency they use. We tune our own radios to their frequency, and can hear everything they send to and fro. However, they send their messages in an encrypted manner, and we want to figure out their messages. In such a case, we have to find a way to convert the unreadable text to the original message.
Often, the method of encryption used is common knowledge. For example, I know that the messages are being encrypted using a Caesar cipher, or that the military unit uses some pipes and performs a substitution cipher. What’s most interesting is that even with this knowledge, it is not easy to decipher messages. The reason being the lack of knowledge of the key. A key is an important component to deciphering a message. In case of a Caesar cipher, the key would be the number of alphabets by which we shift our letters. In the pipe-based transposition cipher, the key would be the diameter of the pipe used. Without a pipe of the correct diameter, decryption attempts would be futile.
However, in today’s world, it is pretty easy to break something like a Caesar cipher, since we can have a computer check hundreds of keys and check if decryption using that key gives us a meaningful English (or whatever language the sender uses) message, all in a matter of seconds!
However, with more difficult to break ciphers, how do people go about trying to break it. There are several different things that can be tried. One of them is just trying to guess a key- so let’s say we need a 4 digit numeric key, 1776 might be one of our guesses if the sender is American.
Another way to decipher messages is to try keys based on frequency of alphabets. If we know that a particular letter has only one symbol that it has been substituted with, it might be reasonable to say that the symbol that appears most often represents an ‘e’, since it is the most frequent letter in English. The last way that one might use in a decryption is brute force. Brute force is just trying all possible keys one by one, and is usually a task delegated to a fast computer.
A strong cipher is one that is difficult to break. For example, if we do not replace letters with the same symbol every time, but different symbols, then it becomes difficult for a third party to decipher the message. For example, let’s say we use a Caesar cipher, but for every word, the key is the length of the word. This might be difficult to break, but not impossible. Here is how it could be broken. Let’s just say that a computer tries keys one-by-one. When it realizes that a particular word is meaningful using that key, it gives you that word. It keeps giving you words with every key, and this could lead to decryption of the message.
A Substitution Cipher
So here is a cipher that I want you to consider. I will leave you with whether it is a strong cipher or not. We write 3 strings, all of which contain all alphabets, but arranged randomly. Not just all alphabets, we should include all characters that we might find on a keyboard. Just make sure all 3 are of the same length, and contain all alphabets (both upper and lower case) as well as numbers and a space.
For the first character in our message, we find the character in our first string, and note down what index it is at. We find the character at that index in the second string, and replace our letter with this character. For the second alphabet, we follow the same procedure, but instead of the second string, we use the third.
Here is a rough idea of how strong this method might be. There are approximately 95 characters on a keyboard. To arrange these in a random order, there are 95 factorial ways. Hence, there are 95 factorial ways for each string, and only when all three strings are correct can someone break this cipher. There are, in total, (95!)*(95!)*(95!) possible strings that one might have to check in a brute force!
So that’s it for this article. Hope you liked it! If you did, don’t forget to like and share!
There are a hundred people, you being one of them. You are all asked to choose a number between 0 and 100, both inclusive. The person who chooses a number that is closest to two-thirds the average wins the game.
In the above scenario, what number would you choose? Choose a number, and only then continue reading to understand the different strategies for this game.
Let’s just say that I assume that the numbers that other people choose are completely random. In such a scenario, the average of all choices is going to be close to 50. Hence, it seems rational for us to choose 33 as our own number.
However, when posed with the question, here is what I thought- I started off with the above assumption of the choices being random. According to this, my choice was going to be 33. But then I wondered if other people in the game would also have the same thought process that I did. If they did, they were all going to choose 33, bringing my answer down to 22 (since 2/3 of 33 is 22).
Next, I thought, if I had reduced my answer to 22, so would everyone else, and this lowered my answer even further. After numerous iterations, my answer terminated at 0, the lowest possible choice. I was assuming that everyone would choose 0, and there would be no winner.
Zero is the most stable answer to the above game. No matter how many times you run this game, nobody would want to change their answer once they arrive at zero. For any other set of choices, there would definitely be a winner, and everyone else would want to change their answers. Even if there wasn’t a winner, for example if everyone chose 33 in the first simulation of the game, there would definitely be someone who decides to change the choice to 22, destabilizing the game.
This game is a popular game in game theory, a field of study that has applications almost everywhere. Zero is the answer that one arrives at using common knowledge of rationality. Common knowledge of rationality means that I know or assume that everyone is rational and chooses 33, and then everyone assumes that everyone is rational and lowers their answer to 22, but then again everyone assumes that everyone would choose 22 and so on. This is an infinite loop of everyone assuming everyone would assume that everyone would assume…..that everyone is rational!
However, even if one person breaks the chain of common knowledge, it tips off the scales of the game. In such a scenario, it makes much more sense to choose a number greater than 0. And this is what happens in real-life scenarios, where the winning answer is close to 22.
Let’s look at what game theory is and how it has applications in various fields. In a nutshell, game theory is the science of decision-making. It governs how we should make our choices, especially when playing against a competitor. If we assume that our opponent acts rationally, meaning that he/she is looking at maximizing his/her gain from the game, we can come up with our own strategy.
A simple example of a game is the prisoner’s dilemma. Assume you are one of two prisoners. You and your accomplice are taken to two different rooms, and are asked to confess to your crimes. If both of you deny, you would both go to jail for one year. If both of you confess, you would both go to jail for 5 years each. However, if one of you confesses and the other denies, you can get a deal to testify against your accomplice and get off with zero jail time, while your partner goes to jail for 20 years!
Although common sense tells us that prisoners should deny, game theory tells us otherwise. What if my partner sells me off? I would go to jail for 20 years! Here is how game theory evaluates this situation:
If I confess, what are the two possibilities? 1. My partner also confesses, and we both get 5 years of jail. 2. My partner denies, and I get 0 years of jail time. Here, my average jail time is 2.5 years.
If I deny, what are the two possibilities? 1. My partner also denies, in which case we both get 1 year of jail time. 2. My partner confesses, and I get 20 years of jail. My average jail time in this case is 10.5 years!
It makes much more sense to confess, since the average jail time is significantly less. If both prisoners know game theory, they would both confess and spend 5 years in jail.
Game theory has applications in wars, since game theory is all about strategies. It has applications in stock markets and trading, since it tells us how to look at our expected gain, taking different possibilities in consideration. Even in nature, it has examples of how predators and prey should behave. In fact, the predator-prey game is another popular game in this field.
There are numerous categories of game theory. There are zero-sum games, wherein a gain for one player is a loss of equal magnitude for the other player(s), thus ensuring that the total gain-loss sum is zero, hence the name.
Another popular application of game theory tells us how attempts to maximize individual gain can be detrimental as compared to cooperative play. In fact, the prisoner’s dilemma that we looked at is an example. If we think beyond ourselves and about the two of us together, we realize that cooperation would allow us to both choose denial, which is exactly why we were taken to different rooms. There are numerous other formulations of games which tell us how cooperation leads to greater gains.
Game theory also successfully explains why we often find groups of restaurants (or shops, gas stations, etc) together, instead of them being spread evenly around a region. If you’re interested, do take a look at this video.
Hope you had fun reading this article. If you have any thoughts or comments, something that you would like to tell me as well as other readers, do drop a comment- I’m always eager to learn more! And if you think this article would be an interesting read for someone you know, share it with them!