Writing Programming



My Blog:

This page contains a collection of source code and a few articles from my programming experience. It's not meant to be a full tutorial to teach you how to program- there are plenty of other sites for that- it's just to share a few of the things that I've learned that may help you out or save you some time. Or you could just use it to download and play some of the games that I've made.

Most everything on here is in some form or another of BASIC, either Visual Basic, Q-BASIC, or TI-85 Basic, though some of the general information is applicable to any programming language. I have experience with Pascal and Fortran 77, but for what I do, they don't add anything valuable over BASIC. I've been meaning to learn C and C++, but that's just not one of my top priorities, since Visual Basic really does let you do a lot of stuff.

I have a Downloads section, that contains executable versions of a few of the better/more useful programs from this page, for those people that don't have Visual Basic installed on their computers.

Menu:
Visual Basic
Q-BASIC
TI-85 Basic (separate page)


Visual Basic
Why not start off with the most powerful version of Basic that I know. I started off using Visual Basic writing macros for MS Excel, but I've since learned the stand-alone version as well. If you don't want to buy the stand alone version, you can still write pretty powerful programs in Excel. The last program listed here is a simple Excel macro.

Articles
  • X-Plane, UDP, and Visual Basic- Here is a tutorial on using Visual Basic to write a program to interact with the popular flight simulator, X-Plane. Includes basics of network communications with UDP packets. Also includes information about integers and single precision floating point values, and how to calculate them from bytes.
Source Code
  • 3D Beer Pong
    Download Source Code (zip), View Source Code (html), Screen Shot
    3D Beerpong Screenshot A 3D program of the popular college game, beer pong. It's done with wireframe graphics, using the simple line and circle commands built into Visual Basic. Eventually, I'd like to learn how to use Direct3D for the graphics, but that's down the road a ways. Probably the most difficult part of this program was the collisions between the ball and the cups- much harder to figure out than the 3D graphics.
  • Calculator with Expression Parser
    Download Source Code (zip), View Source Code (html), Screen Shot
    Calculator Screenshot This is an uncompleted project to make a decent calculator program with expression parsing. It allowed you to enter in an expression, such as "(3+2)*6", then hit enter to see the answer. The project kind of fizzled out when I realized that it's easier to just use my TI-85 for simple calculations, and Excel for more complex calculations. But I include the uncompleted program here because I did get the expression parser to work, which is a bit of code that could be useful for someone that's wanting to write their own calculator program.
  • Photo Page Generator v2.3
    Download Source Code (zip), View Source Code (html), Screen Shot, Read Me
    Photo Page Generator v2.3 This is a program I wrote to generate some html code to automate the making of photo pages. It will read a directory to get all of the images, write the html code to put them in thumbnails, and generate a webpage for each photo (with navigation links and a handy-dandy javascript that dynamically resizes the image to fit the window), or a list to put in a drop-down box for a slideshow. You can even generate different galleries for the images in a directory. There is also a readme file included in the zip archive with detailed directions on how to use the program. Note that the code it generates is to work with the format of my Photo Pages, but you could easily edit the code to make it fit whatever format you wanted. This program uses a module written by David Crowell to read in the image sizes.
  • Circle Gradient Pattern Generator v2.0
    Download Source Code (zip), View Source Code (html), Screen Shot Read Me
    Photo Page Generator Screenshot This is a program I wrote to play around with graphics. It uses the Brightness Demo ©2005 by Tanner "DemonSpectre" Helland as the method to display the graphics, while the actual creation of the pattern is my original code. Basically, it creates circular gradients about points, and overlays all these gradients to generate the patterns. There are two methods of gradients - a simple linear method, which generates fairly smooth gradients, and a power based method, which generates sharper gradients. There is also a method for creating animations of these gradients. To see some examples of the images and animations made with this program, take a look at my artwork page.
  • Excel to HTML Table Maker
    Download Source Code (zip), View Source Code (html), Screen Shot
    Excel to HTML Converter Screenshot This is a very simple Excel Macro that will convert highlighted ranges in Excel into HTML tables. It generates a very simple table, without any formatting. This generates much more streamlined code than the built-in Save As HTML in Excel. It's also simpler than a lot of the other macros I had found online, which copied Excel's formatting to the HTML code, which isn't what you always want to do.
