Click here to Skip to main content
15,922,407 members
Articles / Mobile Apps / Windows Mobile

Black Box for the Pocket PC

Rate me:
Please Sign up or sign in to vote.
2.36/5 (7 votes)
28 May 2004CPOL2 min read 47.5K   251   11   1
A cool puzzle game for the PocketPC.

Sample Image - pocketblackbox2.jpg


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.


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


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

Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

GeneralI can't Debug on Pocket PC2002 Emulator [modified] Pin
tr_hoaiphong23-Jun-06 22:26
tr_hoaiphong23-Jun-06 22:26 
+ I have applicaton, i write on PocketPC 2002 Emulator, but :
+ When i press F5 , my application not show on Pocket PC, i go to directory of my application and run it. but i can't debug my App.
+ But i press Ctrl + F5 , my application show on Pocket PC, but i can't debug my app
+ And it show Message :
Error while trying to run project: Unable to start debugging. + Pocket PC Emulator

+ I'm using VS2003, FW1.1
Help! Thanks
Please send mail to :


-- modified at 8:44 Saturday 24th June, 2006

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

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