Archive for the ‘Programming’ Category

Programming And Mathematics or Programming Mathematics

Sunday, September 9th, 2007

Well, I’m trying to ease my way back into programming after my break over the summer. I decided to try something easy, but I didn’t think that it would be as easy as it was. I wanted to try to program an application that could calculate Narcissistic Numbers. Now, how in the world can a number be classified as “Narcissistic?”

A simple google “define:narcissistic” brings this up:
characteristic of those having an inflated idea of their own importance”

So, How can this apply to numbers? Well, it is a very simple idea. You have a number, let’s say 153. How can this be narcissistic? Let me explain. First you have to split the number up digit by digit, so you end up with 1, 5, and 3. Then there are three (3) digits, so we keep that in mind. Then to test for narcissisticity (i don’t actually know if that’s a word), you take 1^3 + 5^3 + 3^3 (the “^” means “to the power of”) which equals 153, which makes this number (153) narcissistic, so it loops back on itself. The three is that you raise all of the digits to is the length of the original number, so lets test another number now that we get the concept. Lets try 243. 2^3 + 4^3 + 3^3 = (8) + (64) + (27) = 99. Since 243 does not equal 99, 243 is not a narcissistic number. Does that make sense?

Well, back to the programming, I wanted to come up with something that could calculate some of these out. I came up with this: http://tech-works.info/narcissistic_numbers.exe. It calculates all of the narcissistic numbers up to 100000000. Due to the limitations of Visual Studio, I can not go any higher, and as it is, it takes a little while to do all of the calculations, but with some optimization, it could get better, but this was a ten minute program. Here is the main function of the entire program in its entirety:

Private Sub Main
ListBox1.Items.Clear()
Dim number As Integer = 0
Dim number1 As String
Dim sum As Integer = 0
Dim length As Integer
While number < 100000000
number1 = number.ToString
length = number1.Length
Dim i As Integer = 0
While i < length
sum = sum + Val(number1.Substring(i, 1)) ^ length
i = i + 1
End While
If number = sum Then
ListBox1.Items.Add(number)
End If
sum = 0
length = 0
number = number + 1
End While
End Sub

(Note:  You need Microsoft’s .NET Framework 2.0 to run the program download)

Stuff

Thursday, February 1st, 2007

Not much has been happening lately in technology.  Tomorrow, I will post the upcoming game releases for February.  SO, today at Vo-Tech, some kid wanted a program that would search a list of words from the dictionary to help him with hangman.  It can search the list for words with a specific number of letters, what it starts with, ends with, what letters the word contains, and what letters you know are wrong (it omits those from the list).  It’s really a simple program that is good at cheating at a hangman game :D .  The link is here.

Oh and a couple of days ago, the new version of Windows (Vista) was released.  I’ll write about that tomorrow.

Game Programming

Monday, January 29th, 2007

Lets face it. What teenage gamer has not wanted to make the next big hit game that they can call their own? This post will be all about what tools to use to get you started in that direction. Some of these tools are free, some free to an extent, and others, somewhat expensive.

Here’s the list of tools for your use:

  • Game-Maker (http://www.gamemaker.nl) – Created by a Utrecht University (In the Netherlands) professor of game design. Most functions are free, but at 20$ USD, the price can not be beaten. This is mostly for 2D Games, but if you register for the 20$, you can use the 3D systems.
  • 3D Game Maker (http://t3dgm.thegamecreators.com) – A tool set used specifically for making 3D games very quickly. A great tool for learning the basics of game design. This tool ranges from 32 USD for the basic to 73 USD for the creator, FPS maker and FPS model set.
  • And for the more advanced, you can download Microsoft’s Visual Basic .NET 2005 Express edition for free from Microsoft.com, and while your there you should get the DirectX Software Development Kit to go with VB.NET. This option takes a lot of work to get into and I’ve only begun to delve into it.

These are some great options to get you going on your hit game, so have fun with them.

Game Maker
Game Maker

3D Game Maker