RSS Bot #1 Posted December 16, 2006 Some years ago, just to keep in practice, I wrote a Visual Basic program that picked Powerball numbers. Here's a picture of the program I created: (There was another reason I wrote the program: I knew this guy at my old job who was a Powerball freak and I wrote the program as a joke to "help" him out.) The program needs some improvement: it would be nice, for example, if the first five numbers were in numerical order. However, it got the job done. This past semester I learned a little Javascript and I decided to write a Javascript version of the Powerball picker program. If you would like to try it out here's the link (sorry about the advertisements, it's a free web site). I only tested it to work on IE6 and Firefox so I don't know if it works on other browsers. If it doesn't work on your browser, make sure Javascript is enabled. It still needs work. For example, I didn't implement the routines to prevent duplicate numbers from appearing. I also need to sort the numbers (not a big deal but it would be nice to have - I guess I'll put that feature in the VB version first). You also have to refresh the page to get new numbers, I want to put a button in place to do that instead. The page needs to look prettier too. Javascript is pretty easy to implement but there are some aspects that are frustrating. For example, IE and Firefox handle document elements differently. A routine I wrote for my HTML class that prompted the user if they failed to fill in all the fields of a form worked perfectly in IE but failed to work at all on Firefox. I spent most of yesterday figuring out how to make the routine work on Firefox. One good thing about Firefox is it has an error console to help me find the problems. It's not a great help but it's better than what IE offered (nothing). One great thing about porting code to another language is it allows you to focus on the language-specific issues of the code. There's no need to worry about issues relating to the logic of the program itself (unless problems were masked by the previous language). As a result, learning Javascript by porting other programs is pretty quick and easy. I have a couple other programs I think I can port to Javascript (heck, I could probably port some Altair basic programs over too). When I have a newer version of the Powerball picker, I'll post it. http://www.atariage.com/forums/index.php?a...;showentry=2543 Share this post Link to post Share on other sites