MacTech Network:   MacForge.net  |  Computer Memory  |  Register Domains  |  Printer Supplies  |  Cables  |  iPod Deals  |  Mac Deals  |  Mac Book Shelf


  MacTech Magazine

The journal of Macintosh technology

 
 
Shared Storage Easier

Magazine In Print
  About MacTech  
  Home Page  
  Subscribe  
  Archives DVD  
  Submit News  
  Submit a Tip!  
  Get a copy of MacTech RISK FREE  
Google
Entire Web
mactech.com
Mac Community
More...
MacTech Central
  by Category  
  by Company  
  by Product  
MacTech News
  MacTech News  
  Previous News  
  MacTech RSS  
Article Archives
  Show Indices  
  by Volume  
  by Author  
  Source Code FTP  
Inside MacTech
  Writer's Kit  
  Editorial Staff  
  Editorial Calendar  
  Back Issues  
  Advertising  
Contact Us
  Customer Service  
  MacTech Store  
  Legal/Disclaimers  
  Webmaster Feedback  

 May 2001 Programmer's Challenge

Basic Klondike

Mail solutions to: progchallenge@mactech.com
Due Date: 11:59pm ET, Tuesday, 1 May 2001

I'll admit it. I got into programming in an unusual way. Predating the web by a few (!) years, I didn't start with HTML or Perl. Nor, unlike some of my colleagues, did I start with a PC with toggle switches where the keyboard input should have been and with LED output instead of a video port. No, I actually started by reverse engineering machine code programs, and then discovering assembly language, and only later high level languages like FORTRAN and COBOL.

But somehow, through all that, I missed BASIC as a language, only discovering it much later, and never developing much of an attraction for it. But BASIC hasn't gone away, it is still alive and kicking as a modern object-oriented development environment. This month we're going to have some fun with BASIC, courtesy of the folks at REAL Software.

We've been using CodeWarrior for the Challenge for some time now, starting with C, expanding to C++, and allowing Pascal even though Metrowerks (or should I say Motorola) has deprecated that language. We've accepted Java solutions, although with some restrictions. But we've never even considered BASIC — after all, BASIC is a beginner's language, not used by serious programmers, right? Well, maybe not.

It turns out that there are real applications being written in BASIC. I discovered one, MacDynDNS, when I was forced to change DSL providers to one that didn't grant static IP addresses. So, when I was contacted by the folks at REAL Software about holding a REALbasic Challenge, I decided to experiment with their environment.

We're not in the business of endorsing products, but a little experimentation demonstrates that REALbasic is pretty cool. It converts BASIC into a fully object oriented language, and the environment does a surprising amount of the work required to create an application for you. They provide a nice tutorial that helps you quickly start using the environment. And they offer a free 30-day demo (see http://www.realbasic.com/), which we're going to take advantage of with this month's Challenge.

The prototype for the code you should write is …, well, there isn't one. Your task is to build a REALbasic application that lets me play the card game Klondike. Klondike is a solitaire card game, the object of which is to build up all 52 cards onto four foundation piles in ascending order, by suit, from the Ace to the King. As a reference implementation for what constitutes legal play, I'm using the shareware game by Mike Casteel available at www.casteel.org. The requirements? You need to display a graphical representation of the game — the cards in the tableau, the four foundation piles, the deck, and the top three cards revealed from the deck. You need to support playing cards and stacks of cards by dragging them from one pile to another. You should highlight the destination when a card is dragged to a position where it can legally be played and, of course, allow only legal moves to be made. You need to provide multiple levels of Undo and Redo. You should provide menu items to start a new game, to replay the previous game, to save the game state, and to resume playing a previously saved game. Your application should be user friendly, warning the user, for example, when s/he is about to quit an unfinished game. You should provide preference controls that allow me to turn over one card at a time instead of the usual three and control whether scoring is displayed.

How will I score this Challenge? This Challenge will be a departure from our usual reliance on execution time and program size. Apart from the requirement that the solution be "correct", the winner will be chosen based on features, usability, and elegance. As options, you might automatically detect when the game has been won. You can optionally play music. You can add attractive features that you think might gain my favor. The Challenge prize will be divided between the overall winner(s) and the best scoring entry from a contestant that has not won the Challenge recently.

And I'd appreciate hearing from you on what you think of this experiment in language and in scoring. If it proves to be popular, perhaps we'll try some more experiments like this one.


There is no test code for this Challenge.


You can get a head start on the Challenge by reading the Programmer's Challenge mailing list. It will be posted to the list on or before the 12th of the preceding month. To join, send an email to listserv@listmail.xplain.com with the subject "subscribe challenge-A". You can also join the discussion list by sending a message with the subject "subscribe challenge-D".



Click here to find out more about our best subscription bundle deal ever!
2 years of the magazine, and the all new MacTech DVD ... at 70% off!



Click on the cover to
see this month's issue!

TRIAL SUBSCRIPTION
Get a RISK-FREE subscription to the only technical Mac magazine!
 
 


MacTech Magazine. www.mactech.com
Toll Free 877-MACTECH, Outside US/Canada: 805-494-9797

Register Low Cost (ok dirt cheap!) Domain Names in the MacTech Domain Store. As low as $1.99!
Save on brand compatible and name brank ink jet and laser supplies.
Save on long distance * Upgrade your Computer
Movies with No Late Fees!

See local info about Westlake Village
SJ * BRJ * BJ * OJ * NITS
Staff Site Links



All contents are Copyright 1984-2008 by Xplain Corporation. All rights reserved.

MacTech is a registered trademark of Xplain Corporation. Xplain, Video Depot, Movie Depot, Palm OS Depot, Explain It, MacDev, MacDev-1, THINK Reference, NetProfessional, NetProLive, JavaTech, WebTech, BeTech, LinuxTech, Apple Expo, MacTech Central and the MacTutorMan are trademarks or service marks of Xplain Corporation. Sprocket is a registered trademark of eSprocket Corporation. Other trademarks and copyrights appearing in this printing or software remain the property of their respective holders.