To play BINGO, a Game application must be running somewhere on your network and you must run the Player application. Any number of Player applications can play against each other using the same Game application. So if you run the Game application on your machine, you can invite your friends to play with you. If you are playing against a Game running on someone else's machine you can skip steps 3 and 4.
Both the Game and the Player use the JFC components in the "Swing" release. Follow the steps outlined in Getting Started with Swing to download the Swing release and to set up your environment.
Here are the steps to building and playing BINGO:
- Step 1: Download the Source
- Step 2: Compile the Source
- Step 3: Run the Game
- Step 4: Start the Games
- Step 5: Run the Player
- Step 6: Join the Next Game
- Step 7: Play
Step1: Download the SourceMore than 40 source files comprise this example. For your convenience, we include a downloadable zip archive that contains all of the source files necessary to build the BINGO Player and Game applications.
Download the zip archive
Step 2: Compile the SourceHere's an example of building the BINGO Player and Game applications:1> /java/jdk1.1.5/bin/javac -classpath \ .:/java/swing-1.0/swing.jar:/java/jdk1.1.5/lib/classes.zip \ bingo/game/*.java 2> /java/jdk1.1.5/bin/rmic bingo.game.RegistrarImpl 3> mv RegistrarImpl_*.class bingo/game 4> /java/jdk1.1.5/bin/javac -classpath \ .:/java/swing-1.0/swing.jar:/java/jdk1.1.5/lib/classes.zip \ bingo/player/*.java
Step 3: Run the GameBefore running the Game application you have to run the RMI registry program. Typically, you will run this program as a background process:This program is used with RMI to register remote objects.% rmiregistry &
Some notes about running
rmiregistry: You must have your classpath environment set, and it must have '.' in it when you run
rmiregistry. Otherwise, when you run the Game you will get an error message that says it can't find the
If you already have an
rmiregistryrunning, you will get an error to the effect that port 1099 is busy. You have three options:
- don't worry about it and just run the Game,
- kill the
rmiregistryprocess and start it up again, or
- run another
rmiregistryand specify a different port.
Now, run the Game application. To do this, follow the directions outlined in Getting Started with Swing that describe how to run a Swing application. If all goes well, you will see this window displayed on your screen:
Step 4: Start the GamesTo start the games rolling:
The Game will continually serve up games until you stop them by clicking the No More New Games button (or kill the Game process). This button just tells the Game not to start any more games after the current game is finished. Pushing this button will not stop the current game.
- Enter the number of seconds the game should pause between calling balls. If you want a fast game with one card, 3 seconds works well. Add a couple of seconds for each additional card. If many players are playing consider using 10 - 20 seconds.
- After the first player registers, the Game begins a count down. During the countdown period other players can register for this game. After the countdown period expires the game begins and registration closes for this game. Enter how long the countdown period should last. If you're playing alone, use 10 seconds so that there's enough time for the CardWindow to appear after the Player has joined the game.
- Enter the maximum number of players allowed to play in a single game.
- Enter the maximum number of cards each player is allowed to play in a single game.
- Push the Let the Games Begin button.
Step 5: Run the PlayerNow run the Player and instruct your friends to run the Player as well. The Player also uses Swing components, so you must run the Player as described in Getting Started with Swing.
If all goes well, you should see this window displayed on your screen:
Step 6: Join the Next GameTo join the next game, follow these steps:
- If you want, type in your name.
- If you want, type in a different seed value. This is the value used to generate your BINGO cards. The default value is the return value from
System.currentTimeMilliswhen the window gets created. You will always play the same cards if you always use the same seed.
- Type the host name where the Game is running. The Player application figures out the name of the host on which the Player application is running and enters this name in the hostname textfield. If you are running your own Game then you can just leave this value as is. If you want to play with a Game running on another machine, type the name of that machine into the text field.
- Choose the number of cards you'd like to play.
- Click the Join the Next Game button.
If you're running a Game then you should see your name appear in the player list.
After a time, you will see one of these windows for each card you requested.
Step 7: PlayPeriodically, the Game announces a BINGO ball. The current ball is displayed on the left side of the player's light board. The right side shows all of the balls that have been called in this game thus far.Mark the numbers on your card as the balls are called. When you have 5 adjacent numbers marked horizontally, vertically or diagonally, push the I Won! BINGO I Won! button.
If you really won, the Game will stop the current game, and tell you that you've won. If not, the current game continues until somebody wins, or until the balls run out.
But wait! Don't push the I Won! BINGO I Won! button too often. If you "cry wolf" (push the I Won! BINGO I Won! button and don't have a winning card) three times, you're kicked out of the game. After all, that's very disruptive to the other players!