Most of us who have done any programming know that virtually all languages allow you to execute another program from within a program. For example, you start your program, which may start another process (via calling Execute or the like) that’s a self-contained program by itself, resulting in another process or spawn another thread as […]
Category: Coding
The 3n+1 Problem & More! (Part 2)
This is a continuation (part 2) of my blog titled The 3n+1 Problem & More! I recommend you read that first to get the context, or it’ll be really boring or at least confusing 🙂 In the previous blog we generated a sequence of numbers starting from ANY number and converging to 1…always! I also […]
The 3n+1 Problem & More! (Beyond Collatz)
Recently, I was reading a post about an mathematical formula when applied to any number (positive integers) will end up at 1, no matter odd or even. It’s called the 3n+1 problem or the Collatz Conjecture. So, of course, I tested the theory and sure it works. Actually, when you think about it, it’s no […]
The Dictionary Challenge-Part 2
This is a continuation of the Dictionary Challenge previously completed. To follow along, you should read that post here. So, we have already downloaded a free Webster dictionary but completely unformatted and unstructured. So, we created a new file in a more structured way that our program can process. The code is in the previous […]
The Dictionary Challenge-Part 1
Ok, today I’m inflicting a self-imposed challenge…here it is: Get an English dictionary. Then find how many words start with vowels. How many words are there starting with “odd” letters, which I’ll set as: Z, Q, J. Then find the longest word in that dictionary. (Say, we’re going to make a word guessing game) All […]
Let’s Roll! — 2 dice…and find the probability and chart it (Python)
What numbers will you get if you roll 2 dice? How about we find out by writing a program? Can we then chart the results over as many rolls as we want? And then interactively play with the chart? Asking a lot! But yes, I will do ALL of the above here. Better yet, why […]
Draw A Beautiful Gradient Scatter Plot (Python)
In this demo, I’ll draw a beautiful, elegant, gradient-colored (themed) scatter plot using some data for x and y axis. The neat thing I want to demo here is not so much the data themselves, but how to apply a “colormap” to the graph using Python’s matplotlib library. Specifically, its pyplot module. What’s Desired: The […]
“Rabid Racoon” tracking (Python, using our own class)- Part 2
This is part 2 of the original series on Rabid Racoon. Please read Part 1 first to follow along. So, this time we’ll use a real-time graphing method using Python’s Turtle library instead of scatter plot as we did in Part 1. The beautiful part is, since we already created our custom Class in Part […]
“Rabid Racoon” tracking (Python, using our own class)- Part 1
Just like most high-level programming languages, Python also supports the idea of classes. Once the class(es) is/are created they can be inside the main python file or separated (in most usage scenarios), along with it methods. For Python-specific syntax, please refer to its documentation online or offline (python.org is a good start), but you should […]
How do those words game work???
Here I’ll show you the basic concepts of the most famous word games…and how they are actually coded. Obviously, I’m NOT going to show you advanced algorithms or any proprietary information here. Just the basics…you go party on with this information with your own creativity. There are numerous games out there based on this concept. […]