Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Leopard Programming

  Like most people, you've probably thought that the skills that are required to build your own computer software are so advanced that you could never hope to become a programmer by trade or by hobby, but I'm here to tell you that it doesn't have to be that way. Sure, many modern programming languages are all about complexity, but there are ways to get started without having to break a mental sweat. When I first started programming, I was frustrated with the lack of tools for beginning programmers like myself, and this drove me to create the beginner's language that I never found once I polished my skills and gained more knowledge about programming. The result of my work is a programming language called Leopard, and it's been used by everyone from students to advanced programmers. I've always wanted the language to have a strong educational presence, and that's why I teamed up with WeatherBug to distribute the tool through their WeatherBug Achieve network of schools. In addition to practical usage scenarios in the classroom, this implementation of the abundance of live weather data that WeatherBug provides into a programming language makes it easy for anyone to create their own weather application. Of course, Leopard is a standard programming language, so you can create whatever you want with the included functions, and you're certainly not limited to using weather data. To give you an example of how quick and easy it is to create a program in Leopard, let's create an application that makes use of some WeatherBug data. Since summer is almost upon us and many of us are thinking about how nice it would be to relax on the beach right about now, I'll show you how to create a simple weather application that details what the conditions are like in Panama City.
Leopard Blog

Difficulty: Easy
Time Required: Less than 1 hour
Cost: Free
Software: Leopard v2.1
Hardware:
Download: Download

Creating a Window

To get started, the first thing that you need to do is specify the type of window that you want to use, which for this example is a regular window:

   1:  window

Now you enter the text that you want to appear in the title bar of the window:

   2:  window title
   3:  Sunburn Central

The only thing that's left to do is customize the size of the window:

   4:  window size
   5:  563
   6:  295

The first number is the width of the window, and the second number is the height. These numbers are declared in pixels.
That's all there is to it! You now have a basic window template to work from. Before showing you how to conclude and execute your program, let's first add all of the other components to our project.

Adding Controls

I want to add a live image of the beach to my program so that I can actually see what the current conditions are like, and thanks to WeatherBug's network of weather cameras, this isn't a problem:

   7:  weatherbug camera
   8:  PSMCT
   9:  10
  10:  10
 
The “PSMCT” reference is the name of the camera that I want to use, and you can find these camera names on the images from the WeatherBug InstaCam Web site (http://www.instacam.com). The two numbers represent the x and y coordinates where the image is to be placed on the window.
Now that the camera image is a part of my window, I also want to add a button:

  11:  button
  12:  SE Radar
  13:  350
  14:  10
  15:  183
  16:  50

SE Radar is the text that I want to appear on the button. The first two numbers stand for the x and y coordinates of the button, and the last two numbers represent the width and height of the button itself.

To complete the look of the window, I also want to add a WeatherBug control which will tell us what the current temperature and wind speed and direction is:

  17:  weatherbug
  18:  32403
  19:  180x150
  20:  350
  21:  95

32403 is the zip code that I want to retrieve the weather data for, and 180x150 is one of the predetermined sizes that I can use for this control. The final two numbers relate to the x and y coordinates of its location on the window.

Creating an Onclick Event

Since we've added a button to our window, we need to specify what that button does when it's clicked, and this is done by using an onclick event. Let's use this one:

  22:  button onclick
  23:  weatherbug radar
  24:  SE Radar
  25:  SE

That onclick command is now associated with the name of the control that's referenced (in this case, button), and it'll open up a WeatherBug radar map for us to examine. The title of the window that displays the map will be SE Radar, and the SE part of the code tells Leopard that we want to open the radar map for the southeast in order to see if there's any precipitation headed towards Panama City.

Playing Audio

Before we finish working on our project, let's add a fun extra feature to the program that'll help you feel like you're close to the beach even if you aren't. I found an MP3 file that contained ocean sounds, and in order to make it play when the program is first opened, use this code:

  26:  play mp3
  27:  ocean.mp3

Of course, you'll have to have a file called “ocean.mp3” in your Leopard directory in order for this to work.
Wrapping Things Up
The only thing that's left to do in terms of putting the finishing touches on the program is to issue the end command, which needs to be placed at the end of every Leopard program:

  28:  end

Piece of cake, right? Included below is the entire program from start to finish with some comments thrown in to help you make sense of what's going on. Anything that's not a command or part of a command set is treated like a comment by Leopard.

: Let's create our window. :

   1:  window
   2:   
   3:  window title
   4:  Sunburn Central
   5:   
   6:  window size
   7:  563
   8:  295
   9:   
  10:  weatherbug camera
  11:  PSMCT
  12:  10
  13:  10
  14:   
  15:  button
  16:  SE Radar
  17:  350
  18:  10
  19:  183
  20:  50
  21:   
  22:  weatherbug
  23:  32403
  24:  180x150
  25:  350
  26:  95
  27:   
  28:  button onclick
  29:  weatherbug radar
  30:  SE Radar
  31:  SE
  32:   
  33:  play mp3
  34:  ocean.mp3
  35:   
  36:  end

If you're interested, you can download a zip file that contains the complete program file as well as the MP3 file from here and then extract the contents of this file to your Leopard directory.

image 

Conclusion
As you can see, programming in Leopard is unbelievably easy, and we've just scratched the surface of what you can do with the language! Please feel free to experiment with Leopard and send us your work so that we can share it with your fellow programmers. Programming doesn't have to be hard, but it can be fun, thanks to Leopard!

Brandon Watts
brandonwatts@gmail.com

Follow the Discussion

  • Computer GuyComputer Guy

    Cool, but does it leverage exist technology? I would hate for someone to get boxed in? Deos it allow once you gain knowledge to move to a bigger Language?

    Where am I going with this you ask? I'm wondering how the new language stacks up with KPL (http://www.kidsprogramminglanguage.com/) and/or phrogram (http://phrogram.com/search/SearchResults.aspx?q=.net)

    The big selling point of those two is the connection with .NET and being able to export or compile into C# allow the beginner once ready to step up can leave KPL or phrogram and start C# or VB.

    This almost look like Turtle or something.

  • Simon BrownSimon Brown

    As a reponse to "Computer Guy", I know that leopard is written in Liberty BASIC (www.libertybasic.com) and if anything would offer the facility to convert to that. Leopard is designed to be the simplest language to possibly exist.

  • PaxPax

    @Computer Guy

    There's always someone in the room that wants to turn any language created into the next C++ or Java or something else. Sigh...

    You completely miss the point of this language. It CAN work as a stand alone. I work with many different technologies. Some can be segued into another but that is never the point. When I work in BASH, I do so because that's the best tool for a specific job.

    When I work with JS, it's because it's the best solution for what I'm doing. The same thing when I need to work with DOS Batch Scripts, C, C++.

    Right now I'm working on game design that uses a language I haven't worked with before and whose language logic is completely different from anything I've ever worked with before. You know what... I will be able to turn out a complete FPS in a couple of weeks in what could've taken months in C++.

    Since you don't understand how it's possible to work with different tools to get certain things done - you should probably stay away from programming AND computers in general.

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.