Posts

Finding the next Palindrome

Image
Hello, here's a quick post I'm making for a simple program. There will likely be another as my professor is currently making me do more basic programs at this point instead of a more major project like the calculator. This programs does one task: when given a number, it will find the next palindrome after the number. You can find it here on github . It does some other tasks as well such as validating if the input was a number and making sure the number can be turned into an integer. The finding of the next palindrome is done by checking the first half of the number and comparing its reverse to the latter half of the number. If the reversed first half is larger than the latter half, the output will just be the first half combined with the latter half being the reversed first half. In odd length numbers, the middle number is increased by 1.  If the reversed first half is smaller than or equal to the latter half, the output will be the first half plus 1 and the rever...

A Text Replacing Program

Wow. As the calculator is put to the back burner for the moment, I've gotten time to work on other programs and get a post out at a decent time. Hopefully I'll be able to keep this up. The class has been tasked to write a conditional character replacement program. The objective is to replace characters in a text file which aren't in specific words or adjacent to specific characters. This was apparently a difficult task for many, even myself. However, with some review from the other classmates in the class, I've created a method for replacing a certain character under specific conditions. The program can be found here on github. The program works basically in the following way: Text is inputted from a file. Each line of text in the file is to put into a list as an item. The restricted words, restricted characters, the character to be replaced, and the character to replace, are inputted by the user within the console. The user can input multiple restricted words an...

An Update on the Calculator: Now with Parentheses

Image
This second edition of the calculator took longer than expected. Originally, I thought it was going to be some complex, but easy to implement, code. However, it came to appear almost as an impossible task. Worse, for almost a month, our professor has not had the situation where he could come to class, so for most of the time since the last post we had to work on our own. However, after several written up concepts and reviews from others students and failed attempts, I've coded up this new calculator. Here it is on Github. The prior calculator was very basic, it did less than a calculator one could get for free at a convention. The code for it was too simple, the new calculator had to be mostly remade or greatly modified at several key places. However, I did get this completed only a few days ago. The new calculator is quite close to a basic scientific calculator. It can now do order of operations. One can input several numbers and operators, and the calculator will foll...

A Very Basic Calculator

Image
It's been another busy time. I've had to dealt with the holiday season and the return of college. I was also doing exploration into Pygame for a project. However, I am back and ready to program. I've got a calculator to show. With a new semester, I've got another class for programming. The professor told us we were going to start off by doing our finale project: Making a useful calculator capable of doing actions beyond what a scientific calculator can do. This is to be done in Visual Basic. For the moment, however, we were told to make a calculator capable of simple calculations such as adding or multiplication. One of those simple calculators like the basic calculator on iPhones (when not in scientific mode). This was a mildly difficult task. I had to learn some basics about how calculators work. The display was rather easy, as with most Visual Basic programs. Here is the code for it. In summary, the calculator has functions for these tasks: Display. Chan...

An Encryption And Decryption Program

It's back to the schedule, so here's my latest creation . A python program that does encryption and decryption in both the Caesar Cipher and the Vigenère Cipher. When given a message with a key, the program shall input the two into an encryption function which will return the encrypted message unless there are errors. For show, the encrypted message is outputted to the console and then placed into the decryption function along with its key, which returns the message decrypted. The Caesar Cipher does the following: Get the message and key Validate message and key  Make sure the message is a string made up of ASCII characters (and only visible ones; the ones from char 33 to 126) and the key is an integer  Print to console the problems and stop if validation fails For every letter in the message  Get the current letter and its ASCII number  If the ASCII number of the current letter plus the key is above 126  Add to the output string the character...

My Two Projects for Finals

Image
So it has been almost a month since my last post. It's been a busy time. I have to dealt with final projects in all of my classes and had to study for various exams. With Thanksgiving and a relative's graduation, I had to also do various things with my family. One other thing I had to do is my programming class' final project. So for my first programming class I had to create two programs: One that gets a number in its numerical form and then state the number as words instead of numbers. One which will translate a number in one base and translate it to another base, such as translating a number from binary to hexadecimal. These were probably the hardest programs I've ever made so far. I had to learn various code pieces such as dictionaries and chars. Much time had to be put into them, and countless times did they have errors while running. Nevertheless, I shall go into what I have made. Number to Word Translator This is a simple program to which takes a n...

A nice looking, but barebones idle game in Unity

Image
It has been a busy week. Unfortunately, that may remain the same for the rest of November due to courses finishing up. At least I was able to get this post up within a two week period since the last post. It's a simple idle game based off what I made around a year ago . Unlike the previous game however, this is made in Unity instead of HTML and JavaScript. The game starts with a menu and then the user hits play. When the game screen appears, you can then click the button (coincidentally with the image of the flag of Bhutan) to increment. Generators can be purchased, but their cost will increase with every purchase. If you head back to the main menu, you can return to play or quit, and with either action your stats will be saved (though the generators will not run when the game scene isn't shown). This version I tried to do two things: being able to save and load data from a file (I haven't done file handling with C#) and setting up a menu. At least the minimal of th...