Q-BASIC
I did a lot of Q-BASIC programming when I was in high school. Unfortunately, most of it was before I took a programming class and learned the basics of good programming practices. But, I still made some neat programs.

I discovered that it's very difficult to make screen captures of some Q-Basic programs in Windows XP. I'm not alone in that, as I've seen the issued raised in many web forums. I finally came across a good solution. Run the programs in DOS Box, an x86 emulator, and take a screen capture of that. Yeah, it seems kind of backwards to have to run an x86 emulator if your processor already is an x86, but it works.

Source Code
  • Advanced Pong 2.0
    Download Source Code (zip), View Source Code (html), Screen Shot
    Advanced Pong 2.0 Screenshot I started off writing a clone to the original Pong game, then decided to make it a little more interesting by letting you move your player forward and backward, not just up and down. Careful, though - the ball moves as fast as the players, so if it gets behind you, you can't stop it.
  • Arm
    Download Source Code (zip), View Source Code (html), Screen Shot
    Arm Screenshot A simple little program to simulate a robotic arm that can pick up and drop circles. The challenge for this one was the multiple joints, each depending on the angle and position of the joint it connects to. Well, I wouldn't consider that much of a challenge, anymore, but I wrote this when I was still pretty new to geometry.
  • Black Jack
    Download Source Code (zip), View Source Code (html), Screen Shot
    Black Jack Screenshot A very simple Black Jack game, made before I really understood how it was played in casinos. The game has no betting, and only uses one deck, so it's very easy to count cards. It does have pretty good graphics for such a simple game, though. One of my earlier attempts at using subroutines, though it still relies heavily on GOTO statements.
  • Fake DOS Emulator
    Download Source Code (zip), View Source Code (html), Screen Shot
    Fake DOS Emulator Screenshot Ah, the good old days of DOS. Who didn't try to write one of these fake DOS Emulators? This is a pretty simple one - it has a list of 10 comments that it will choose from randomly, plus a couple of built in responses to specific commands. And then at the very end, it tells you it's fed up and makes your screen go blank. The program kind of lost its magic after Windows 95 came out, but I figured, what the hell, maybe I can still find that unsuspecting user who hasn't upgraded to a graphical operating system, yet.
  • Tank Game
    Download Source Code (zip), View Source Code (html), Screen Shot
    Tank Game Screenshot A simple two-player "action" game. The controls were such that you only pressed buttons to change direction, aim or fire- you didn't have to hold buttons down. This eliminated a problem of many multi-player games where the keyboard input would be "frozen" while one person held down a certain key. There is also a simple computer opponent, with varying degrees of intelligence. It's never real good at hitting you, but it gets really good at dodging your shots.
Old Classics

These are two of my favorite games. They used to come standard on every computer, back in the days of DOS, but now they've become pretty hard to find. So, here they are, for your gaming pleasure. Note that I'm only giving the actual Q-BASIC program for download - no html version of the source code. A little disclaimer, in case you've never heard of these programs - I did not write them. They were copyrighted by Microsoft in 1990.

  • Gorilla
    Download Source Code (zip), Screen Shot
    Gorilla Screenshot Two gorillas standing on top of buildings in a city, throwing exploding bananas at each other. How much better can you get? This is the classic where you take turns typing in an angle and a power to throw your banana and try to hit your opponent. Varying wind conditions and a randomized city each round keep the game interesting. Hours of entertainment for free.
  • Nibbles
    Download Source Code (zip), Screen Shot
    Nibbles Screenshot Between this and Gorilla, this was the "action" game. One player or two player modes, you control a snake that goes around trying to gobble up numbers. With each number you eat, your snake grows by that amount. Higher levels have obstacles to make it more difficult, plus you can set it up to increase speed as you play. For those of you get errors when trying to run this program on a new computer, follow this link: Running Nibbles on a Fast Computer.



Questions? Comments? E-mail me: webmaster@jefflewis.net

Valid HTML 4.01!