Following the latest trend in the game, I decided to create my own wordle game. The primary difference between my game and the original is that you have 100 chances to guess the word instead of only 6. Furthermore, you are not limited to a single word every day; you are free to play as much as you wish. Here's how I like to organize my directories and files: Let's begin with a simple class that will house our main logic. The class will be called "wordle," and it will include the following features. - Choose a word at random. Validate the user's input and provide a proper response (green, yellow & grey colours will be used to indicate whether the words are in the right positions represented by 2, 1, 0 respectively). Check the game's progress. The code above is in charge of picking a random word. It's worth noting that the source file and our wordle logic have been separated. This is to reduce code coupling and will be handy if we need to give an al...
Let us begin by defining a thread. Wikipedia states that - In computer science, a thread of execution is the smallest sequence of programmed instructions that can be managed independently by a scheduler, which is typically a part of the operating system. The implementation of threads and processes differs between operating systems, but in most cases a thread is a component of a process. I n Node.js, there are two types of threads: one Event Loop, also known as the main thread, and a pool of k Workers in a Worker Pool, also known as a thread pool. The libuv library maintains a pool of threads that Node.js uses in the background to perform long-running operations without blocking its main thread. To handle "expensive" tasks, Node.js employs the Worker Pool. This includes I/O for which an operating system does not provide a non-blocking version, as well as CPU-intensive tasks in particular. So, in essence, the threads are executed by the processor. Let's say a system or m...