<![CDATA[Programiz Blog]]>https://www.programiz.com/blog/https://www.programiz.com/blog/favicon.pngProgramiz Bloghttps://www.programiz.com/blog/Ghost 5.54Fri, 12 Jan 2024 12:26:27 GMT60<![CDATA[Announcing Programiz PRO: A Hands-on Approach to Learn Programming]]>https://www.programiz.com/blog/programiz-pro-announcement/623415b80d224f088461c0ccFri, 18 Mar 2022 06:21:45 GMT

Are you searching for the best place to learn programming? If your answer is Yes, you've come to the right place! Today, we are excited to announce the launch of Programiz PRO. Now, you can combine your learning with practice.

Announcing Programiz PRO: A Hands-on Approach to Learn Programming

10+ years at Programiz has taught us that interactive learning is the way forward. That's why we built our mobile apps. With apps, we tried to make the learning as interactive as possible, however, with mobile apps, there were some limitations like, it's hard to code on mobile and even harder to create full-fedge projects.

Your suggestions and feedback provided further confirmation for this notion. This led us to the realization that our learners needed a better learning environment: an online platform where they can practice while learning by solving challenges and building projects.

That's why we have created Programiz PRO: an interactive learning platform that combines knowledge with practice. Through Programiz PRO, we're taking interactive learning to an even bigger level.

Programiz PRO

Announcing Programiz PRO: A Hands-on Approach to Learn Programming
Introducing Programiz PRO

What is Programiz PRO?

Programiz PRO is not just another programming course. Instead, it is a most interactive learning platform where you can learn by writing code, solving challenges, and building projects in real-time.

And if you're worried you're a mere beginner with no prior exposure to programming, then fear not! Lessons in Programiz PRO are designed to teach you right from scratch. Each lesson is curated in such a way that you will be ready to implement the concept in a real project once you're done. These lessons include quizzes and challenges to help you test your knowledge.

What's inside Programiz PRO?

Here's what you'll get with Programiz PRO:

1. Highly Curated Learning Paths

Programiz PRO provides you with a wide array of learning paths. You could also call it career paths, where you learn very specific skills to master certain aspects of programming relevant to your chosen career. For example, we hear a lot about concepts like Data Science, Machine Learning, Blockchain, etc. But we may not know what is actually required to master these fields.

That's why learning in Programiz PRO is divided in terms of learning paths, and each learning path will include multiple courses from basics to advanced that provide a step-by-step guide to mastering a learning path.

Announcing Programiz PRO: A Hands-on Approach to Learn Programming
Learning Path Roadmap

2. Interactive Courses

Courses in our learning paths are well-designed units of essential curriculum and interactive resources: quizzes and challenges that help our learners practice while learning. Basically, we want to make your learning fun, with realistic outcomes.

3. Powerful Compilers

Our goal here is to help you strictly focus on the core part of coding and practicing. So, to help you avoid the distraction of learning third-party tools and compilers, we are providing built-in compilers for every language where you can write and run code.

Announcing Programiz PRO: A Hands-on Approach to Learn Programming
Built-in Compiler

4. Projects

To compete in the job market, programmers (especially beginners) have to provide something extra to the recruiter. With this in mind, we are introducing mini projects with Programiz PRO that will help you guys add your first project to your portfolio.

5. 100+ Challenges

Throughout the courses, you will be solving multiple challenges that will test your skills. These challenges are set in a professional environment, pushing you to spend time finding and fixing errors, just like a professional programmer.

6. Certifications

Once you complete all the courses and challenges, you'll be rewarded with a personalized certificate that will put you ahead of your competition while landing your first job.

7. Discord Community

To guide you throughout this journey, we have also created a private discord community where you can ask questions, connect with people like yourself, share your story, and many more.


What does Programiz PRO mean for us?

From the very beginning, our goal at Programiz has been to remove all the barriers that beginner programmers face while learning to code. And we are working towards that goal every day.

So far, we have received extremely positive feedback for our tutorials, mobile apps, and YouTube videos. Knowing that we have had an impact on people is a humbling yet deeply fulfilling experience.

With this, we felt it's time to go the extra mile and do something more for our users.

That's when the idea of a truly interactive learning environment came to us: a platform where one can start from scratch and then advance forward both in theory and practice; a platform where one can combine knowledge with practice.

Now, with the release of Programiz PRO, we are proud to say that we are closer than ever to meeting our goal of removing all barriers to learning programming.

And we really hope that Programiz PRO proves to be an invaluable tool in your journey towards mastering the art of programming.


Celebrating our Journey Together

To celebrate our new journey together, we have brought you an exciting offer.

Announcing Programiz PRO: A Hands-on Approach to Learn Programming

For our blog visitors, we are giving 50% discount on yearly subscriptions.

Signup using the following link and claim your discount now.

Claim your discount coupon today

Start your interactive learning today with Programiz PRO.

Happy Programming :)

]]>
<![CDATA[Unveiling Learn C++: Programiz - The Best App to Learn and Code in C++]]>https://www.programiz.com/blog/unveiling-learn-cpp/61407ef6d1e7a1055f3500e2Thu, 16 Sep 2021 11:15:21 GMT
We at Programiz are proud to announce the launch of Learn C++: Programiz - the latest in line of our successful learning apps!
Unveiling Learn C++: Programiz - The Best App to Learn and Code in C++

As programming enthusiasts, you are aware of the speed and efficiency of C++ and its wide usage in big software companies: from developing games to modern web browsers.

Perhaps you aspire to join these companies in creating the next series of world-class products; or perhaps you wish to use C++ to create a whole new operating system on your own; or maybe you just want to add C++ to your existing skillset.

Whatever the case may be, we are here to help! You can now learn the basics of C++ with our interactive new learning app: Learn C++: Programiz! Download now and get started!

Get C++ App Now
Unveiling Learn C++: Programiz - The Best App to Learn and Code in C++
Introducing our new C++ app

What is Learn C++: Programiz app?

Like its predecessors, Learn C++: Programiz is an interactive learning app that contains carefully curated and accessible tutorials on the fundamentals of C++.

But that's not all! Our high-quality tutorials are complemented by practical examples, fun quizzes, and, most importantly, an in-app compiler. This means you can now learn and code from your mobile device, all for free!

And if you're worried you're a mere beginner with no prior exposure to programming, then fear not! Our app is a beginner-friendly product designed to teach C++ right from scratch!


Features of our app

Unveiling Learn C++: Programiz - The Best App to Learn and Code in C++
Features of the App

With Learn C++: Programiz, you get:

  • Highly curated C++ lessons
    C++ programming concepts divided into thoughtfully curated bite-sized lessons easier for beginners to understand.
  • 80+ Practical Examples
    Tonnes of practical C++ examples to get a better understanding of the concepts.
  • Powerful C++ compiler
    An in-built code editor and compiler that allows you to write and run code on your phone.
  • Interactive Quizzes
    Test your C++ knowledge at the end of every chapter with feedback provided.
  • Handy Bookmarks
    Bookmark topics that you find confusing and revisit them anytime when needed.
  • Save Your Progress
    Track your progress and continue from where you left off.

Get certified with Programiz Pro

Subscribe to Programiz Pro and get certified when you complete the course! With our certification, not only will you get a sense of accomplishment, but more importantly, it'll give you the required competitive edge in the job market.

That's not all! Your certificate is but one of many benefits of the subscription. Other benefits include:

  • Ad-free mode
    No ads, no distractions.
  • Unlimited code compilations
    No limitations! Learn and play with your code compiler as much as you want.
  • Access any lesson anytime
    Skip lessons and jump straight to your favorite lesson at any time.
  • Challenges to sharpen your coding skills
    Available in future iterations of the app.

What Learn C++ means for us

As a team dedicated to sharing the joys of programming, we have exerted countless hours of strenuous effort to make learning easier for aspiring programmers. After all, C++ (and programming in general) can be difficult to learn.

So, we were ready to go the extra mile to create a user-friendly learning interface so that you - our valued customers - can have an easier time learning how to code.

Our efforts were rewarded when our apps for Python, C and Java became extremely successful. With the enthusiastic feedback we received from our users, moving on to C++ was all but inevitable.

This was especially true for users of Learn C Programming: Programiz, many of whom wanted to step into the object-oriented paradigm of C++ once they were done with C.

In the process of developing this app, our main challenge was to create content that was comprehensive yet easily understandable. In other words, our content had to be bite-sized and to-the-point without being light on information.

After endless edits, rewrites, and further edits, the result was a compact, elegant, and user-friendly guide to C++. The end product is something we're very proud of.

So we really hope that Learn C++: Programiz proves to be a convenient and invaluable tool in your journey of mastering the art of programming!


Launch Sale

To celebrate the launch of our fourth learning app, we are happy to bring you the Launch Sale for Programiz Pro!

Unveiling Learn C++: Programiz - The Best App to Learn and Code in C++
Get 50% discount now!

We are giving a flat 50% discount on our yearly subscription. Get Programiz Pro for $14.99 (normally $29.99). Learn more.

So hurry up and grab that subscription before the sale ends!

Get C++ App Now

Get started with the all new Learn C++: Programiz app today! Your small initiative today will pave the way for a successful programmer tomorrow!

If you have any problems or further suggestions, feel free to mail us at app@programiz.com.

Download the app and master C++ on the Go!

Happy Programming :)

]]>
<![CDATA[Introducing Challenges on Learn C and Learn Java!]]>
Today, we are very excited to announce ‘Challenges’, now available on all of our learning apps! We have curated over 150+ challenges: categorized according to each of our courses. Complete these challenges, secure your position in the global leaderboard and master C and Java on the go!
Introducing
]]>
https://www.programiz.com/blog/introducing-challenges-on-learn-c-and-java/612f0fdbd1e7a1055f350005Wed, 01 Sep 2021 07:42:48 GMT
Today, we are very excited to announce ‘Challenges’, now available on all of our learning apps! We have curated over 150+ challenges: categorized according to each of our courses. Complete these challenges, secure your position in the global leaderboard and master C and Java on the go!
Introducing Challenges on Learn C and Learn Java!
Introducing Challenges on Learn C and Learn Java
Get Challenges for C App

Get Challenges for Java App

What’s inside Challenges?

  • Challenges curated just for you, based on your progress and level of difficulty
  • 150+ practical programming challenges to test your knowledge in real-time
  • Earn points by solving problems
  • Compete and secure your position in the global leaderboard
  • Share your achievement with the world

What's in it for you?

Introducing Challenges on Learn C and Learn Java!

We all know programming isn’t something you learn only through theoretical knowledge or just from reading books. You learn programming when you apply practical approaches and solve problems. Dealing with problems practically helps you learn faster and eventually makes you a better programmer. And that’s where Challenges come into play.

With Challenges, you're given various sets of problems, which you must solve using your knowledge and reasoning skills. As you plan and debug your way through the problems, your mind learns, adapts and gets a little sharper.

It doesn't matter if you make some mistakes along the way, for mistakes are integral in enhancing your debugging skills. This, in turn, moulds you into being a more effective programmer.

But that's not all: you also get a chance to learn and compete with other users of our app! Put your skills to the test and see how you fare against others in the Global Leaderboard. And have some fun while you're at it.

Introducing Challenges on Learn C and Learn Java!
Earn points while competing for the top position

What's in it for us?

When we launched Challenges on Learn Python, we received huge support and positive feedback from learners all around the globe. This made it certain that Challenges were the way to go and our next goal was to make them readily available on all of our apps.

With the release of Challenges, it is safe to say we are much more aligned with our vision, and are one step closer in achieving what we have always envisioned.

Our vision for Programiz has always been about removing all barriers to learning programming. When we scaled to mobile devices, we became aware of tonnes of hurdles in learning to code through such a small form-factor.

However, we set to work and established a set of standards and goals in making learning possible through mobile. With each iteration, we worked on improving the content, accessibility, and interactivity of our app, ultimately providing users with a comfortable platform for coding. Our latest release of challenges definitely builds upon the notion of self-paced learning, interactivity and general availability of resources.

The feedback so far has been tremendous; knowing that we have had an impact on so many beginners is a humbling yet deeply fulfilling experience. This has made our journey really worthwhile, in spite of the many bumps on the road we have had to overcome to reach this point.


Celebrating with 75% discount

To celebrate this progress, we are offering a fantastic discount on both of our apps.

We are giving out a 75% discount on our yearly subscription of Programiz Pro. Get Programiz Pro for $7.49 (normally $29.99).


So what are you waiting for?

Get Programiz Pro on Learn C Programming and Learn Java and access 150+ challenges and many more today!

Save 75% on C App

Save 75% on Java App ]]>
<![CDATA[Learn Java: Programiz is FINALLY here!]]>
Need help starting out on Java? If your answer is Yes, you’ve come to the right place because we are here with the news you all have been waiting for! Introducing the most requested app of all time and the newest addition to the Programiz app gallery, Learn
]]>
https://www.programiz.com/blog/learn-java-programiz-released/60adf83fd1e7a1055f34fe99Thu, 27 May 2021 06:04:29 GMT
Need help starting out on Java? If your answer is Yes, you’ve come to the right place because we are here with the news you all have been waiting for! Introducing the most requested app of all time and the newest addition to the Programiz app gallery, Learn Java: Programiz; now available on your Play Store and Appstore!
Learn Java: Programiz is FINALLY here!
Presenting the Learn Java: Programiz App
Learn Java: Programiz is FINALLY here!

As a team, we value your feedback greatly and Learn Java is the product of your responses. We carefully assessed all your invaluable feedback through our website and apps, and incorporated the best of what we offer in Learn Java: Programiz.


What is Learn Java: Programiz?

For those who don't know, Learn Java: Programiz is an interactive app for all Java enthusiasts who want to learn Java for absolutely free! Designed carefully with coverage to all the fundamentals, loads of examples, interactive quizzes and an in-built code compiler, it is here to make your learning experience a lot more seamless.

Essentially, here's what you get with Learn Java: Programiz:

Learn Java: Programiz is FINALLY here!
Learn Java - The Best Of Everything
  • Highly curated Java lessons
    Java concepts are divided into thoughtfully curated bite-sized lessons that are easier for beginners to understand.
  • 150+ Practical Examples
    Tonnes of practical Java examples to get a better understanding of the core fundamentals.
  • Powerful Java compiler
    An in-built code editor and compiler that allows you to write and run code on your phone right from the very start.
  • Interactive Quizzes
    Test your knowledge on Java at the end of every chapter with hints and feedback.
  • Neat Bookmarks
    Bookmark topics that you find confusing or interesting and revisit them anytime when needed.
  • Save Your Progress
    Track your progress and continue from where you left off and sync it across devices.

  • No Distraction Mode

    Similar to our previous apps, you can get hold of an ad free experience right away with our Programiz Pro monthly/yearly subscription and surf through the app with no interruptions at all!

    Learn Java: Programiz is FINALLY here!
    Features of Programiz Pro

    With Programiz Pro, you get:

    • Ad-free mode
      No ads, no distractions.
    • Unlimited code compilations
      No limitations! Learn and play with your code compiler as much as you want.
    • Completion certificate
      Get certified at the end of the course.
    • Access any lesson anytime.
      Skip lessons and jump straight to your favorite lesson at any time.

    Following the Programiz tradition, we do have a Launch Sale that has already begun!

    The launch sale is live! We are giving a flat 50% discount on our yearly subscription. Get Programiz Pro for $14.99 (normally $29.99). Learn more.


    Get started with the all new Learn Java: Programiz app today! Make today the day you start your journey to the world of programming with us!

    If you have any problems or further suggestions, feel free to mail us at app@programiz.com.

    Download the app and master Java on the Go!

    Happy Programming :)


]]>
<![CDATA[Introducing "Challenges" on Learn Python app]]>You know what they say:

Practice makes perfect.

You can't learn to code just by knowing what it is. You need to practice to get the bigger picture of how programming really works.

