Click here to Skip to main content
Click here to Skip to main content

Black Box for the Pocket PC

, 28 May 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
A cool puzzle game for the PocketPC.

Sample Image - pocketblackbox2.jpg

Introduction

Black box is a simple and fun puzzle game to play in one’s free time. My initial approach at this project was to write the program utilizing VS 6.0 in C++. However, utilizing the .NET Compact Framework and writing the code in C#, I was able to create a nifty little application usable on any platform running the framework, with great ease, more efficiently and in less time.

How to play

The goal of the game is to find all the magnets on the board. The number of magnets is set in the Magnets menu. Green tiles are the light beams that are emitted whether they be source or destination. Clicking on a light beam opens it and its destination, assigning a number to it. The magnets in the game are positioned in a way that all beams travel to their destination point and from destination to source. The magnets in the game diverts the light in perpendicular directions of the magnet's edge or reflects light back in the same direction. A magnet has 4 edges, so there are 4 total ways light can be diverted and has 4 faces for a total of 4 reflected beams. Your task is to determine the position of the magnets on the board given the start and end points of each beam, mark each magnet with a flag, and you’ll win when you flagged all of the magnets (sort of like minesweeper).

Points of Interest

The application is optimized for the Pocket PC environment by minimizing the amount of resources used during play. The implementation of the game limits the amount of information to render by only re-rendering the changed tiles of the game at any given point.

Black box was designed to have the same look and feel in both platforms by resizing the main form of the application and that was all that was required to do, making it an unbelievably easy to write app that runs on both platforms without a build.

Using the code

Here are a few things that are in this app which might be useful (I often forget stuff like this and it’s nice to be able to look it up):

  • Operator overloading - the Vec struct uses operator overloading so that you can use normal vector notation for addition, multiplication and such. This makes the code a lot easier to read and shows why Java isn’t nearly as cool as C#.
  • [] operator overloading - this is useful to allow for strongly typed collections. The Box class uses this to make a 2D matrix storage structure using a single 1D array.

Thanks

  • MSDN for all the cool coding samples.
  • Lewey Geselowitz - gave me some tips for writing the app and helped me get it setup.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

rb01usa

United States United States
No Biography provided

Comments and Discussions

 
GeneralI can't Debug on Pocket PC2002 Emulator [modified] Pinmembertr_hoaiphong23-Jun-06 23:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141223.1 | Last Updated 29 May 2004
Article Copyright 2004 by rb01usa
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid