Oh the things you do when bordem strikes…

So, I was bored today and I decided to write some programs. The first program is actually a program that I drastically changed from one of the sample programs in Computer Science I. The second program is a spin-off of a more simple program that I wrote when I was 11 or so. Sadly, I don’t have the original program, which was written in PHP.

The first program simply asks the user how many repetitions it should run. Then, it runs as many repetitions as the user specifies and prints its output along the way. Basically, what the program does is create a bunch of random numbers and adds them all up. It is a simulation of rolling a die 6,000,000 times per instance. (Note the numbers 1 through 6) If the dice were to be 100% fair, each number would be rolled 1,000,000 times. At the end of the program, it shows the average number of rolls for all of the tests. So, give it a whirl:

rolldice.exe

Now the second (and best) program. It’s a bit harder to program than it looks, but is still relatively simple. Basically, the user inputs a phrase (e.g. CAT). Then, the user inputs a repetition number. The computer then converts the phrase into upper case (if necessary). Then, the computer begins to create a bunch of random phrases in an attempt to find the phrase CAT. Once it finds it, it tells the user how many tries it took. It then repeats for the number of repetitions that the user specifies. Once it completes, it prints out how many tries, on average, that the computer took. (sorry, it’s a bad explanation. Just run it; it’s a bit more simple than that).

WARNING: Due to the nature of the program, phrases longer than four characters will take a while. If you insist on using a long phrase, keep the repetitions low or the program may take a VERY long time to complete. This is essentially a brute forcing application.

catfinder.exe

The source is currently unavailable because catfinder.exe is currently extremely sloppy and must be cleaned up and renamed.

Leave a Reply