The more you practice, the more mistakes you make. So, you dissect and tear through

]]>
https://www.programiz.com/blog/challenges-learn-python-app/601cba4d40e43d053ba452b7Fri, 05 Feb 2021 08:12:37 GMT

You know what they say:

Practice makes perfect.

You can't learn to code just by knowing what it is. You need to practice to get the bigger picture of how programming really works.

The more you practice, the more mistakes you make. So, you dissect and tear through your code to understand what's going on, and then modify it accordingly to correct your mistakes. That is how you learn to program quickly and effectively.

Introducing "Challenges" on Learn Python app
Introducing Learn Python: Programiz v3.0

Programiz Vision

Our vision for Programiz has always been to provide beginners an easy, informative and interactive experience to learn to program.

We have brought our vision to life through our learning apps. Since the first release of our apps, we have progressively added features that allow you to learn and try out what you have learned.

Real-world Examples and Quizzes

We added real-world examples on top of lessons for users to get comfortable with the code, read others' code, work out the logic and tweak their logic into the code. We added quizzes to let you test your knowledge so that you deeply understand the theory behind the language.

In-app Code Editor

Similarly, we added an in-app code editor and integrated it with lessons and examples so that you can run the code from the ease of your phone. The code editor allows you to play around with the code, make changes and essentially, get comfortable around coding.

All these additions have added up to the experience, and we hope it has helped you better yourself in the process.


Introducing Python Challenges

Today, we are introducing "Challenges" within our Learn Python app.

Once you know the basics, know how to write/run basic code and comfortably read code written by others, it's time to put in your efforts to practice. And that's where "Challenges" comes in.

Challenges give you the ability to put forward your knowledge and logical reasoning into code. We believe it's the best way to learn to code: by challenging yourself to complete a task.

In an effort to make this worthwhile, we've curated over 200+ challenges, sub-divided them into different topics and levels of difficulty so that you can get ample practice and master Python in the process.


Introducing "Challenges" on Learn Python app
Earn points while competing for the top position

What's inside Challenges?

  • 200+ practical programming challenges to test your knowledge in real-time.
  • Challenges curated based on your progress.
  • Earn points by solving problems.
  • See where you stand on the global leaderboard.
  • Share your achievement to everyone.

We genuinely believe "Challenges" will test your programming skills and help you build the necessary confidence in writing code as a beginner.

Starting today, "Challenges" is available to Pro users at no additional cost.

Happy programming!

Upgrade to Pro ]]>
<![CDATA[All-new Learn C Programming: Programiz app is finally here!]]>https://www.programiz.com/blog/learn-c-programming-app/5fbdac13e98fa304ed9b3df2Thu, 26 Nov 2020 01:16:17 GMT
Today, we are very excited to present the all-new “Learn C Programming” app with you. Get started on C Programming with curated lessons, practical examples, and interactive quizzes for free!
All-new Learn C Programming: Programiz app is finally here!
All-new Learn C Programming: Programiz app is finally here!

Learn C Programming: Programiz has been a long time coming as it has always been the most requested app of all. So, while we pushed out multiple iterations of Learn Python, our core team was also busy building an equally interactive app for C programming.

And after months of building, testing, and perfecting the app, it is finally here.


What is Learn C Programming: Programiz app?

For everyone familiar with our Learn Python app, Learn C Programming needs no introduction. It brings the best of Learn Python packaged into a powerful app catered for C Programming beginners.

All-new Learn C Programming: Programiz app is finally here!

Learn C Programming: Programiz is the go-to app for anyone who wants to learn C Programming. Whether you are a beginner with no prior programming knowledge or a professional, you can start programming in C from day one. Get digestible curated lessons with tonnes of examples and quizzes for free!

With Learn C Programming: Programiz, you get:

  1. Highly curated C lessons
    C programming concepts divided into thoughtfully curated bite-sized lessons easier for beginners to understand.
  2. 70+ Practical Examples 
    Tonnes of practical C examples to get a better understanding of the concepts.
  3. Powerful C compiler
    An in-built code editor and compiler that allows you to write and run code on your phone.
  4. Quizzes
    Test your C knowledge at the end of every chapter with feedback provided.
  5. Handy Bookmarks 
    Bookmark topics that you find confusing and revisit them anytime when needed.
  6. Save Your Progress
    Track your progress and continue from where you left off.

All-new Learn C Programming: Programiz app is finally here!

Distraction-free mode and more with Programiz Pro

Say goodbye to ads with our Programiz Pro monthly/yearly subscription and learn C programming distraction-free. Moreover, as with Learn Python, there are additional perks with the Pro subscription.

With Programiz Pro, you get:

  • Ad-free mode
    No ads, no distractions.
  • Completion certificate
    Get certified at the end of the course.
  • Unlimited code compilations
    No limitations. Learn and play with your code compiler as much as you want.
  • Dark mode
    Less stress on your eyes with our sleek dark mode.
  • Access to any lesson anytime.
    Skip lessons and jump straight to your favorite lesson at any time.
All-new Learn C Programming: Programiz app is finally here!
The launch sale is on!
We are giving a 50% discount on our yearly subscription. Get Programiz Pro for $14.99 (normally $29.99). Learn more.

What’s next?

With two apps under our belt, it is clear we are not stopping any time soon. We aim to bring even more programming languages to your phone, making your programming journey even easier.

Moreover, we have a lot of exciting additions planned for this app but, foremost, we want to hear more from you. Your feedback is essential to our progress. We plan to gather as much feedback and suggestions from you and build an app that enhances your learning experience.

So, what are you waiting for? Download our Learn C Programming: Programiz app, start coding, and leave us your valuable feedback.

Happy programming!

]]>
<![CDATA[Announcing APP+ By Programiz]]>https://www.programiz.com/blog/announcing-app-plus/5f504e3173dfac04f608143aWed, 09 Sep 2020 07:16:34 GMT
Today, we are excited to announce the launch of APP+ - Enjoy a truly distraction free learning for a nominal monthly or yearly subscription.

Note: Available both on iOS and Android.
Announcing APP+ By Programiz
Introducing APP+
Announcing APP+ By Programiz

With APP+, you get;

  • Ad-free mode
    No ads, no distractions.
  • Completion certificate
    Get certified at the end of the course.
  • Unlimited code compilations
    No limitations. Learn and play with our code compiler as much as you want.
  • Dark mode
    Less stress on your eyes with our sleek new dark mode.
  • Access to any lesson anytime.
    Skip lessons and jump straight to your favorite lesson at any time.
As part of our launch sale, we are giving a 50% discount on our yearly subscription. Get APP+ for $14.99 (normally $29.99) in the US and Rs. 1199 (normally 2399) in India. Learn more.

The update is rolling out to you as we speak. So, download the latest update and subscribe to APP+ now.

Upgrade to APP+

Who is it for?

APP+ is a must for all Python learners who want to get themselves certified while enjoying a distraction-free learning.

It is a combination of all your requests, suggestions and recommendations into making our app better.

However, we understand that not everyone would want this and that's fine. We still provide free access to our ad-supported Python Basics course, examples, bookmarking along with limited compiler usage.

Announcing APP+ By Programiz
APP+: Distraction Free!

What's in it for us?

We feel it is necessary for us to establish an answer to this upfront. There are two primary reasons we are choosing a subscription model:

  • Ad is not an answer
  • Subscription is a stable revenue stream to keep working on the app

Ads are distracting and intrusive no matter how much effort you put into it. There is a fine line between classifying ads as a necessary inconvenience and pure spam, and this varies per individual. So, needless to say, it is painfully difficult to get it just right.

This doesn't mean we haven't taken any actions. To make ads bearable for all, we have already switched to text-only ads and it has taken quite a heavy toll at our revenue when it's the only source.

Even then we get bombarded with emails reporting the content of the ads. Though we try our best to filter the ads, some of them still slip through, causing unnecessary discomfort to our users.

Plus, it's seasonality and dependence on someone else's goals has made us realize that ads are simply not the answer in the long run.

With a subscription model in place, we feel we are taking a step in the correct direction. Though subscription models are nothing new and makes us one of 'them', we feel this is actually a great way for us to have better control of our revenue streams and allows us to keep working on building great features for our app.


What's next?

Announcing APP+ By Programiz
What's next for Learn Python: Programiz?

Since the release of the Learn Python app last year, over 130k+ users have registered to our app and received consistently good ratings from you. This is a huge feat for us and certainly empowers us, our ambitions and plans moving forward.

We have received lots of love and support from you and would like to thank each one of you. Not to mention the countless suggestions you have had for us.

And, we are not stopping yet. Here are some of our plans going forward.

Confirmed Plans

  • Bite-sized Python Challenges to make your learning even more entertaining and interactive. These fun challenges will perfectly complement what you learn in the app and will push you to your limits.
  • Similar apps for C, Java and more - You asked for it. We are currently working on creating similar apps for C, Java and others in that order. We are nearly there but we are taking our time in making it the best learning experience for you.

In Discussion - Needs feedback

  • Community - This is something we've been planning for a long time now and have had different ideas about the execution. While we want to support open communities, we fear the size of our company will not be able to handle the amount of queries you might have. We don't want to provide under-par support to you, so we've been discussing paid communities.
  • Python based courses - Currently, we are only giving out the basics course in our app. We're looking to create similar Python based courses like Python: Advanced, Machine Learning with Python, Data Visualization with Python and such.

You'll see the confirmed plans bearing fruit in the coming months, and we would actively go through your suggestions and feedback into building the ones in discussion.

If you have any questions, head over to our FAQs page or leave a comment here or email us at app at programiz.com.

Happy learning and stay safe!

Upgrade to APP+ ]]>
<![CDATA[Binary Numbers and the Working of Computers]]>https://www.programiz.com/blog/working-of-binary-numbers-in-computers/5f366ff673dfac04f608134cFri, 14 Aug 2020 11:35:01 GMT

While possessing a vast knowledge of mathematics is not necessary to learn computer programming, it certainly helps to have a basic grasp of some of the foundational mathematics that makes computing possible. And what could be more fundamental to modern computing than binary mathematics?

The term 'binary' means something that has only two possible objects or states. In the binary number system, these two objects are the numbers 0 and 1. These two numbers can represent a variety of things.

For example, in computer logic, 0 represents "false" while 1 represents "true". Or they could be used to represent ordinary numbers as combinations of 1's and 0's. An example of this would be the representation of the numbers 0, 1, 2, 3, and 4 in three binary digits as 000, 001, 010, 011, and 100 respectively.

But what does this all mean at the fundamental level of computing? Why is the binary number system used as the foundation for all of our computing?

Perhaps it would be easier to understand all of this if we can understand the basic working of computers at the machine level.


0's and 1's: Interpreting the Workings of Computer Circuitry

computers operate on the electrical signals generated by these circuits. In order to design a computer that runs efficiently, we need a system that can interpret electrical signals in a simplified and effective manner.

A good way of doing this is to interpret electrical signals as binary values: 0 for a low voltage value and 1 for a high voltage value. An easier way of thinking about this is to imagine a light bulb. If the bulb is off, that state is interpreted as having the value 0. If it is on, it is interpreted as having a value of 1.

Binary Numbers and the Working of Computers
Interpreting Bulb States in Binary

This broad generalization reduces the range of interpretation of each electric signal into two distinct values, instead of an infinite range of continuous voltage values.

With this method of operating and interpreting electronic circuits in place, we can proceed to design coded systems based on the binary bits to aid in our computational tasks. These systems could be binary logic (restricted only to true or false values), base-2 number representation of numerical values, or using other systems that rely on a series of binary numbers to represent text, pictures, or sounds.

Essentially, our computers use a series of high-voltage and low-voltage electrical signals (binary values) to represent everything from texts and numbers to images and sounds. There are special electronic circuits, such as flip-flops and other circuits, that can "store" or retain these specific patterns of electrical signals for extended use.

For instance, one flip-flop may have a number of inputs that currently has a high voltage output (which we interpret as 1). Suppose the next two flip-flops have low-voltage outputs 0. We could combine these three outputs to get a value of 100, which in binary is the same as the number 4.

Understanding binary numbers can thus help us understand some of the fundamentals of computer operations at a sufficiently abstract level, even though our feeble human intellect might never allow us to understand the full complexity of computer operations.

And that is just as well, for working with simplified and abstract conceptions of computer operations is more than adequate for us students of computer science. In the sections that follow, we will take a brief look at some of the different ways computers use binary symbols to perform some of its most fundamental operations.

Boolean Logic: Using Binary Numbers to Understand Computer Logic

Computer programs use a very specific system of logic to carry out their instructions. This is known as Boolean logic, formulated by the English mathematician George Boole during the 19th Century.

Boole developed a system of arithmetical and logical operations that utilize the binary system of numbers. Boolean logic deals with only two possible values: true or false. True is represented by 1 and false is represented by 0. All logical operations result in only one of these two binary values.

Modern computers use this form of logic to make decisions all the time. These decisions result in our computers taking a particular course of action instead of another.

Binary Numbers and the Working of Computers
Decision-making in Computers

To realize how crucial this system is for computers, one need not look any further than the existence of Logical Operators in most programming languages: the AND, OR, and NOT operators.

These operators are directly taken from the AND, OR, and NOT operations from Boolean logic. And anyone with a cursory knowledge of programming knows that these operations are central to programming.

But the influence of Boole's work doesn't end there. In fact, many programming languages have a data type named boolean, which can only store either "true" or "false" i.e. 1 or 0.

These boolean variables and logical operators are fundamental components used in implementing conditional statements and control statements in programming languages. As a result, their importance cannot be overstated, since this is Programming 101.

There are also many other, more creative, and more sophisticated ways we can use binary numbers in programming languages. However, this blog post serves as a mere overview of some of the things binary numbers can be used for.

As such, we won't be diving into any technical programming details. Perhaps I will explore more of those topics in later blog posts. For now, let us just explore the simpler topic of numerical representations in computers.


Representing Numerical Values in Base-2

Numerical values are represented in our computer systems in some form of the base-2 number system. The normal numbers we use in everyday life is the base-10 number system. For instance, the number 135 gives us a value of one hundred and thirty-five.

Binary Numbers and the Working of Computers
Decimal Place Values

As we can see from the image above, each digit starting from the right side is multiplied by increasing powers of 10, starting with (10 ^ 0 = 1), then (10 ^ 1 = 10) and finally (10 ^ 2 = 100). The more the digits, the more the succession of powers of 10. This is the reason why this number system is called the base-10 number system.

The base-2 number system works in the same way, except that we multiply each bit (a binary "digit") with successive powers of 2. As an example, let us take the base-2 number 1011 and see what base-10 number it represents.

Binary Numbers and the Working of Computers
Binary Place Value

As we can see, the binary number 1011 is equivalent to the number eleven (11) in base-10.

Of course, the way binary numbers are grouped also matters. We know that 1011 represents the number 11 in base-10. But what if we grouped the same series of bits as 10 11? Are they two different numbers 10 and 11? Or are they a single number 1011?

This shows us the importance of the way we group our numbers. And in computers, the numbers are grouped in a lot of different ways. For instance, the integer data type int in C++ stores a single number in a series of 32 binary numbers. So the base-10 number 0 is represented by a series of 32 zeroes, while the number 1 is represented by 1 preceded by 31 zeroes to its left.


Textual and Character Representation

We have seen that the base-2 number system forms the basis of numerical representation in our electronic devices. And while this is true for systems of textual representation, their workings are quite different.

The most common systems for representing characters are ASCII (American Standard Code for Information Interchange) and Unicode (which is an extension of ASCII). These systems assign unique numeric values to characters and store them in binary format.

For instance, the ASCII system originally used 7 bits to represent a character. Currently, that has been extended to 8 bits. As an example, the character A is represented by a numeric value of 65 in ASCII. The binary for 65 is 1000001. Notice that the binary representation consists of 7 bits. In extended ASCII, this will be stored as 01000001 so that the total number of bits is 8.

Similarly, the ASCII code for the character a is 97, and it is represented by 01100001 in extended ASCII. There are also very special characters that are represented by 0, 1, 2 and so on. And they are represented as 00000000, 00000001, 00000010 and so on.

This system serves well for representing English and certain European characters and symbols, but it is woefully inadequate for representing symbols from languages across the world. In order to accommodate further symbols, Unicode was developed.

Unicode originally used 21 bits per symbol as opposed to the 7 bits originally used by ASCII. This greatly expands the range of values that can be used to represent characters. The original ASCII codes are accommodated within the Unicode system.

Currently, an encoding system based on Unicode, called UTF-8, is the most commonly used encoding system in web applications. The UTF-8 can use up to 32 bits per symbol, which means it can represent an even larger variety of characters.


Pixels and Images

Unsurprisingly, images are also frequently represented by numbers. In computers, images are most commonly made with the help of tiny colored squares called pixels. Think of a mosaic in real life: an image or pattern is made by combining together numerous small, colored pieces. Or a jigsaw puzzle, where we combine smaller pieces to create a bigger, complete image.

Pixels work in a similar way. Thousands of tiny colored squares make up the images that are displayed on our screens. There are many ways the colors in the pixels are coded, but the most commonly used code is the RGB code (Red, Green, Blue).

RGB codes work by combining red, green, and blue colors to produce all the shades of colors we see in our modern devices. Each of the three color components is codified by a number, whose values range from 0 to 255. Thus, there are three sets of numbers that describe a pixel.

As an example, let us consider the color represented by the RGB code (142, 150, 123). This color code has 3 components: Red = 142, Green = 150, and Blue = 123.

Inside our computers, each of these color components are represented by their binary equivalents using 8 bits, and then combined together. For example, the binary for 142 (Red component) is 10001110, the binary for 150 is 10010110, and the binary for 123 is 1111011.

Red = 142 = 10001110

Green = 150 = 10010110

Blue = 123 = 01111011

The computer combines these numbers from left to right to store the RGB code in its memory.

Complete RGB code = 100011101001011001111011

Binary Numbers and the Working of Computers
Working of RGB Code

Thus, we can see that even images are represented in binary. In fact, the knowledge of the binary codes of image pixels opens the doorway for fun little applications of image manipulation, such as hiding one image inside another. I have already written about a simple method of image hiding in my previous blog Steganography: Hiding Information Inside Pictures. You can check it out for an actual practical application of binary numbers in computer science.


Final Thoughts and Takeaways

Binary numbers form one of the core foundations of modern computing. And while we have briefly glanced over some of the ways our computers use binary numbers, we have left out a lot as well, since an exhaustive list of applications and explanations is beyond the scope of this blog.

That being said, we have covered quite a few interesting topics here, basic though they may be. We have seen that

  • physical activities of the computer circuitry are interpreted using binary notation i.e. in a single circuit, low voltage values are interpreted as 0 and high voltage values are interpreted as 1.
  • computers use Boolean Logic by interpreting 1 as true and 0 as false while performing logical operations.
  • numbers are represented in base-2 format in varying groups of bits according to the application (some numbers are represented by 16 bits, others by 32 bits, and some others by 64 bits).
  • characters and text are assigned unique numerical values, which are then converted to base-2 format in groups of either 7 or 8 bits (ASCII) or 32 bits (UTF-8).
  • images are represented by groups of tiny colored squares called pixels, each of which is coded in numbers that are eventually converted to binary

And that wraps up this blog, and I hope I have shed some light on why binary numbers are so important to computing.

]]>
<![CDATA[Psychoinformatics: Computer Science and Human Psychology]]>https://www.programiz.com/blog/psychoinformatics/5f23fddc781cae0521a6312eFri, 31 Jul 2020 11:34:28 GMTIntroductionPsychoinformatics: Computer Science and Human Psychology

For the first time in history, it is possible to study human behavior on a great scale and in fine detail simultaneously. “Psychoinformatics is an emerging discipline that uses tools and techniques from the computer and information sciences to improve the acquisition, organization, synthesis of the human psychological data.” Traditionally data collection in psychology always relied on two techniques: experiments and interviews or questionnaires. These methods are only applicable to a small number of audiences and in a controlled setting that can be easily manipulated and biased by the audiences.

To overcome these biases in traditional data collection, modern computer sciences introduced a new technique of assessing the behavior of the audiences. These techniques can help collect the data from a large group of audiences using computing devices which are largely concerned with implementing algorithms. For the collection of human psychological data, algorithms are widely used by mobile devices to analyze these data.

Psychoinformatics to study Human Behaviour

Over the past 20 years, there has been a significant development in the field of computer technologies. Technological advancement in computer science provides support for classical data collection methods such as interviews and questionnaires. They enable psychological data collection to be conducted and implemented from the mobile devices, allowing us to store and analyze large amounts of data at a very little cost which can boost the range of the experiments that can be conducted for data collection of human psychology and behavior.

Psychoinformatics experiments can be conducted several times per day over an extended period which generates a large volume of data points per user. Electronic sensors have improved significantly over the last few decades and pose another powerful technology for assessing human conditions and behavior. They can identify different human actions and measure them very precisely. For example, they can measure mood and cognition, stress level, hydration level, etc.

Similarly, some sensors can be ingested and can be used to observe the bodily functions of internal organs in the human body and collect data from them to predict potential diseases like cancers. They have become much more effective and cost-efficient in recent times. Sensors can send their data automatically to a server via a smartphone and portable handheld devices. Efficient processors and powerful batteries have dramatically reduced the need to charge sensors. These factors make it possible for zero or the low maintenance of data collecting sensors of the participant.

Psychoinformatics: Tech and Strategy

The concept of the Internet of things (IoT) has enabled our everyday machines to be smart and efficient. IoT is the system of interrelated computing devices that share data over a network without any human interaction.

Your microwave today is smarter than the desktop computer from a decade ago. It can now tell you when your food is ready, and when it needs maintenance. Besides, it can even send you messages and notifications. Every device nowadays produces a huge amount of data by documenting its actions. The storage and analysis of this data on a large scale are commonly referred to as Big Data. There is no causal relationship between data collection and its analysis; i.e. data is commonly analyzed to answer questions that were only vaguely known.

All these data are collected through human-machine interaction. This can sometimes lead to a dangerous situation by showing false-positive results. For example, Your fitness tracker can misjudge your slow bike ride as jogging, your smartphone can show you your stress level is astonishingly high even if it’s not.

There are still many possibilities for false-positive results from our smart devices. This makes correct mapping of human behaviors and actions quite tedious. These false-positive results are also considered as noise in terms of psychological data collection.

Therefore, results observed from multiple follow-up experiments of initial psychoinformatics data sets will be necessary. One good thing about this is, it is doable and affordable. Massive amounts of data are commonly collected without an immediate business case.

However, not knowing the later application scenario at the time of data collection might cause some problems. Scientists may not be able to anticipate whether or not the data will display patterns of interest or support a certain hypothesis.

The introduction of smartwatches and smart glasses has further enhanced the ability to track human behavior, mood, and actions. You might have heard the news of the Apple watch calling the ambulance during the time of heart attack. Additionally, recent advancements in miniaturization have made wearable sensors small and affordable enough for everyday use. While it is thus possible to track the user’s movements in the real world, we must also track online behavior. People spend a significant amount of their time interacting with Web applications, such as social networks, shopping sites, or online games.

Most of these services offer an interface that allows recording of our online activities such as, with whom we communicate, for how long, what we buy, at which time, and how much we enjoy fighting orcs with magic swords in computer games. Any such behavior might correlate with traits of personality, while reported changes might aid a clinical practitioner in treating a psychiatric disorder.

Challenges

The core challenge for Psychoinformatics lies in its interdisciplinarity. Neither psychology nor computer science can achieve this level of progress independently.

Psychologists cannot construct large-scale tracking systems to collect and manage the resulting data. Thus, they stand to benefit from methods of data modeling and mining. Ethical challenges like data privacy should be addressed; people participating in these psychoinformatics experiments should be comfortable sharing their data for research purposes.

Naturally, data privacy is a major concern and a more problematic issue arises when psychological findings are put to practice in big data applications. Applications might be able to deduce the personality traits of a particular user from their online behavior and they might have to face disgrace and dishonorable behavior from society.

On the other hand, it's difficult for computer science to correctly anticipate a large set of data. They need to relate those data with the correct human behavior.

Possibilities

Psychoinformatics is still in its infancy and may not even be recognized as such, the path ahead is laid out. Over the next decade, we will see numerous and massive research undertakings between human psychology and computer science.

Soon, the researchers will embark on numerous projects incorporating simple aspects of human-machine-interaction and wearable sensors. We will see an increasing number of research undertakings, residing evenly between computer science and psychology. Eventually, the focus will shift towards data analytics due to the high volume of psychological and behavioral data of a large number of populations. Big Data is about to revolutionize both psycho-sciences in research as well as therapy.

Once a large volume of data is analyzed and mapped with human psychology and behavior, there will be endless possibilities for the prediction of human mood, behavior, emotions, and actions and also can be used to treat the underlying psychological disorders of the board population. Therefore, psychoinformatics can create numerous possibilities for systematic study in human psychology.


]]>
<![CDATA[Tools That We Use At Programiz]]>https://www.programiz.com/blog/tools-we-use-at-programiz/5f114b95b1db3d7271cd18dfFri, 17 Jul 2020 07:29:42 GMT

Tools are an integral part of every company. Whether you are a startup in Silicon Valley doing some crazy stuff or you are an organization extracting oil in the Middle East, you need to use tools to make your work more efficient.

As the dictionary defines, tools are something that helps you do a particular task. So the software you use at Silicon Valley to communicate with others is a tool. And, the machine you use in the Middle East to refine crude oil is also a tool.

As for Programiz, we belong to the category of Silicon Valley. We are more of the software people. Being an online-based IT company, we are more dependent on the software. However, it does not mean we never use hardware. That would be inappropriate to say as software needs computers, which you all know is definitely hardware.

However, in this blog, I will be focusing only on the software tools that we use at Programiz. So let's get started.


Tools for Sustaining programiz.com on Internet

When it comes to sustaining our site on the internet, Programiz is dependent on three major tools for Domain Name, Web Hosting, and Content Management System.

1. Domain Name: NameCheap

The text programiz.com you see on the address bar of the browser is the domain name. Basically, a domain name helps to identify and access a website on the internet.

To use a domain name, the domain name has to be registered to the Domain Name System. For the domain name registration, you can find various websites on the internet. However, for our domain name, we have used NameCheap.

2. Web Hosting: DigitalOcean

When you type programiz.com on the browser, you will be able to see our site.

Tools That We Use At Programiz
Home page of Programiz.com

This is the service of web hosting. Web hosting allows a website to be accessible on the web. Various web hosting companies are present in the market that provide hosting services.

Basically, web hosting companies provide us storage to store our files and databases. Besides storage, they also provide RAM and CPU, so that all our users can access the files and databases of Programiz. For web hosting, we have used the service of DigitalOcean.

3. Content Management System: Drupal

A content management system is an application that helps to create and manage the digital contents (text, images, audio, video, and so on). As mentioned earlier, all these contents are stored in web hosting.

There are many CMS available right now. Here at Programiz, we have been using Drupal as our CMS.


Tools Used By Content Writing Team

Being a tutorial site, content is an integral part of Programiz. This is one of the reasons why we are so much focused on creating high-quality content.

In my previous blog post, I have shared an insight into the procedure of creating high-quality content. If you haven't read that already, make sure you check out the blog post at How we Create Great Content at Programiz.

Our content writing team is mainly dependent on 3 tools while creating content.

1. Tool For Content Research: Ahrefs Keyword and Content Explorer

Content research is an important part of content creation. Good research will help us understand our user behavior. It helps us know what information users are seeking and how they want the information to be presented.

For our content research, we have been using Keyword explorer and Content explorer tools from Ahrefs.

Tools That We Use At Programiz
Ahref's Keyword Explorer
Tools That We Use At Programiz
Ahref's Content Explorer

Besides, we also use different free tools as well. And, we are also getting lots of benefits using free keyword research tool.

2. Tools For Writing Content: Nirmaan and Google Docs

Previously we have been using Nirmaan, our inhouse content writing tool. Nirmaan allows us to write content in plain text format. It will then generate the HTML and JSON format of our content.

Tools That We Use At Programiz
Nirmaan: Inhouse content creation tool

Nirmaan has everything we need except for real-time collaboration. This is the main reason why we recently switched to Google Docs. Recently, we have been using Google Docs to write all of our content.

As mentioned earlier, the main reason for using Google Docs is its real-time collaboration and the built-in peer review feature. I don't want to dive deep into the rich functionality of Google Docs.

One such functionality has allowed us to create our inhouse Content Workflow System, another tool used by the content writing team.

3. Content Workflow System

Our inhouse Content WorkFlow System allows us to keep track of all our content.

Tools That We Use At Programiz
Inhouse Content Workflow System

A recent blog of ours has explained the engineering behind our CWS. Make sure you visit the blog Developing Content Workflow System at Programiz if you wish to make such a system in the near future.


Tools Used By Designer Team: Figma

Just creating high-quality content has never been enough for us. We want to provide a great experience along with our content. So with a goal to find a balance between aesthetics and usability, our designer team is continuously working to provide a whole different level of experience to our users.

Figma is the tool of choice among our designer team. The real-time collaboration feature and the minimality of the tool have helped our designer achieve our design goal at Programiz.


Tools Used By Developer Team

Now that we are expanding in the field of mobile applications as well, we have set up two different teams for Mobile Apps and Web Apps. Oftentimes both the team keeps collaborating with each other. However, the tools used by both teams are completely different from one another.

1. Tools Used by Mobile App Developer Team: Flutter and Codemagic

With the motto of Swipe, Learn, and Repeat, we launched our Learn Python app. Among the different options available, we chose to go with Flutter for developing our mobile app. The functionality of Flutter that allows us to create applications for different platforms is one of the reasons why we chose it in the first place.

Codemagic is another tool that our mobile app developers use regularly. Codemagic is a CI/CD (Continuous Integration/ Continuous Delivery) tool. It helps in efficient integration and deployment of the new build of the app to different environments.

2. Tools Used by Web Developer Team: VSCode and GitHub

When it comes to the web development team, there are no such specific tools that we use in Programiz. The tools keep changing depending on the requirements and trends.

When it comes to code editors, VSCode is our first choice. And for version control, we use Git and GitHub. Besides that, Python, JavaScript, and PHP are the programming languages, we use most often in Programiz.

3. Tools Used in Developing our Online Compiler: Docker and Kubernetes

Recently, we felt that just providing learning resources won't be enough to teach programming. So, we decided to provide an environment where our users can practice their coding skills. This is the main reason we decided to build our own online compiler.

Tools That We Use At Programiz
Programiz Online Compiler

Thanks to tools like Docker and Kubernetes, we are able to create a fast and beginner-friendly compiler. Basically, Docker is a container for an application that contains the full configuration of the environment that the code needs to be run in. And, Kubernetes is a container-orchestration system for deployment, scaling, and management of computer applications.

If you want to learn about the engineering behind our online compiler, visit the blog How We Built Our Online Compiler.


Tools Used By Marketing Team: Facebook Ad Manager

As mentioned earlier, we are focused on creating high-quality content which has resulted in lots of organic visitors to our site. That's why we never really thought about marketing.

However, we recently realized the power of marketing in business. Creating a great product is one thing and making people aware of it is another. This is why we started to market our products in recent times.

As for the tool itself, our marketing campaign is only based on social media. So, we have been using Facebook Ad Manager as our marketing tool. Facebook Ad Manager is an all-in-one tool to run and track ads on Facebook, Instagram, and Messenger.

Our blog on How We Use Psychology to Market Our Product gives you insight into our marketing campaign.


Tool Used For Communication: Microsoft Teams and Slack

Communication has been one of the Pillars of Programiz from the beginning. We treat communication as the backbone of our continual success. As I mentioned earlier, we are always in collaboration and teamwork. That is the main reason we consider communication is one of the important aspects of Programiz.

