Super Russian square v1.0 description documentation
Sumshua March 14, 2004
1 Introduction
1.1 project name and writer
Super Russian square v1.0 (dual mode)
Saxhua (010155) (xiasihua0001@yahoo.com.cn)
1.2 project introduction
This program implements the basic functions of the Russian square game. You can play a single game or online games through the TCP / IP protocol. Recommended Java's GUI, thread control, file read / write (IO), and SOKET-based network transfers. Or both single game, also double-machine online games. Suitable for running in JDK1.4.
1. 3 Writing
Write this procedure designed to have a more profound understanding of Java programming. Practice the application of Java language. And cultivate your own good Java programming style. Practice design pattern.
1.4 project background
After using this course for Java programs, the system is used to learn to prepare the knowledge to design in the course. The Java modules involved in this program include: Graphical Interface (GUI), Thread, Network, and Basic Input Output.
1.5 Main technical support and related reference
The Java knowledge involved in the project has: Java's GUI, thread control, and SOKET-based network transfers.
bibliography:
Java related electronic book
Thinking in java (Chinese version) (Machinery Industry Press)
Online related topic articles
2 game descriptions and use
2.1 Game origin, history, introduction
The Russian square is a popular global TV game machine and handheld game game. It has caused the economic value of the sensation and the economic value of the game. It is a big event in the history of the game. This game was originally made by the Soviet game producer Alex Pajitnov, which seems simple but changed, which is addictive. I believe that most users still remember the Russian era that was obsessed with tea.
In history, the Russian square has appeared on the PC, and my country's users have learned through red and white machines, like it. Now I want to achieve this popular game. For everyone, its rules are simple, easy to get started, and the game process is endless, and in the game I realized, there are more unique charms - there are two models of single-machine operations and two online fights, users can Optional one game.
2.2 Operation Environment
Briefly illustrate the rules for operating environment (including hardware environment and support environments) of the system.
l Hardware environment:
Processor frequency 600MHz or more, memory 1G or more, VGA video display, standard mouse, keyboard
l Software environment:
Ø Operating system: Windows2000 SP3 or more
Ø JDK1.4 or more
l Network requirements:
Requires the local area network to support TCP / IP protocols, and the LAN connection is best stable and smooth. (Playing network is required to fight)
Other Linux, Soralis, UNIX quite request
2.3 My game
My Russian square can be running online, or you can run in a single machine. In the following, the two modes are described separately:
1. Networking mode: Networking game runs the program on a computer, click RunServer in the menu, then run the program on another computer, click Runclient, enter the correct IP address to start the game. You can see each other on your computer.
2, stand-alone mode: Single-machine version of the game point selection menu newgame. Use the upper and lower left to control the game. "Up" is deformable, other control directions, the score and difficulty level will be displayed on the interface. In order to demonstrate convenience, when the difficulty of eliminates 10 lines, it will speed up the first level drop speed. Tips will be given when the game fails. -
Of course, the speed can be set before entering the system, and the number of rows and numbers of the square shape is easy to interface. 3 detailed design
3.1 System Plan:
Games and network instant transmission combine. During the composed process, the object-oriented programming method of inheritance, interface, etc. is used as much as possible.
3.2 Interior Design:
Internal object and method:
Game module:
Class Russiangame Extends Jframe
Main window class, display program main interface
Class OptionDialog Extends JDialog
Game Parameter Settings Selection Dialog
Class Russianpanel Extends JPanel
The class used to accept the keyboard message and plot the game interface.
Class Inserturscore Extends JDIALOG
This internal class processing will be added to the point list
Class Rsnarith
Algorithm support for Russian square games
Inner Class MyPoint Extends Point
Embodiment's built-in class for storage of all checkered information.
Class Diamonds
Part of the game algorithm. Storage square information. RussianPanel draws box on the screen based on the information of this class
Class IDiamonds Extends Diamonds
Storage of long strip square information
Class rldiamonds extends Diamonds
Storage L-type square information
Class Lldiamonds Extends Diamonds
Storage of anti-version information
Class Rsdiamonds Extends Diamonds
Save the right S type square information
Class Lsdiamonds Extends Diamonds
Store left S-type square information
Class Odiamonds Extends Diamonds
Storage Quartet Square
Class TDIAMONDS DIAMONDS
Storage T-type square information
Class L5Diamonds Extends Diamonds
Class R5Diamonds Extends Diamonds
Class Tridiamonds Extends Diamonds
Class Rgdiamonds Extends Diamonds
Class LGDiamonds Extends Diamonds
Squares that can be easily extended by Diamonds as a base class
Public Class Score
Processing game points
Class Scorereport Extends JDialog
Heroes list dialog
Class GameInfo
Contains static variables for the storage of game parameters, there is a bit like global variable
Public Class Handlerlogger
Used to handle exception handling and other types of logs
Network module:
Class Netthread Extends Thread
Threads for network connections. Provide a necessary function for subclasses as a parent class
Class ServerThread Extends NetthRead
Server-side thread
Class ClientThread Extends NetthRead
Client thread
Public Class Transinfo IMPLEMENTS SERIALIZABLE
The necessary information for storing network transmission. For example, the status of the current game.
When the client or server side checks to the game status change, it is sent to each other to display synchronization.
Description:
arrow
Indicates inheritance relationship, - horizontal line indicates that such a class is used or related. The box in the box represents the internal class.
3.3 Key Algorithm
The problem of Russian squares. The two-dimensional array is used, and the relative position coordinates for each point for a particular point. Specific program file Diamond.java.
3.4 Characteristic Russen:
1. Game parameter setting
2. Stand-alone game
3. Network fight
4. Heroes list (data persistence)
5. Abnormal, error, type description, etc. Log 6. Beautiful interface, human design