To ensure proper communication between all the members of Programiz, we have been using Microsoft Teams. Before Teams, we had been using Slack as our communication tool. However, we soon realized that Teams is the one our team feels comfortable with. Hence, we switched to Teams.


Tool Used For Project Management: Jira and Trello

Like Communication, Project Management is another important aspect of Programiz. Proper management is required for the efficient operation of our works.

We have been creating content, we have been developing mobile apps, we have been developing compilers, we have been marketing our products. We have been doing lots of work simultaneously. And, we knew from the beginning a project management tool is necessary. Otherwise, it will be chaotic to manually handle all the projects at once.

Initially, we had been using Trello as our project management tool. However, as our team started to grow, we soon realized that we needed something new. So we switched to Jira. Since then we have been using Jira to keep track of all our projects.


Besides all those mentioned above, one tool that I didn't talk about was G Suite. G Suite has been our business email tool. Thanks to it, we are able to use various other tools from Google like Google Drive, Google Docs, and so on for our business.

Final Words

Tools have been an important part of Programiz from the beginning. We use tools to develop content, we use tools to develop apps, we use tools to communicate. This is the main reason why we wanted to find a perfect tool for all our tasks.

It's not that all those tools we have been using are best in the market. It's just that they serve our purpose at the moment. And, in the future, if we find something better, then we are ready to give it a try. At last, you got to keep evolving, right?

]]>
<![CDATA[Mastering the Nepali Board Game of Bagh Chal with self-learning AI]]>https://www.programiz.com/blog/mastering-bagh-chal-with-self-learning-ai/5efeec25b1db3d7271cd15cfFri, 03 Jul 2020 13:22:42 GMT

People have long dreamed of creating machines that can think and decide for themselves. There have been countless Sci-Fi books and movies that exploit (and sometimes over hype) the term "Artificial Intelligence". This peculiar trait of the human mind — to imagine something well before it comes into existence — has itself led to many inventions and discoveries. Just a decade ago, the research on Artificial Intelligence was limited to only a few candidates pursuing higher degrees in Universities or big companies. The increase in computational power and data availability over the past few years, however, has made it possible for anyone with a decent computer to get started with Machine Learning (ML) and Artificial Intelligence (AI). This blog discusses one such personal project that I started working on almost a year ago. The project tries to use state-of-the-art methods in the deep reinforcement learning paradigm to master the traditional Nepali board game of Bagh Chal through self-play.

Instead of diving straight into the project, I want to take some time to introduce Artificial Intelligence and some of its relevant concepts. If you would like to skip these upcoming sections, directly refer to the Bagh Chal AI Project section.


Renaissance of Artificial Intelligence

When programmable computers were first created, they rapidly overtook humans in solving problems that could be described by a list of formal mathematical rules, such as crunching numbers. The main obstacle to computers and artificial intelligence proved to be the tasks that are easy for human beings but difficult to formalize as a set of mathematical rules. The tasks such as recognizing spoken words or differentiating objects in images require intuition and do not translate to simple mathematical rules.

We generally do not give our brain enough credit and are unaware of the extent to which our intuition plays a role in our everyday thinking process. To that, I want to start the blog with a perfect example that Andrej Karpathy gave in his blog back in 2012 that holds to this day.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
A funny picture

The above picture is funny.

What does your brain go through within fractions of seconds to comprehend this image? What would it take for a computer to understand this image as you do?

  • You recognize it is an image of a bunch of people in a hallway.
  • You recognize that there are 3 mirrors, so some are “fake” replicas of people from different viewpoints.
  • You recognize Obama from the few pixels that make up his face.
  • You recognize from a few pixels and the posture of the man that he is standing on a scale.
  • You recognize that Obama has his foot on top of the scale (3D viewpoint) from a 2D image.
  • You know how physics works: pressing on the scale applies force to it and will hence over-estimate the weight of the person.
  • You deduce from the person's pose that he is unaware of this and further infer how the scene is about to unfold. He might be confused after seeing that the reading exceeds his expectations.
  • You perceive the state of mind of people in the back and their view of the state of mind of the person. You understand why they find the person's imminent confusion funny.
  • The fact that the perpetrator here was the president maybe makes it even funnier. You understand that people in his position aren't usually expected to undertake these actions.

This list could go on and on. The mind-boggling fact is that you make all these inferences just by a glance at a 2D array of RGB values. Meanwhile, even the strongest of the supercomputers would not even come close to achieving this feat using today's state-of-the-art techniques in Computer Vision.

For the sake of this blog, let's start with something much simpler. Imagine that you are given a task to identify handwritten digits in a 28x28 image. How would you go about solving this problem? It might sound ridiculously easy at the start considering that even a small child introduced to numbers can get this correct almost every time. Even though this example is used as the typical "Hello, World!" program for people getting into Artificial Intelligence (especially deep learning), the solution to this problem is not as trivial as it first seems.

One obvious and non-machine learning approach would be to use handcrafted rules and heuristics on the shape of strokes to distinguish the digits. However, due to the variability of handwriting, it leads to a proliferation of rules and exceptions giving poor results. Some sample variants of the handwritten digits are shown in the following image.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
Sample Handwritten Digits From MNIST Dataset

So, how would we tackle this problem the ML/AI way?

Before we start talking about how to solve this problem, let's first understand how ML/AI differs from the plain old definitive programmatic or algorithmic approach. Machine learning refers to the concept that allows computers to learn from examples or experiences rather than being explicitly programmed.

Basically, we trade-off the hard-coded rules in the program for massive amounts of data. Mathematical tools in linear algebra, calculus, and statistics are cleverly used to find patterns in the data and construct a model that is then used for prediction. A training process occurs where the model is improved iteratively by evaluating the quality of its prediction. Over time, the model learns to correctly predict over the data that it has never seen before.

For instance, instead of using handcrafted rules to identify handwritten digits, we can show the computer a bunch of examples of how each digit looks like. It creates a model that learns from all these example data and over time learns to generalize the shape of each digit.

Creating a model, evaluating the performance of the model, and improving the model is a topic for another blog. However, let's have a quick glance at the sub-fields of machine learning.


The Sub-Fields of Machine Learning

Supervised Learning

Supervised learning is a type of machine learning in which the learning is done from the data having input and output pairs. The goal is to create a model that learns to map from the input values to the output.

It is called supervised learning because we know beforehand what the correct answers are. The goal of the machine learning algorithm is to learn the relationship between each input value to the output value by training on a given dataset. In doing so, the model should neither prioritize specific training data nor generalize too much. To avoid this, a larger training dataset is preferred and the model is tested using input values that the model has never seen before (test dataset).

This is better understood with an example. Suppose you're given the following dataset:

x 0 2 3 4
y 0 4 9 16

Let's put your admirable brain to use, shall we? Can you construct a mental model to find the function that maps x to y?

After quick speculation, you might have stumbled upon the function y = x2 that fits the dataset perfectly.

Now let's see how our hunch would have changed if we had access to only a portion of the dataset:

x 0 2
y 0 4

Here, both y = 2x and y = x2 are equally plausible answers. But we know that the actual answer is y = x2, and y = 2x is considered to be the underfit model due to less training samples. Our model would predict y = 6 for x = 3 while the actual answer is y = 9.

Let's look at some visualizations to clearly understand these concepts.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
Polynomial Curve Fitting

Here, the blue line shows the actual function and the purple line shows the prediction of the model. The blue circles represent the training set.

We can see that the last model correctly predicts all the training data (all points pass through the purple line). However, this model is said to be an overfit model (too specific to the training set) and it performs badly on the test set. Similarly, the first two models are said to be underfit models (too much generalization).

The third model is the best among these models even though it has a lesser accuracy than the overfitted model. The model can further be improved by using more training data as shown below.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
Less Training Data vs More Training Data

Supervised learning can further be divided into classification and regression.

Classification problems are related to making probabilistic estimates on classifying the input data into one of many categories. Identifying handwritten digits falls under this category.

Regression problems are related to predicting real value output in continuous output space. The above problem of finding the best-fit polynomial to predict output to its other input values falls under this category.

To learn more about supervised learning, visit Introduction to Supervised Learning.


Unsupervised Learning

Unsupervised learning is a type of machine learning in which the learning algorithm does not have any labels. Instead, the goal of unsupervised learning is to find the hidden structure in the input data itself and learn its features.

Some types of unsupervised learning include clustering, dimensionality reduction, and generative models.

Clustering is the method by which the input data is organized into clusters based on the similarity on some of their features and their dissimilarity with other clusters, despite having no labels.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
Clustering in Unsupervised Learning

Dimensionality reduction is used to convert a set of data in higher dimensions to lower dimensions. They can remove redundant data and only preserve the most important features. This pre-processing technique can reduce a lot of computational expenses and make the model run a lot faster.

The new unsupervised deep learning field has given rise to autoencoders. Autoencoders use deep neural networks to map input data back to themselves. The twist is that the model has a bottleneck as a hidden layer. So, it learns to represent the input in a smaller amount of data (compressed form).

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
Neural Network Architecture of Autoencoders

Generative modeling is a task that involves learning the regularity or patterns in the input data so that the model can generate output samples similar to the input dataset.

Since my project does not use unsupervised learning, we won't go into its details in this blog. Check out the following to learn more about unsupervised learning:


Reinforcement Learning

Reinforcement Learning (RL) is the type of Machine Learning where an agent learns how to map situations to actions so as to maximize a numerical reward signal from the environment.

The typical examples where RL is used are:

  • Defeat the world champion at Go
  • Make a humanoid robot walk
  • Play different Atari games better than humans
  • Fly stunt maneuvers in a helicopter

It also is the main component of my AI project that we later are going to discuss.

So what makes reinforcement learning different?

  • There is no supervisor, only a reward signal
  • Feedback may be delayed and not instantaneous
  • Agent’s actions affect the subsequent data it receives

At any time step, the agent in state S1 takes an action A1. Based on this action, the environment provides the agent with reward R1 and a new state S2.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
The typical framing of a Reinforcement Learning (RL) scenario

A reward is a scalar feedback signal which indicates how well an agent is doing. The agent's goal is to maximize the reward signal. For instance, in the example of flying stunt maneuvers in a helicopter,

  1. A positive reward may be given for following the desired trajectory.
  2. A negative reward may be given for crashing.

Major Components of an RL Agent

  • Policy: A function that defines the behavior of the agent.
  • Value function: The agent's understanding of how good each state and/or action is.
  • Model: The agent’s representation of the environment.

What makes the reinforcement learning problem so much harder is that the agent will initially be clueless about how good or bad its actions are. Sometimes, even the environment might be only partially observable. The agent has to perform hit and trial until it starts discovering patterns and strategies.

Moreover, the agent cannot act greedily on the reward signal. The agent has to learn to maximize the reward signal in the long term. So, sometimes the agent must be willing to give up some reward so as to gain more rewards in the long run. One such example would be to sacrifice a piece in chess to gain a positional or tactical advantage.

The exploration vs exploitation trade-off is the central problem in RL where the agent with incomplete knowledge about the environment has to decide whether to use strategies that have worked well so far (exploitation) or to make uncertain novel decisions (exploration) in hopes to gain more reward. To learn more about Exploration vs Exploitation and some solutions, visit Intuition: Exploration vs Exploitation.

Some classical solutions to the reinforcement learning problem are Dynamic Programming, Monte Carlo Methods, and Temporal-difference learning. You can visit RL Course by David Silver to learn more about reinforcement learning problems and solutions.

David Silver was the lead researcher on AlphaGo and AlphaZero.

AlphaGo was the first computer program to beat a professional human Go player and the first to defeat a Go world champion. It was first trained on professional human games and then learned to improve by itself. To learn more, read the AlphaGo Research Paper.

AlphaZero was an improved and more general version of AlphaGo that learned to play Go, Chess and Shogi without any human knowledge. It surpassed its predecessor and defeated AlphaGo 100-0 in 100 games of Go. To learn more, read the AlphaZero Research Paper. My self-learning AI project is also inspired very closely by AlphaZero.


Deep Learning

Numerous artificial intelligence projects have tried to hard-code knowledge about the world in formal languages. This approach is known as the knowledge base approach to AI. However, none of these projects have led to major breakthroughs.

Then, machine learning was introduced so that the AI systems could acquire their own knowledge from the data. The performance of these simple machine learning algorithms depends heavily on the representation of the data and the use of important features.

Imagine that we have developed a logistic regression model (regression for binary data such as True or False) to detect Diabetic Retinopathy (diabetes complication that affects eyes). To use this model, a doctor has to manually observe the retina image and put relevant pieces of information into the model, such as the number and type of retinal lesions (damaged regions) and where they appear in the image.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
Retina Image of a Person with Diabetic Retinopathy

If the model was directly given the retina image as shown above, rather than the formalized report from the doctor, it would not be able to make predictions. It is because the individual pixels of the retina image have a negligible correlation with the presence or absence of Diabetic Retinopathy.

Let's look at one more example where the representation of the data plays an important role in the performance of the ML model.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
Representation of data in Cartesian vs Polar coordinates

Here, it is impossible to separate the two sets of data in cartesian coordinates with a linear model. However, just changing the representation of data to polar coordinates makes this task an easy one.

For many tasks, it is actually very difficult to know what features should be extracted. Suppose we want to write a program that detects cars in images. Since cars have wheels, we might like to use their presence as a feature. However, it is embarrassingly difficult to describe wheels in terms of pixel values. Even though wheels have simple geometric shapes, the real-life images of wheels are complicated by shadows, glaring sunlight, masking of the wheels by other objects, and so on.

One solution to the problem of finding the right feature is representation learning. In this approach, the human intervention is further reduced by replacing the hand-designed features with learned representations by the model itself.

In other words, the model not only learns the mapping from features to the output but also learns to choose the right features from the raw data.

Whenever we go from one technique to another, we substitute one problem for another one. Now, the major challenge in representation learning is to find a way for the model to learn the features by itself. However, it is very difficult to extract high level, abstract features from raw data directly. This is where deep learning comes to the rescue.

Deep Learning is a type of representation learning where the representations are expressed in terms of other simpler representations. This allows the computer to build complex features from simpler features.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
Difference between Rule-based, Classical ML, and Representation Learning Systems

The quintessential example of a deep learning model is the multilayer perceptron that maps the input to the output. Let's look at an illustration of how a deep learning model learns to recognize complex patterns by building upon simpler concepts in the data.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
Illustration of how deep neural networks build complex representations from simpler ones

Even though each pixel value of the image has no correlation with identifying the object in the image, the deep learning model builds a hierarchical structure to learn representations. It first learns to detect edges that makeup corners and contours which in turn gives rise to the object parts. These object parts are then finally able to detect the object in the image.

The examples above are inspired by the ones in the Deep Learning book by Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Visit Deep Learning Book Website to read a free online version of the book. It is an excellent material to get started with Deep Learning.


Project Alpha BaghChal?

The motivation behind the project

Back in the summer of 2017, I had a few months break before starting my junior year in high school. At that point, I was not new to programming but I barely had any idea about Artificial intelligence (AI). I wanted to understand how chess engines like Stockfish (not an AI engine) work, but soon found myself in AI territory once I heard about AlphaZero. That instantly got me into ML/AI and I spent almost two years starting from scratch and working on smaller projects.

Inspired by AlphaZero, I thought of making a chess engine but the complexity of the game and the amount of training it would require set me back even before I got started. During my senior year, I tried making a similar engine as a science fair project but for a much simpler game of Bagh Chal. Even then, I had underestimated the difficulty of the project and the time scramble led to the project failure without yielding any results. I stopped working on it for a while until I finished high school and gave it another shot.

Before discussing how reinforcement learning and deep learning was used in the agent's architecture, let's first acquaint ourselves with the game of Bagh Chal. In the upcoming sections, I will also discuss how I built a game library and introduced game notations to record the moves for this traditional and somewhat obsolete game.


Bagh Chal

Bagh Chal is one of the many variants of the tiger hunting board games played locally in South East Asia and the Indian subcontinent. This ancient Nepali game shares many resemblances to other traditional games like Komikan, Rimau, and Adugo in terms of board structure and player objectives.

The strategic, two-player board game is played on a 5x5 grid. The pieces are positioned at the intersection of the lines where adjacent lines from the intersection define the legal moves for a piece.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
The initial board configuration for Bagh Chal where the tigers are placed at the four vertices of a 5x5 grid and 20 goats are outside the board.

Game Rules

The game completes in two phases:

  1. Goat Placement phase
    During the placement phase, twenty goats are placed one after the other in one of the empty slots on the board while tigers move around. Goats are not allowed to move until all goats have been placed.
  2. Goat Movement phase
    The movement phase continues with both players moving their corresponding pieces.

Pieces can move from their corresponding slot to other empty slots along the grid lines.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
The Moveable Goats can jump along the grid-lines to an empty slot.

Throughout the game, tigers also have a special Capture move, where they can jump over a goat along the grid lines to an empty slot, thereby removing the goat from the board.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
The Tigers can jump over a Goat to capture it.

This asymmetric game proceeds with tigers trying to capture goats and goats trying to trap tigers (without any legal moves). The game is over when either the tigers capture five goats or the goats have blocked the legal moves for all tigers. In some rare cases, tigers can also win by blocking all the legal moves for goats.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
Moveable Tigers and Trapped Tigers in Bagh Chal

Ambiguous Rules

The game can fall into a cycle of repeating board positions during the gameplay. To deal with these perpetual move orders that goats can employ to defend themselves from being captured, some communities have introduced constraints that do not allow moves that revert the game position to one that has already occurred in the game.

However, this restriction can sometimes prevent moves that are forced for bagh players or cause goats to make absurd sacrifices. The board positions are bound to reoccur in lengthy games where there have been no capture moves for a long time. Thus, declaring a winner on that basis is highly ambiguous.

For this project, this rule has been overridden by the standard "draw by threefold repetition" rule, where the recurrence of the same board position for three times automatically leads to a draw. The rule is rational as the recurrence of board position implies that no progress is being made in the game.


Creating Bagh Chal library (Game Environment)

Before working on the AI project, I had to prepare a Python Bagh Chal library to use the logic of the game and keep records of the board game states.

baghchal is a pure Python Bagh Chal library that supports game import, move generation, move validation, and board image rendering. It also comes with a simple engine based on the minimax algorithm and alpha-beta pruning.

Visit the GitHub baghchal Repository to learn more about this library.


Introducing Game Notation

Since Bagh Chal is a traditional Nepali board game, there was no recorded game dataset nor was there any way to keep track of the game moves.

So, I used two notations to record Bagh Chal games: PGN and FEN.

Portable Game Notation (PGN) is inspired by the game of chess. This notation consists of a full move history of the game, along with other information. The algebraic notation used makes PGN easier for humans to read and write, and for computer programs to parse the information.

The history of games is tracked by movetexts, which defines actual moves in the game. Each goat move and tiger move constitutes a movetext pair, where goat piece and tiger (Bagh) piece are represented by "G" and "B" respectively. Moves are defined in the following ways:

  1. Placement move: G<new[row][column]>
    For example: G22
  2. Normal move: <Piece><old[row][column]><new[row][column]>
    For example: B1122
  3. Capture move: Bx<old[row][column]><new[row][column]>
    For example: Bx1133

Note: Both the row and column position use numbers rather than an alphabet and a number like in chess because Bagh Chal has reflection and rotational symmetry, so the numbers can be counted from any direction.

At the end of the game, # is added along with:

  • 1-0 for Goat as the winner.
  • 0-1 for Tiger as the winner.
  • 1/2-1/2 for a draw.

The following PGN represents one entire Bagh Chal game:

1. G53 B5545 2. G54 B4555 3. G31 B5545 4. G55 B1524 5. G15 B2414 6. G21 B1413 7. G12 B1322 8. G13 B2223 9. G14 B4544 10. G45 B4435 11. G44 B5152 12. G43 B5251 13. G52 B3534 14. G35 B1122 15. G11 B3433 16. G25 B2324 17. G23 B3334 18. G41 B5142 19. G51 B2232 20. G33 Bx2422 21. G1524 B2223 22. G1122# 1-0

FEN (Forsyth–Edwards Notation) for Bagh Chal tracks only the current board position, current player, and the number of moves made. Even though it does not contain the full history of moves, it encapsulates enough information to continue the game from that point onwards and is helpful for shorthand representation of the board state. It consists of 3 fields:

  1. Piece location
    The piece location is given for each row, separated by "/".  Like PGN, "B" and "G" represent Tigers and Goats. The integers [1-5] represent empty spaces between the pieces.
  2. Player to move
    The player with next move, given by "G" or "B"
  3. Number of moves made by Goats
    This integer represents the number of half moves in the game. This is required to track the number of remaining and captured goats.

The following FEN represents the starting Bagh Chal board state:

B3B/5/5/5/B3B G 0

Prior Work on Bagh Chal

Bagh Chal is a relatively simple board game in terms of game tree complexity, compared to other board games like Go, Shogi, or Chess. The Bagh Chal programs found online use search algorithms based on variants of the Minimax algorithm such as Alpha-beta pruning to traverse the game tree.

Prior works have been done to evaluate the game under optimal play and even exhaustively analyze the endgame phase of the game using retrograde analysis. In their book called Games of No Chance 3, authors Lim Yew Jin and Jurg Nievergelt even prove that Tigers and Goats is a draw under optimal play.

My project, on the other hand, is inspired by AlphaZero, a general reinforcement learning agent by Google DeepMind. Instead of creating an agent that uses brute-force methods to play the game, the project takes a different route where the agent learns to improve its performance by continually playing against itself. It uses a single deep residual convolutional neural network which takes in a multilayered binary board state and outputs both the game policy and value, along with Monte Carlo Tree Search.

Let's look at what each of these terms means and how they fit into the design of AI architecture.


Design of the AI agent

Before proceeding, why not first look at the end performance of the Bagh Chal AI agent that we are going to design next?

The sections below assume that you know following topics. If not, visit the corresponding links to read about them in brief.

  1. Convolutional Neural Network (CNN)
    CNN is a type of neural network especially used in image recognition as it considerably reduces the parameters and makes the network more efficient. To learn more, visit A Comprehensive Guide to Convolutional Neural Networks.
  2. ResNets (Residual Blocks)
    It is difficult to train deep neural networks due to exploding or vanishing gradients. Residual blocks optimize the training of these deep networks by introducing skip connections in the network. To learn more, visit Introduction to ResNets.
  3. Monte-Carlo Tree Search (MCTS)
    MCTS a probabilistic and heuristic driven game tree search algorithm that combines tree search with reinforcement learning. After each simulation, it learns to selectively explore moves rather than applying brute-force methods. To learn more, visit Monte Carlo Tree Search.
  4. Batch Normalization
    Batch normalization reduces the covariant shift (amount by which values shift) in the units of the hidden layer. To learn more, visit Batch normalization in Neural Networks.

In the past, deep convolutional neural networks served as board evaluation functions for searching game trees. AlphaZero — the quintessential deep reinforcement learning agent for board games — takes this approach one step further by using Policy-Value networks and Monte Carlo Tree Search algorithm.

Similar to AlphaZero, the BaghChal AI agent's neural network fΘ(s) = (p, v) takes in the current board state and gives out two outputs, a policy vector pΘ(s) and a scalar value estimate vΘ(s).

  1. The scalar value v estimates the expected outcome of the game from the given position (which player is most likely to win from that point on). It represents the agent's positional understanding of the game.
  2. The policy vector outputs a vector of move probabilities p with components pa = Pr(a|s) for each action a. They serve as 0-ply strategies, since they do not perform any look-ahead and thus correspond to intuitive play, previously thought to be exclusive only to human players.
Mastering the Nepali Board Game of Bagh Chal with self-learning AI
The AI agent uses a Policy Value Network

A number of simulations are played out from the root (current position) to a leaf node, employing Monte Carlo tree search (MCTS) algorithm that utilizes raw output from the neural network to selectively explore the most promising moves. Evaluation from the MCTS are then used to improve parameters of the neural network. This iterative relation between the neural network and tree search allows the agent to start from the ground up and continually get stronger from self-play, after every iteration.

The network is initially set to random weights and thus, its predictions at the beginning are inherently poor. As the search is conducted and parameters are improved, the previous poor initial judgement of the network is overridden, making the agent stronger.

Note that the Monte Carlo Tree Search used in the Bagh Chal AI is not a pure MCTS where random rollouts are played once the search tree hits a leaf node. Instead, this random rollout is replaced by the value estimate from the neural network. Watch the AlphaZero MCTS Video Tutorial to learn about the complete Monte Carlo Tree Search Algorithm used in AlphaZero.


Network Architecture

As previously mentioned, the AI agent has a single neural network that has two heads: a policy and a value network.

The input is taken as 5x5x5 input stack which is different than in the AlphaZero architecture:

  1. The 1st layer represents the layer for Goat pieces (5x5 grid filled with 1 for presence of goat & 0 for absence of goat)
  2. The 2nd layer represents the layer for Tiger pieces (5x5 grid filled with 1 for presence of tiger & 0 for absence of tiger)
  3. The 3rd layer is a 5x5 grid filled with the number of goats captured.
  4. The 4th layer is a 5x5 grid filled with the number of tigers trapped.
  5. The 5th layer represents whose turn it is to play (filled with 1 for Goat to play and 0 for Tiger to play)

This input then goes through some residual blocks that have Convolutional, Batch Normalization and Activation layers. The neural network then branches off to two parts: one for policy network and the other for the value network. They both go through some fully-connected Dense layers.

The policy network outputs a 217 dimensional vector that represents all the moves that are possible in Bagh Chal at any point. It is a probability distribution for all moves and thus adds up to 1. It uses Categorical Cross-Entropy as the loss function.

The value network outputs a single scalar value between -1 (Represents Tiger player is winning) and 1 (Represents Goat player is winning). It uses Mean Squared error as the loss function.

All in all, the policy network combined with the MCTS helps in reducing the breadth of the tree search.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
The policy network reduces the breadth of tree search by exploring only few promising moves.

Similarly, the value network helps in reducing the depth of the tree search.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
The value network reduces the depth of tree search by returning the evaluation of a certain position. 

Training

For training, a number of games were played using the neural network employing MCTS and about 50 simulations for each move.

At the end of the game, 1 was awarded for Goat as winner, -1 was awarded for Tiger as winner and 0 for a draw. For all moves for that game, the value network was then trained to predict this number.

In MCTS, the most promising move is the one that was visited the most. So, the policy network was improved by training it to predict moves in proportion to the number of times the move was made in the simulation.

Similarly, the symmetry of Bagh Chal was used explicitly to populate the training set for each game.

Mastering the Nepali Board Game of Bagh Chal with self-learning AI
The Bagh Chal game has a rotational and a reflection symmetry.

Here, we can see that one game can produce eight times more training sample games.


Compromising the Tabula Rasa Learning

Although all of this seems to work in theory, I did not experience any improvements in the agent's play even with some training. My speculation is that it might have been caused by the asymmetry of the game. Bagh Chal is an asymmetrical game as each player has different objectives.

If we were to make random moves (similar to the performance of an untrained Neural Network), the probability of Tiger winning the game is larger than the game ending in a draw than Goat winning the game. When the tree search reaches a terminal state favoring a given player very few times, there may not be enough actual game environment rewards for the tree-search to correct any poor network predictions. Thus, the agent gets stuck in a local optimum.

Even though this problem is solved as the model gets trained more and more, I had to find other solutions due to hardware limitations.

I eventually decided to use a greedy heuristic in the training pipeline by initially training the agent on games generated by minimax algorithm with alpha-beta pruning on depth 4.


Results

After training the agent for some time, first greedily on minimax generated games and then by making it play against itself, the agent learns to pick up on the strategies that humans use in their own games. One of the strategies is to always occupy the board corners as the Goat player and maintain distance between the Tiger pieces as the Tiger player.

This trained agent was then used to play games against itself, where most of the games ended in a draw. This result was consistent with the prior study that proves the game as a draw under optimal play. About 10 percent of the time, however, the Goat player was able to snatch victory.

Though this Bagh Chal AI agent punishes even slight inaccuracies by human players, it is by no means perfect. Occasionally, when the agent played as Goat against human players, it made absurd sacrifices over and over again. This represents gaps in the learning domain of the agent. It means that the agent reached positions that it had never explored during its training, and hence had no clue about certain positions.

The AI agent could have been further improved by:

  1. More Experimenting with the hyperparameters of the neural network (Network structure)
  2. Using two separate networks for Goats and Tigers
  3. Tabula Rasa Learning
  4. More training

If you want to learn more about the project and play around with its code, you can find one early prototype of this project in the GitHub AlphaBaghChal Repository.


Final Words

One key takeaway from this blog is that the performance of the Artificial Intelligence project boils down to finding the right set of data to train on and choosing the correct hyperparameters to get an optimal learning process.

As the potential of Artificial Intelligence continues to grow by the day, its scope has also broadened to encompass many other fields. Even if you are new to Artificial Intelligence or programming in general, you definitely won't regret keeping up with the field of AI.

Below are some resources that will help you stay up-to-date with the recent developments in AI:

  1. Google AI Blog
  2. Two Minute Papers
  3. AI Trends

Below are some online resources to play around with interesting AI models:

  1. NVIDIA GAUGAN
  2. Tensorflow Neural Network Playground
  3. Teachable Machine
  4. CNN Explainer
  5. Quick, DRAW!
]]>
<![CDATA[Data Structures and Algorithms in Everyday Life]]>https://www.programiz.com/blog/dsa-in-everyday-life/5ee8b80cb1db3d7271cd1504Tue, 16 Jun 2020 12:45:32 GMTData Structures and Algorithms in Everyday Life

From the origin of the first programming languages to the modern programming languages currently in use, computer programming has evolved quite a lot. It has now become more powerful, efficient, and advanced. However, the fundamental concepts and use of data structure and algorithms in computer programming have not changed. DSA has been the core of computer programming from the beginning.

You might have heard DSA being used mainly in the field of computer science. However, the use of DSA is not limited to the field of computing. We can also find the concept of DSA being used in day to day life. In this blog, we will discuss the common concept of DSA that is used in everyday life. But before that, let's learn the basics of Data Structure and Algorithms first.

What is Data Structure and Algorithm (DSA)?

Data structure and algorithms is a branch of computer science that deals with creating machine-efficient and optimized computer programs. The term Data Structure refers to the storage and organization of data, and Algorithm refers to the step by step procedure to solve a problem. By combining "data structure" and "algorithm", we optimize the codes in software engineering.

DSA in Software Development

Data structure and Algorithm (DSA) is applied in all disciplines of software development. DSA is the building block of the software development process. It is not limited to a single programming language. Although programming languages evolve or get dormant over time, DSA is incorporated into all of these languages.

The efficiency of software development depends on the choice of an appropriate data structure and algorithm.

There might be cases when you are provided with the most efficient data structure to work with a robust algorithm. However, if the two are not compatible with each other, the code will not produce the expected outcome. Thus, selecting an appropriate data structure for an algorithm is an essential part of software development.

Take, for example, the imperial system of measurement used in the US. Why is it so dreadful? The US has been using measuring units like inches, yard, miles, ounce, and pound for measurements. If you need to convert a yard into inches, you have to multiply it by 36. However, in the metric system, you can simply multiply by 1000 to convert meter into kilometer. It is thus easier for the mind to do the conversion in the metric system. That is why most people find the imperial system to be inconvenient. Another example of this inconvenience is that "ounce" is used for solid or liquid depending on the context.

The ease of conversion from one to another metric is the most important factor here. In this example, we can compare the measurement systems (i.e. the metric system and the Imperial system) to "data structures", while the process of conversion from one unit to another can be thought of as the algorithm. This shows that choosing the right data structure has a great impact on the algorithm, and vice-versa.

Data Structures and Algorithms in Everyday Life
Data Structures and Algorithms in Everyday Life

Another critical facet of DSA usage in software development is the time and space constraints. These constraints check the availability of time and space for the algorithm. An optimized algorithm addresses both of these constraints based on the availability of resources. If memory is not an issue for the hardware, DSA focuses more on optimizing the running time of the algorithm. Similarly, if the hardware has both the constraints, then DSA must address both of them. You can learn more about the representation of these complexities on Asymptotics Analysis.

How can you relate DSA to your day to day life?

Let's dive into some of the examples of the usage of DSA.

Data Structures

Stack Data Structure to Reverse a String

A stack is a linear data structure, "linear" meaning the elements are placed one after the other. An element can be accessed only after accessing the previous elements.

We can visualize a stack like a pile of plates placed on top of each other. Each plate below the topmost plate cannot be directly accessed until the plates above are removed. Plates can be added and removed from the top only.

Each plate is an element and the pile is the stack. In the programming terms, each plate is a variable and the pile is a data structure.

Data Structures and Algorithms in Everyday Life

Why do we need a stack representation?

You might be wondering why a programmer needs to learn how to put a plate on a pile and take the plate out from the pile. Let's find the answer to it. You are assigned a task of reversing a string. How would you do it?

Data Structures and Algorithms in Everyday Life

Start selecting a character from the string and copy it into the new location one by one.

Data Structures and Algorithms in Everyday Life
Data Structures and Algorithms in Everyday Life
Data Structures and Algorithms in Everyday Life
Data Structures and Algorithms in Everyday Life

Now, let us copy these items from the top into the original location.

Data Structures and Algorithms in Everyday Life
Data Structures and Algorithms in Everyday Life
Data Structures and Algorithms in Everyday Life
Data Structures and Algorithms in Everyday Life

Great, we have successfully reversed a string using the property of stack (the new memory). Inserting and removing was only allowed from the top. This way stack is used in programming.

Queue Data Structure while Boarding a Bus

A Queue is also a linear data structure in which the elements are arranged based on FIFO (First In First Out) rule. It is like the passengers standing in a queue to board a bus. The person who first gets into the queue is the one who first gets on the bus. The new passengers can join the queue from the back whereas passengers get on the bus from the front.

Data Structures and Algorithms in Everyday Life

Why do we need a Queue representation?

You may ask where a queue is used on a computer. Assume that you are in your office and there is a network of five computers. You have connected all these computers to a single printer. Suppose an employee wants to print his documents and sends a command to the printer through his computer. The printer receives the commands and starts printing the documents. At the same time, another employee sends commands to the printer. The printer puts the second command to the queue. The second command is executed only after the execution of the first command. This follows the FIFO rule.

Graph Data Structure in Social Media and Google Map

A Graph is a network of interconnected items. Each item is known as a node and the connection between them is known as the edge.

You probably use social media like Facebook, LinkedIn, Instagram, and so on. Social media is a great example of a graph being used. Social media uses graphs to store information about each user. Here, every user is a node just like in Graph. And, if one user, let's call him Jack, becomes friends with another user, Rose, then there exists an edge (connection) between Jack and Rose. Likewise, the more we are connected with people, the nodes and edges of the graph keep on increasing.

Data Structures and Algorithms in Everyday Life

Similarly, Google Map is another example where Graphs are used. In the case of the Google Map, every location is considered as nodes, and roads between locations are considered as edges. And, when one has to move from one location to another, the Google Map uses various Graph-based algorithms to find the shortest path. We will discuss this later in this blog.

Data Structures and Algorithms in Everyday Life

Algorithms

Sorting Algorithm to Arrange Books in the Shelf

In simple terms, sorting is a process of arranging similar items systematically. For example, suppose you are arranging books on a shelf, based on the height of the books. In this case we can keep the taller books on the left followed by the shorter books or we can do vice versa.

Data Structures and Algorithms in Everyday Life

This same concept is implemented in Sorting algorithms. Different sorting algorithms are available in DSA. Although the purpose of every algorithm remains the same, each algorithm works differently based on various criteria.

In the above example, if we want to sort the books as fast as we can then there are few points to be considered.

  • Can the books be easily shuffled on the shelf? If the books are heavy, it may take us more time. Similarly, there may be other constraints. (accessibility)
  • What is the number of books? (data size)
  • How fast can we access them? (hardware's ability)

Algorithms are built considering all these constraints to produce an optimal solution. Some of the examples of these algorithms are Bubble Sort, Selection Sort, Merge Sort, Heap Sort, and Quick Sort.

Searching Algorithm to Find a Book in a Shelf

Searching, as its name suggests, helps in finding an item.

Suppose you want to search for a specific book on a shelf. The books in the self are not arranged in a specific way. If you need to find the book in the shortest possible time, how would you do that? The solution to this is provided by DSA.

You may be thinking "I will look for the book from the beginning and locate it". In this case, you will be searching for books one by one from the start to the end of the shelf. This same concept is implemented in Linear Search.

But, what if the book is at the other end of the shelf? The above process might take a long time and will not provide a feasible solution.

Now, let's try another procedure. Firstly, sort the books in ascending alphabetical order then search for the book in the middle. We are searching for a book that starts with J.

Data Structures and Algorithms in Everyday Life

Since we are always looking at the middle position, the middle position between A and Z is M, not J.

Data Structures and Algorithms in Everyday Life

Now, compare J with M. We know that J lies before M. So let's start searching for J in the middle position of A and M. G is the mid element, again J is not found.

Data Structures and Algorithms in Everyday Life

Since J lies between G and M, let's find the mid element between them. Yeah, we have found J. Congratulations!!! ?.

Data Structures and Algorithms in Everyday Life

And, you have just implemented Binary Search.

Shortest Path Finding Algorithms to Find the Shortest Path in Google Map

Have you ever thought about how Google Maps is able to show you the shortest path to your destination? Applications such as Google Maps are able to do that using a class of algorithms called Shortest Path Finding Algorithms.

These algorithms deal with finding the shortest path in a graph. As in the example discussed in the Graph data structure above, we can use graph algorithms to find the shortest path between two given locations on a map.

To illustrate the problem, let's find the shortest distance between A and F in the following map.

Data Structures and Algorithms in Everyday Life

What are the possible solutions to this problem? Let's figure out the possible routes along with their path length.

Data Structures and Algorithms in Everyday Life
Data Structures and Algorithms in Everyday Life
Data Structures and Algorithms in Everyday Life
Data Structures and Algorithms in Everyday Life

We can see that the shortest path is Path-3. But, we have wasted time calculating other paths as well, which we are not going to use. In order to solve this problem without wasting time, we can start from A and check for the possible shortest neighboring paths (AC and AB). We have AC as the shortest path.

Data Structures and Algorithms in Everyday Life

Now we are at C, again select the shortest path among its neighboring paths CE and CD, which is CD.

Data Structures and Algorithms in Everyday Life

From D, we have a single path to F. From D, we can go to B as well but, B is already visited, so it is not considered. Select the path DF and we reach the destination.

Data Structures and Algorithms in Everyday Life

Congratulations one more time?. You have implemented Dijkstra's Algorithm. In this way, the graph finds its use in our life.

Takeaway

When I was in the final year of my undergraduate studies and applying for software engineering positions, there was one thing common between the hiring procedure of all companies. They all tested me on problems that involved the use of data structures and algorithms. DSA has great importance in the recruitment process of software companies as well. Recruiters use DSA to test the ability of the programmer because it shows the problem-solving capability of the candidate.

As you can see from the above examples, we are able to relate DSA with our day to day life and make it more fun to study. For those who are from non-technical backgrounds, they can also learn the techniques used in the algorithms for solving their daily problems.

Furthermore, one cannot neglect the importance of DSA in any programming language. DSA never gets extinct, rather it is evolving because the evolving computers, in the 21st century, need evolving algorithms to solve a complex problem.

Not to mention, a programmer should know how to use an appropriate data structure in the right algorithm. There is a famous saying:

A warrior should not just possess a weapon, he must know when and how to use it.

Best wishes to all the new programmers out there. Start your learning from today.

]]>
<![CDATA[Steganography: Hiding Information Inside Pictures]]>https://www.programiz.com/blog/steganography-hiding-information-inside-pictures/5ed65ed2b1db3d7271cd1464Wed, 03 Jun 2020 05:14:41 GMTSteganography: Hiding Information Inside Pictures

Secrets and intrigue need not be limited to flashy spy movies and novels such as the James Bond or the Jason Bourne franchises; one can hide information inside a small, simple image by using binary numbers.

Binary numbers consist of 0's and 1's, and they are part of a number system known as the binary number system or base-2 numbers. The number system we commonly use is known as the decimal number system or base-10 numbers.

I'm sure anyone reading this blog is familiar with number systems, since they're such a fundamental part of computing. They're also a fundamental component of the process of hiding information inside images.

Of course, I'm not claiming that I'm an expert on this subject; far from it, actually. Calling me a rookie in this field would be an injustice to actual rookies in existence, but I can say that I know the basic principles behind a single, simple algorithm.

Exploring this algorithm might perhaps provide you with the motivation to further pursue the complexities of this field (as I intend to do myself). And should we choose to do so, our knowledge and experience with binary would increase as a consequence as well, which will come in handy in being creative with programming languages.

But before diving into this exciting field, I should first begin by crediting the original source that inspired the creation of this blog post:

The algorithm we're going to discuss is based on the excellent online course offered by Goldsmiths, University of London at the online learning platform of Coursera. The course is called "Mathematics for Computer Science" and you can find its link here:

https://www.coursera.org/learn/mathematics-for-computer-science/

Step 1: Understanding Pixels and Images

Before embarking on the valiant quest of coding images with secret messages, we first have to understand the nature of how images are represented in computers. And it all starts with "pixels".

Pixels can be thought of as the smallest unit that constitutes an image. It is, in essence, a small colored square that is combined with other colored squares (i.e. other pixels) in order to complete an image.

Think of each pixel as a piece of a large jigsaw puzzle, and arranging them together produces an image. Of course, if pixels are just randomly assembled without any forethought or planning, then the end result is more than likely to be a jumbled, visual mess (otherwise known as "modern art").

Tasteless jokes and attacks on artistic expressions aside, the important thing about pixels is that they're represented by numbers. These numbers can be in the form of RGB codes (Red, Green, Blue), hex codes (hexadecimal codes), HSL (Hue, Saturation, Lightness), or some other code.

Take RGB color code as an example. In this color scheme, we combine the colors red, green, and blue to form all the different shades of colors we can see in our devices.

Each individual color value of red, green, or blue ranges from 0 to 255. For example, for printing the purest version of the color red on our screens, we use the RGB value of rgb(255, 0, 0).

Here,

  • Value of Red = 255 (i.e. the maximum possible contribution of red to the pixel)
  • Value of Green = 0 (i.e. the minimum possible contribution of green to the pixel)
  • Value of Blue = 0 (i.e. the minimum possible contribution of blue to the pixel)

Similarly, for printing the purest version of green, we use the code rgb(0, 255, 0), and for the purest blue, we use rgb(0, 0, 255).

To print black, we set all the values of red, green, and blue to 0 (since black is actually an absence of other colors).

To print white, we set all the values of RGB to 255 (since white is the combination of all colors).

Intermediate values for RGB are used to produce colors of almost all hues that our eyes can see.

As for hex codes, they can be derived by simply converting the RGB codes into the hexadecimal number system.

The main takeaway here is that colors are represented by numbers. These numbers - like all numbers we know - can be converted to binary. And hiding a message inside images often involves manipulating the least significant digits of these binary numbers.

Now let us proceed to the next step: creating a simple image with 4x4 (16 pixels) and modifying it to hide random numbers in it.

Step 2a: Hiding Random Numbers Inside an Image

Let us consider a very simple, rudimentary image below.

Steganography: Hiding Information Inside Pictures
Original Image with no hidden message

This image consists of 16 pixels of different colors and hues and is arranged in a 4x4 format i.e. it has 4 rows and 4 columns.

We will hide numbers that can only be represented by 3 binary digits i.e. the numbers 0-7.

[Note: Binary digits are more popularly known as "bits"]

Why use only 3 bits, you might ask? Because RGB codes only allow for 3 distinct numbers (that of red, green, and blue). And we hide each binary bit of our hidden number in the least significant bit of each RGB value.

Let us take an example for more clarification. Suppose we want to hide the number "6" in the first pixel of the image. The RGB code for the first pixel is rgb(144, 56, 17).

We first convert the RGB values into binary. So,

Color Value in Decimal System Value in 8-bit Binary System
Red 144 1001 0000
Green 56 0011 1000
Blue 17 0001 0001

The binary equivalent of 6 (the number we want to hide) is 110. We hide the left-most bit of 110 (i.e. 1) in the right-most bit of the binary value for red.

So,

Red = 1001 0001 (originally 1001 0000) = 145

Similarly, the bit in the middle (i.e. another 1) is hidden in the right-most bit of the binary value for green.

i.e. Green = 0011 1001 (originally 0011 1000) = 57

And finally, the right-most bit of 110 (i.e. 0) is hidden in the right-most bit of the binary value for blue

i.e. Blue = 0001 0000 (originally 0001 0001) = 16

This results in our coded pixel to be rgb(145, 57, 16).

Let us compare the two pixels: the original with no coded number, and the modified one coded with the number "6".

Steganography: Hiding Information Inside Pictures
Original pixel (left) vs Coded pixel (right)

As we can see, the two pixels are extremely similar to each other, and the casual eye is highly unlikely to discern a difference between the two.

We repeat the same process with the next 15 pixels, and the end result is a modified image that looks nearly identical to the casual eye.

Steganography: Hiding Information Inside Pictures
Original image (no hidden message) vs Coded image (contains hidden message)

The two images look nearly identical. However, we know that they are subtly different due to the subtle modification to the RGB codes of each pixel.

The image below shows both the original image along with the RGB values of each pixel:

Steganography: Hiding Information Inside Pictures
Original image along with the RGB codes of each pixel

Step 2b: Decoding the Coded Image

In order to retrieve the message hidden in our coded image, we simply reverse the process that led to it being coded in the first place i.e.

  • Retrieve the RGB code of each pixel.
  • Take the binary equivalent of the red, green, and blue values of each RGB code.
  • Choose the rightmost bit of the red, green, and blue binary values and combine them.
  • Convert the resulting binary number into its corresponding decimal number.

The image below shows the coded image with the corresponding RGB values of each pixel:

Steganography: Hiding Information Inside Pictures
Coded image with RGB codes of each pixel

Decoding the image will give us the numbers:

6420135702467531

Note: If we examine the above image and this simple algorithm a bit closer, we can clearly see that if a component of the RGB code is an even number, then that number corresponds to the binary number 0, whereas an odd number corresponds to the binary number 1.

To clarify this point further, let us look at the RGB codes of two random pixels, say the pixels in row 1 column 3 (let us call it R1C3) and row 3 column 4 (R3C4).

For Pixel R1C3,

Red = 18 (even) ----> 0

Green = 113 (odd) ----> 1

Blue = 8 (even) ----> 0

Combining these numbers from red to blue, we get 010, which is the binary code for 2.

When we check the secret message, we find the number 2 in the same position represented by the pixel (see the secret message above or the image of the final solution below).

Similarly, for Pixel R3C4,

Red = 247 (odd) ----> 1

Green = 169 (odd) ----> 1

Blue = 158 (even) ----> 0

Combining these numbers from red to blue, we get 110, which is the binary code for 6. And that is indeed the correct solution.

This insight is important because it can greatly shorten the time spent on decoding the image, since this means we don't need to convert the RGB codes to binary. Instead, we only look at whether the number is even or odd and assign the values accordingly. Then we convert the final, decoded binary number to decimal.

So, instead of 4 total number conversions per pixel (3 decimal-to-binary for red, green, blue; and 1 binary-to-decimal for the final decoded binary message), we only need to perform 1 number conversion (decimal-to-binary) per pixel.

The secret message (along with its containing pixel) is represented by the table below:

Steganography: Hiding Information Inside Pictures
Messages (numbers) hidden inside the coded image

It is important to note that I have not intended for the secret numbers used here to represent any coherent message. They are merely random numbers intended to serve as an example.

However, let me stress that I have adapted this example straight out of the Coursera course (by the University of London & Goldsmiths) I credited to earlier.

The numbers can actually be secret representations of alphabets and characters if one uses the code table used by the instructor there. In our case, though, the above message is merely a random sequence of numbers.

So I highly suggest you visit and explore that online course for better insight.

Step 3a: Hiding an Image Inside Another Image

We can take our coded mischief further and actually hide an image inside another image. In this case, we manipulate the last 4 binary bits of an RGB number to hide the color code of an image.

Let us take the same initial image we took in our example for hiding messages. As before, the picture below shows the image with its corresponding RGB codes

Steganography: Hiding Information Inside Pictures
Original image along with the RGB codes of each pixel

Suppose we wish to hide the image below inside the original image:

Steganography: Hiding Information Inside Pictures
Hidden image along with the RGB codes of each pixel

This image is a simple 4x4 image that only consists of two colors: blue and white. The RGB code for the blue color is rgb(0, 154, 255).

The code for white is, of course, rgb(255, 255, 255).

Now, let us take the first pixel of the original image and the first pixel of the hidden image.

Color Original Pixel Hidden Pixel Original Binary Hidden Binary
Red 144 0 1001 0000 0000 0000
Green 56 154 0011 1000 1001 1010
Blue 17 255 0001 0001 1111 1111

Notice the parts of the binary codes in the above table that have been made bold: we replace the last four bits of the binary code of the original pixel by the first four bits of the binary code of the hidden pixel.

Steganography: Hiding Information Inside Pictures
Pixel replacement method to hide an image within another image

We repeat the same process for the remaining pixels. The resulting image, along with the RGB codes of each pixel, will be:

Steganography: Hiding Information Inside Pictures
The coded image along with the RGB codes of each of its pixels

Step 3b: Retrieving the Hidden Image

We now retrieve the hidden image by reversing the process outlined in Step 3a. However, as we shall see very soon, this process is not perfect and does not retrieve the hidden image with the same exact pixel information of the original hidden image.

Steps for Image Retrieval

  • Find out the RGB code of each pixel and convert them to binary.
  • Take the last four bits of each of the red, green, and blue codes, and add four 0's at the right of those bits.
  • This gives the red, green, and blue codes of the corresponding pixel of the hidden image.
  • Repeat this process for all other pixels to retrieve the full hidden image.

This process is summarized by the graphic below.

Steganography: Hiding Information Inside Pictures
Method to retrieve pixels from coded images

Let us take the first two pixels of the coded image and retrieve the corresponding pixels of the hidden image.

Retrieving the First Pixel

Color Coded Pixel Coded Pixel Binary Retrieved Pixel Binary Retrieved Pixel
Red 144 1001 0000 0000 0000 0
Green 57 0011 1001 1001 0000 144
Blue 31 0001 1111 1111 0000 240

Hence, the first pixel of the hidden image we've retrieved has the RGB code rgb(0, 144, 240).

Notice that the RGB code we've retrieved is not the same as the RGB code we first used to create the hidden image in its original form. The RGB code of the first pixel of the original hidden image was rgb(0, 154, 255).

However, both these color codes produce very similar shades of blue. So this algorithm might not be perfect, but it gets the job done, for the most part.

Retrieving the Second Pixel

Color Coded Pixel Coded Pixel Binary Retrieved Pixel Binary Retrieved Pixel
Red 159 1001 1111 1111 0000 240
Green 223 1101 1111 1111 0000 240
Blue 239 1110 1111 1111 0000 240

Hence, the second pixel of the hidden image we've retrieved has the RGB code rgb(240, 240, 240). Like the first pixel, this pixel is also not an exact match to the RGB code of the hidden image we had first created. The one we retrieved is a shade of gray, while the original pixel was pure white.

Once again, this shows that the process is not perfect, but it is more than enough to retrieve the hidden image in shades that are very similar to the one we originally used.

The final, retrieved hidden image - along with the RGB codes of each of its pixel - is shown below:

Steganography: Hiding Information Inside Pictures
The final, retrieved image with the RGB codes for each of its pixels

Hence, we've finally extracted the hidden image that was concealed inside another image.

Final Thoughts and Takeaways

  • Pixels are the smallest units through which images and graphics are displayed in computers and other electronic devices.
  • The color of a pixel is determined by a numbered code, some of which are RGB, HEX, and HSL.
  • Thus, steganography requires basic knowledge of number systems such as the binary and decimal number systems (and also hexadecimal number systems, which we didn't discuss in this blog).
  • We mostly use RGB codes for the particular algorithm discussed in this blog, and convert them to binary to manipulate them and hide messages.
  • Only the least significant bits of the RGB codes are manipulated in this algorithm.
  • Hiding an image inside another image can turn out to be a somewhat imperfect process.
  • The algorithm (and approach) discussed here is specifically taken from an online Coursera course by Goldsmiths, University of London, called Mathematics for Computer Science. Please visit the course for more rigorous and in-depth content.
]]>
<![CDATA[How We Built Our Online Python Compiler]]>https://www.programiz.com/blog/online-python-compiler-engineering/5ed63c73b1db3d7271cd1382Tue, 02 Jun 2020 15:09:45 GMT

At Programiz, we're all about removing barriers that beginner programmers face when learning to code.

One of those barriers is the lack of a computer to program on. I was lucky enough to have access to a computer at an early age and grow my interest in them, but most people don't have that access.

In my own country Nepal, many people in the poorest parts of the country still don't have access to computers. Forget about personal computers, most students don't even have access to computer labs.

That's when I asked myself, what if ubiquitous smartphones that have penetrated even the poorest parts of the world could become computer labs? What if anyone could just enter a URL on a browser and start writing if statements and for loops?

I found some online compilers that are free to use and fulfill the purpose. However, there exists a problem with them. The problem was with the user experience. They are all bloated pieces of software trying to become full-fledged IDEs on the browser. There are just too many buttons: Run, Debug, Save, Execute, Share: which should I press?

The Programiz team decided to create our version of a mobile-friendly online compiler experience. This post is about the engineering that went behind the mammoth task of putting a Python shell on the public internet.

Approach 1: Spin Docker Containers on the fly

Our first approach was naive: to compile and run the user-submitted code in a Docker-based sandbox. Docker is a container for an application that contains the full configuration of the environment that the code needs to be run in. It leverages virtualization and builds layers over the OS Kernel to provide a consistent language to describe how to build your application.

For instance, if you want to host an Nginx server on an ubuntu system and copy over your static file to it, the relevant Dockerfile would look like:

FROM nginx:alpine
COPY . /usr/share/nginx/html

The Dockerfile that we wrote starts with an ubuntu image, installs all the programming languages we need to run in the compiler, and then starts a node server on it.

One thing to note about Docker and Dockerfiles is that this was the beginning of wide adoption of Infrastructure-as-code, where you can completely define the environment in which a piece of code needs to be run through code, transfer it to a completely different OS and expect it to just work.

Think of a Docker image as the sheet music of a song for any instrument, say a piano. If you gave the same sheet music to 100 different pianists, each would play the same notes but wouldn't sound exactly the same. A Docker container effectively packages the instrument along with the sheet music so that it always sounds the same.

How We Built Our Online Python Compiler
The Docker Engine builds an abstraction layer above the OS Kernel that allows efficient sharing of OS resources.

Virtual Machines could also do that, but as you can see from the diagram above, by having multiple containers share the same host OS, Docker containers solved many of the resource-related issues from the Virtual Machine days.

The initial version of the code sandbox we built was similar to the Nginx Dockerfile you saw above. A node.js script would expose an API for running programs. When the API was hit, it would spin up a Docker container with Python installed, run the code inside it and return the result. The communication between the docker container and the node server would happen through mounted volumes, a feature in Docker that allows Docker to share common resources (files in this case) with the host OS and with other Docker containers.

How We Built Our Online Python Compiler
Docker images are very fast to create, booting up in 2 seconds or less.

This solution would have been good enough if we were using it in a Python course that was behind a paywall. But our goal was to put a Python shell out in the open. It would be extremely costly to run so many containers on the fly.

If you're wondering, "Won't that be slow?". Well… not really. Container boot times are extremely fast these days and for most use cases, this would be good enough. We still run an online R compiler on our product datamentor.io that uses this approach and it's never been a problem. But we never had the confidence to put the R compiler we built with this approach for public use without a paywall. That had to change.

Approach 2: Prewarmed docker containers

We wanted our online compiler to be zippy, not just fast. So even the tiny amount of boot time for on-the-fly docker containers was a no-no.

Even if creating the image of my node server from a Docker image just took 1 to 2 seconds, that's a lot of time for a user who wants to run his program and get the results. We decided to run a cluster of running docker containers that would be ready to accept programs.

An HTTP request to a microservice would return the URL of a container from a list of 45 containers running a node server that exposed the terminal using node-pty, a package built for doing exactly that.

These containers were running node.js servers at different URLs like compiler1.repl.programiz.com, compiler2.repl.programiz.com, and so on. We could've chosen a number between 1 and 45 randomly on the client-side but we wanted to leave space for future optimizations such as sending the id of the container that had the maximum amount of free resources.

The 45 compilers were behind a proxy server we wrote in node.js that also handled the SSL certificates. We deployed this cluster of 45 containers using Kubernetes (more on Kubernetes later) on the public cloud

How We Built Our Online Python Compiler
The proxy server redirects traffic to one of 45 available containers running the compiler server.

This solution gave us the speed we were looking for. Even on production, it was able to handle our traffic.

However, I wasn't happy with a few things:

  1. Our workloads vary across the day. The 45 VMs would either be under a lot of pressure during peak time or sit around doing nothing during low periods.
  2. The deployment process was archaic. I was dynamically creating YAML spec files for Kubernetes stuff like deployments, services from shell scripts. Kubernetes doesn't expose containers by default and instead of using a LoadBalancer to spread the workload across the 45 pods (the logical equivalent of a container in Kubernetes), I would run 45 services, one for each pod and then use our custom proxy server to route traffic to these 45 services.
  3. The manual proxy that I built made set-up on a fresh machine difficult, we didn't want a setup where we would have to modify the /etc/hosts file for local development.

Overall, it felt like we weren't really using the power of Kubernetes and only using it for deploying Docker to production. Just reading the Kubernetes spec files was a pain because they contained many placeholders that had to be replaced by shell scripts before they could be useful.

Approach 3: Unleash Kubernetes

The challenge now was to rethink the infrastructure of the whole setup.

As the technical lead for the project, I took a week off from work and bought a Kubernetes course. I revisited basic DevOps concepts like process management, CPU and memory management, etc.

I also learned about subtle things in Docker like the difference between ENTRYPOINT and CMD commands and then took the full Kubernetes Certified Developer course to learn and practice the concepts behind Kubernetes. It felt like running my first for loop again.

While creating Docker images using Dockerfile was akin to Infrastructure-As-Code, Kubernetes takes it to the next level with Infrastructure-As-Data.

Infrastructure-As-Data is a move from declarative programming to imperative programming. You go from telling the computer "What it needs to do" to "What needs to be done".

You do that by writing a YAML file that describes what you want to get done in a syntax that is defined by the Kubernetes API. YAML is like the US dollar, it's a data currency that every programming language accepts.

You can then provide this YAML file as an offering to the Kubernetes gods (Azure, Google Cloud Platform, AWS, DigitalOcean - you can take your pick) and they will pull your container from Docker Hub and run your app on production. Docker Hub is a repository for Docker images that works just like npm or ruby gems or pip.

Even Docker provides an Infrastructure-As-Data alternative to Dockerfile in the form of Docker Compose. Github Actions also works on the same philosophy, you just describe what needs to be done in a YAML file based on a specification, and GitHub handles the rest.

Going into the details of how Kubernetes works is beyond the scope of this article. So I'll move on to how we used some of the features of Kubernetes to make sure our python compiler handles dynamic traffic and doesn't go down.

Resource Limits on Kubernetes Pods

Just like a Docker image was akin to the specification of music as Musical Instrument + Sheet Music, a Kubernetes pod is a Docker Container + its Kubernetes Specification.

A pod definition file contains information like

  • What resources should I be able to consume?
  • Where should I pull the Docker image from?
  • How do I identify myself to other Kubernetes elements?
  • What should I run on the Docker container when it starts?

A Kubernetes deployment is another abstraction layer above pods that also describes how a pod should be deployed in the Kubernetes cluster.

A deployment adds more information on top of a pod specification such as

  • How many replicas or copies of this pod should the Kubernetes cluster run?
  • If the Docker image is in a private repository, where should I get the secret information I need to pull from that private repository?

It's just layers and layers of abstraction that make life easier for developers and system administrators alike.

resources:
    requests:
        memory: "0.5G"
        cpu: "0.5"
    limits:
        memory: "1.5G"
        cpu: "1"

The lines above tell Kubernetes to allocate 500MB of ram and 0.5 cores of CPU to the pod and allow it to expand up to 1.5GB and 1 core respectively. If a pod consistently crosses it's limit, then it is evicted from the cluster and a new pod takes its place.

Kubernetes doesn't automatically remove Evicted pods from its cluster. I understand the reasoning behind this, a sysadmin might want to look at the reasons why the pod got evicted. Since ours is a simple application where all users are performing the same operation, I didn't want to bother with Evicted pods so I wrote a GitHub action that runs a cleanup script to remove Evicted pods on a schedule.

name: Remove evicted pods every hour
on:
  schedule:
    - cron: "0 */1 * * *"
jobs:
  delete-evicted-and-crashed-pods-from-kube-cluster:
    runs-on: ubuntu-latest
    steps:
      - name: Setup Digital Ocean Client
        uses: matootie/dokube@v1.2.0
        with:
          personalAccessToken: ${{ secrets.DIGITALOCEAN_PERSONAL_ACCESS_TOKEN }}
          clusterName: programiz-compiler
          expirationTime: 300
      - name: Remove evicted pods        
        run: |
          kubectl get pods | grep Evicted | awk '{print $1}' | xargs --no-run-if-empty kubectl delete pod

This example shows the power of being able to Infrastructure-As-Data across the board. :)

Readiness and liveness probes

In our previous setup of 45 pods running behind a proxy, we had no way to stop traffic from going to an unresponsive pod.

Enter readiness and liveness probes, which are parts of a Kubernetes pod specification designed to allow the developer to define the requirements for sending traffic to a pod.

readinessProbe:
    tcpSocket:
        port: 3000
    initialDelaySeconds: 10
    periodSeconds: 3
livenessProbe:
    tcpSocket:
        port: 3000
    periodSeconds: 3

There are two parts to it:

  • The readiness probe waits 10 seconds after a pod is created and attempts a TCP connection handshake at port 3000. If that handshake doesn't succeed, it keeps on trying every 3 seconds. A pod will not receive any traffic until that handshake is successful.
  • The liveness probe attempts a TCP socket handshake with our node server running at port 3000 (internally) every 3 seconds, and stops directing traffic to it if it doesn't respond.

You could replace tcpSocket with httpGet and have a REST API endpoint that acts as a health check for your pod.

In less than 10 lines, Kubernetes does all the heavy lifting to make sure that our users get the best experience. Even if someone runs some malicious code or infinite loop in our compiler, the liveness probe quickly responds by stopping traffic to that pod until it becomes responsive again.

Deny Egress Traffic

One of the problems of allowing people to run remote code execution on your server is that people will try to run malicious scripts and mine bitcoin and what not. Our goal was to provide a fast compiler for beginners looking to run simple python scripts online while they are grappling with beginner concepts like for loops and object-oriented programming.

So I took a shortcut and put in a network policy that denies egress traffic from the node server.

metadata:
    name: programiz-compiler-pod
    labels:
        app: programiz-compiler
        type: server
        networkpolicy: deny-egress

networkpolicy: deny-egress is just a label here. There is another Kubernetes spec file that defines the Network policy and applies it to all pods that have the label networkpolicy: deny-egress.

This network policy file works independently from the pod. I can apply this label to any pods in the future and expect the network policy to kick in automatically.

Autoscaling Based on Traffic Volume

With Kubernetes deployments, we can choose how many replicas of the pods should be run. Another Kubernetes feature called services can then be used to distribute traffic across these pods based on different routing algorithms that can also be defined according to the Kubernetes specification.

In my previous setup, I was actually creating 45 separate deployments, not one deployment with 45 replicas. And I was stuck with that number during both low traffic and peak traffic times.

Kubernetes provides a feature called HorizontalPodAutoscaler that you can use to define the minimum and the maximum number of replicas of your pod that should be created.

apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
    name: programiz-compiler-autoscaler
spec:
    minReplicas: 25
    maxReplicas: 50
    scaleTargetRef:
        apiVersion: apps/v1
        kind: Deployment
        name: programiz-compiler-deployment
    targetCPUUtilizationPercentage: 80

It simply tells the Kubernetes cluster to maintain between 25 to 50 replicas of our compiler server to maintain the CPU Utilization percentage always below 80.

For instance, if the average CPU utilization across our cluster goes above 80, then Kubernetes will keep provisioning nodes and redirecting traffic to them until the CPU utilization becomes less than 80. Later when the traffic goes down and the CPU utilization for some pods becomes less than 40 (half of 80), then Kubernetes starts downsizing the cluster automatically.

The story doesn't end here though. Pods are deployed on Kubernetes worker nodes that have limited specs. For instance, since we require 0.5 cores of CPU and 500MB of memory for each replica, we can only fit 4 of those on a 2 core 8 gig node.

If there are not enough nodes available for the pods that the HorizontalPodAutoscaler creates, then they will just stay in Pending state and not be able to accept traffic.

This is where node autoscaling comes into play.

How We Built Our Online Python Compiler
Adjust node count

Our Kubernetes cluster is set to autoscale from 1 worker node to 15 based on how many pod replicas our HorizontalPodAutoscaler(HPA) has told our master node to spin up.

If our tool becomes very popular and even the 50 replicas aren't enough, then technically we could increase the maxReplicas number to 60 (4x15). If even that's not enough, we can always change the maximum nodes that the cluster can scale to.

Just like HPAs, the node autoscaler also gets rid of nodes that aren't being used automatically if the HPA scales down the number of replicas. This downscaling saves us a lot of money during low traffic times when the entire cluster just runs on 25 replicas.

LoadBalancing & Caching

LoadBalancing is another area where Kubernetes and its concepts of imperative programming and Infrastructure-as-data shine. Kubernetes provides a solution that creates a single entry point for all your services, just like an Nginx reverse proxy. Nginx isn't the only one supported, you can use other proxies like HAProxy and Traefik too.

In our case, we just created an Nginx load balancer that routes to either our backend or frontend services based on the url. Certificate management is also done at this layer using another feature of Kubernetes called ClusterIssuer, which takes care of SSL certificate management under the hood.

Adding more features on top of the Nginx reverse proxy doesn't require manually editing the nginx.conf file. There is a field called annotations where you can add an annotation for the feature you want and it will just work.

For instance, since most of our users are repeat users, we wanted to cache CSS, JS, fonts, and static assets. Doing this was just easy as cake, I just had to add a simple annotation on our ingress YAML file.

annotations:
    nginx.ingress.kubernetes.io/configuration-snippet: |
        if ($request_uri ~* \.(css|js|gif|jpe?g|png|svg|woff2)) {
            add_header Cache-Control "public, max-age=31536000";
        }

If there is a critical front-end update that I want to force our users to download, I can just change the reference to build.js in our index.php as build.js?v=34tssdaf or any random string to invalidate the cache.

Prevent Attacks On The Whole Cluster

When we looked at the logs, we noticed that a lot of people were running infinite loops and programs that would access the file system to see what happens. I don't blame them, anybody would be tempted.

But some users were going out of their way to stop the compiler from working, running selenium scripts that would repeatedly open our compiler to start a session and run infinite loop programs or other malicious code that would render pods unresponsive.

Eventually, these pods would be evicted and new pods created but again new sessions would be redirected to these new pods and an attacker could potentially make all our pods unresponsive at once.

Fortunately, there are annotations in the Nginx controller definition YAML specification that you can use to tell Kubernetes to set a cookie to identify which pod a user was directed to when the session started. In subsequent sessions, Kubernetes will detect the cookie and use it to send the user back to the same pod. This is called session affinity in Kubernetes speak.

annotations:
    nginx.ingress.kubernetes.io/affinity: "cookie"
    nginx.ingress.kubernetes.io/session-cookie-name: "route"
    nginx.ingress.kubernetes.io/session-cookie-expires: "172800"

The session affinity field also accepts other options like "IP" that will redirect sessions from the same IP to the same container using hashing techniques.

With just three lines of configuration, I was able to implement sticky sessions. Doing so with Nginx reverse proxy and the declarative programming route would have taken days to get this to work.

Automated Deployments and Development Workflow

For me, a project is never complete unless it has an automated deployment process. Automated deployment lowers the barrier for other members of your team to contribute.

The GitHub actions script that deploys the Kubernetes cluster is not complex at all, I'll just leave it here for anyone wishing to know how a Kubernetes cluster is deployed.

We check out the latest code, build a Docker image based on Dockerfile that is checked in with the code, push that so it becomes the latest image on our Docker Hub private repo, and then ask Kubernetes to pull it from Docker Hub. Another win for Infrastructure-as-code!

name: CD-prod
on:
  push:
    branches: [ master ]
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    
    # Required to pull from private docker registry
    - name: Docker Login
      uses: Azure/docker-login@v1
      with:
        username: ${{ secrets.DOCKERHUB_USERNAME }}
        password: ${{ secrets.DOCKERHUB_PASSWORD }}
    
    # To enable kubectl and deploy to cluster
    - name: Setup DigitalOcean Client
      uses: matootie/dokube@v1.2.0
      with:
        personalAccessToken: ${{ secrets.DIGITALOCEAN_PERSONAL_ACCESS_TOKEN }}
        clusterName: programiz-compiler-cluster
        expirationTime: 300
    - name: Build Prod Image
      run: |
        
        docker build -t parewahub/programiz-compiler-server:"$GITHUB_SHA" -t parewahub/programiz-compiler-server -f Dockerfile .
        
        #this pushes both the tags $GITHUB_SHA and latest
        docker push parewahub/programiz-compiler-server
    
    # Force rollout of deployment
    - name: Force repulling of prod image on Kubernetes
      run: kubectl rollout restart deployment programiz-compiler-deployment

What's next?

Infrastructure-as-data allowed me to introduce complex features into our online compiler app without doing a lot of coding. Features of Kubernetes such as session affinity, liveness and readiness probes, Nginx Ingress, ClusterIssuer, Deployments, and many more helped make our application robust.

As of this writing, there have been zero crashes on any of our pods for the last 48 hours. The dream of providing access to the world of programming for anyone with a smartphone is coming true.

Peter Thiel says you have to make your product 10X better than your biggest competitor. We ruthlessly pushed for the highest level of performance and ease of use and our online compiler has already risen to #1 on Google SERP for the keyword "Python Online Compiler".

We are now working to implement the compiler throughout our website for all the programming languages we support. Since I've built the foundations right, I hope our users will be able to play with all the code on Programiz very soon.

]]>
<![CDATA[How we Create Great Content at Programiz?]]>https://www.programiz.com/blog/create-great-content/5ec3a01e9141262dc87dc4deTue, 19 May 2020 13:40:22 GMT

Programiz germinated from the idea to provide the simplest programming resources for beginners. This idea came into being as we struggled to find great programming resources online as beginners. So, we took it upon ourselves to create a website where beginners could get started with programming. Our goal from day one was, and is, to create and provide high-quality programming resources to our readers.

Throughout the years, as we grew from 0 to 3.5 million users per month, our meaning of "high-quality resource" has also evolved. It now incorporates our values and goals coupled with a great design and user experience. However, the single most important factor that glues everything together is still a great content — a content catered to our readers.

But it is not that simple. After spending almost a decade working on Programiz, we still cannot interpret what exactly makes the content great. This is primarily because great content means different to different people and different industries. There's certainly no one thing or a group of things that makes a content great, or an algorithm that can create the perfect content.

However, throughout the years, we have narrowed down quite a few factors and made our own version of great content. And, through this article, we aim to share a small sneak peek of how we create great content with you.

Let's get started.

1. Select a Topic: Find topics that audiences will benefit from

This is one of the most important as well as the most difficult step. It takes lots of research. Luckily in our domain, there are predefined topics. However, our target audiences are beginner programmers. So we try to find topics that are essential for beginners.

Thus the first step towards great content is finding topics that will help you connect to your audiences. Find topics that your audiences are searching for and would benefit from. No matter how great your content is if your audience is not searching for it and does not provide any benefit to them then the content is of no use.

Now suppose we are creating content on Java programming for beginners. Since we are targeting beginners, then the contents on topics like Servlet, JSP, Maven, and so on would be of no use. We have to stick with topics that beginners would benefit from, like Java data types, Java Inheritance, Java Methods, and so on.


2. Keyword Research: To determine what should be included in the article

As mentioned earlier, choosing a topic is difficult but choosing a topic that people want is even more difficult. For this purpose, we use keyword research. The term keyword research is quite famous among the content writing and blogging community.

It gives you proper data on what people are searching on the internet. Based on that data, you can create content.

In our case, we use keyword research to find what our users are looking for in certain topics. That is, we are focusing on USER INTENT. I will be discussing it in detail.

For keyword research, we mostly use KWFinder and Keywords explorer from ahrefs. Both of these are paid tools. Let's see how we use these tools for keyword research.

Suppose we are writing content about Java inheritance:

How we Create Great Content at Programiz?
KWFinder Keyword Research Tool


I like Ahrefs' Keyword explorer more.

How we Create Great Content at Programiz?
Ahref's Keyword Research Tool

Here, you can see that these tools are giving us

  • the search volume of the term Java Inheritance: this tells how much people are interested in that particular topic. We can also modify to get data from the specified location.
  • the top-ranking page in that particular keyword: this tells who you have to compete with in that particular topic
  • related keywords: this tells what are some related terms people search related to the topic
  • difficulty metrics: this tells how difficult it is to rank in that particular topic
  • location-based: we can also modify our research country wise. This is helpful if you are targeting users from a particular country

Besides these paid tools, we use some free ones as well. Like,

  • Google autocomplete

How we Create Great Content at Programiz?
Google's Autocomplete
  • Google's Keyword Planner

How we Create Great Content at Programiz?
Keyword Planner
  • "People also search for" and "People also ask" section in Google's Search Engine Result Page

How we Create Great Content at Programiz?
People also search for Section
  • "Search related to" section in Google's SERP

How we Create Great Content at Programiz?
Google's Search Related to Section

3. User Intent: Find how users would benefit from the article.

There is a saying in the SEO community: create content for users not for Google. And we are a strong follower of that principle. We always think about providing value to users. Now even Google has become so smart that if your content does not provide value to users, your content is not going to rank.

It is said that when you are able to create content that users can benefit from, then more than half of your SEO is done already. So, why not create content focusing on users rather than SEO?

Besides, when you look into the process of creating SEO content, it's similar to the process of creating content for users.

Now the question is, how to write content for users?

First things first, we think like a reader, not a writer. We are not creating content for ourselves, but our reader. So we have to keep ourselves in their shoes and then start creating content. This way we can connect to our readers.

A video series named Blogging for Business from Ahrefs has divided great contents into 4 categories:

  • Emotion: Content that sparks emotion (anger, entertainment, happiness, etc) on people
  • Utility: Content that provides value to people
  • Numbers: Content with data and statistics
  • Stories: Content that is easy for people to relate

Based on your domain and topics, you can choose what type of content you want to make.

Since we are an online tutorial site, we mainly focus on creating content that provides value to people. This does not mean we don't focus on creating other types of content. If our users can benefit from such content then we create them as well. In the end, it's all USER INTENT, right?


4. Content Outline: To have a clear vision of what we are going to write

We cannot write everything about certain topics in the name of providing value to users. There should be certain boundaries. This is why we always create the structure of our content.

This will give us an idea of what our content will look like. We will be able to determine what to include and what to exclude before actually writing.

Another advantage of the outline is connections in the content. Let me explain what this means. Here, we always try to maintain some sort of connection between the sentences and subtopics of our content. This is because we don't want users to be lost while reading content from start to end. If the first, middle and the last section of our article is not connected properly, users will learn 3 different things in a single topic. And I can tell you that is not good.

So how do we make a content outline?

We always start with keyword research. As mentioned earlier, this gives a better idea and understanding of topics that might be helpful for users.

Also, we always analyze the top 10 pages on that particular topic. This is always a good practice. It helps you know more about what has already been created. And might be helpful to create something unique and more useful. Also, we can find something that these pages are missing.

Suppose for the topic of Java Inheritance,

How we Create Great Content at Programiz?
Ahref's Keyword Ideas

Now, if we expand any of them, we will get a lot of subtopics that can be included in the article. However, DON'T just start mentioning all those related terms in your content.

Remember, I have highlighted the word don't. So don't.

Now, the time has arrived. Time to use the USER INTENT part in your content. Think about what your users can benefit from and only use them.


5. Actual Content: What we include in our content?

All those steps will give us the structure of our content. Now that we have the structure of the content, it is time to create the actual content.

Originality is everything for us. We have our reputation to maintain. For this, we are always dedicated to creating unique and original content. Creating original content does not mean you have to always discover new things and write. You can take references as well.

References and Resources

We use multiple books, resources from educational sites, and answers from StackOverflow, Quora, and Reddit as references for our content.

And if we feel that our audiences will benefit from resources from other sites, then we always mention those sites in our content.


6. Continuous Update: To provide updated information

This is one of the important processes of content creation. Creating great content is not a one-time task, it is a continuous process. We need to keep improving all the time.

The world is changing so fast that the great content of today might be ordinary tomorrow.  So, to provide an up to date information to our audiences, we need to continuously update our content.

Here at Programiz we are not always focused on creating new content. We dedicate a certain amount of time on improving the old ones as well.

Feedback: To update content based on audience responses

As mentioned before, we always write content for people of all ages and places. Despite all the efforts, some content might not be perfect for all users. There will remain some flaws in our article. So to resolve all the flaws and provide better content, we are always focused on getting feedback from our users.

How we Create Great Content at Programiz?
Programiz Article Feedback

We have included the Article Feedback tool at the end of every article. We are getting continuous feedback from our users through this tool.


7. Tools used: How we have developed our content writing tool?

We explored every tool out there and found that Google Docs caters well to our needs of peer-reviewing every article. Since then we have been using Google Docs to write all of our articles.

Content Workflow System

To automate our content creation process, we use our in-house content workflow system. This content workflow system allows us to directly convert our Google Docs into HTML. Thus formed HTML is directly uploaded to the site.

How we Create Great Content at Programiz?
Content Workflow System

We can also create Google Docs from our website content using the URL. This helps us to edit and update our content.

You can learn why and how we developed our content workflow system at How we developed the Content Workflow System at Programiz.


Final Words

This is a lot of work and time. But it is not easy to create great content that stands out. And, a Great Content can express the vision of any company and help to build a prosperous brand. So, why not spend time on something that will help you for a long time?

With all the feedback from our users, we are improving every day. And knowing the fact that we are helping lots of people always inspires us to create more and more great content.

]]>