Perlan Chess
Perlan Chess is a simple application written in Perl, which must be run from the command line, in conjunction with an Oracle database. The purpose of the application is to provide a minimal client (no graphics) to manage a chess game via LAN. Some examples of practical use might be: teaching purposes (get familiar with Perl or SQL), research (experiment artificial intelligence or path finding algorithms) or simply ludic ( play chess on a local network).
How to use Perlan Chess
After having configured the database (see installation) and made sure you have a Perl interpreter (see tutorial) you can start play chess on Perlan Chess. To launch the program simply write:
perl DBoard.pl
then you must specify user and password, since the application manages several users. The passwords for the demo version can be found in the ReportUserDAO.pm
file (if you are lazy just type user : sa
, password : sa
).
After being authenticated you will be prompted by the main application menu. Here you can:
To exit any menu item press q
.
For more information about a single menu move the mouse over the items listed above.
Remark
The display of the pieces on the board is delegated to an Oracle database client (for example: Oracle SQL Developer).
The Perlan Chess application just prints (to video or on file) the SQL query
to be executed in order to display the current game, asking the user a question like the following:
Print monitor query on File or Screen (F/S)?
the query obtained in this way must be copied and pasted into the Oracle client, and executed to display the chessboard. Below is an example of the outcome resulting from this process.
Display of pieces on the chessboard (obtained using an Oracle client) should look like the following:
Where abbreviations T, C, A, R, D, P represent the white pieces, while abbreviations t, c, a, r, d, p represent the black spieces.
In the figure above the italian abbreviations have been used: to change the initials of the pieces (e.g to the english ones, which should be R, H, B, K, Q, P) edit the Data.pm
file. Notice that the column names are fictitious, because we are interested in only the first letter of each column (H, G, F, M, E, D, C, B, A), which together with the row number (columns R1 or R2) identify the coordinates of a piece on the chessboard.
How to move pieces
The fourth option of the main menu allows you to move the pieces on the board. Before moving a piece is usually necessary to consult the current board situation, by executing the query that displays the position of the pieces (see above). After this you will prompted by:
Action>>
where you must insert the starting coordinates (the position of the piece that you want to move). After this the same prompt will be repeated , asking you to enter the coordinates of arrival (where you want to move the piece). Example: the move E2-24 must be inserted as follows
Action>> E2
Action>> E4
coordinates can be written uppercase or lowcase.
Requirements and installation
In order to succesfully execute Perlan Chess you will need:
After having verified the Oracle installation we must create the database objects required by the application. Since we need only a few tables and few sequences is not necessary to create a new database, but you could decide to add the new tables to an already existing schema. To generate the required objects run the script :
init_database.sql
at this point we can initialize the database, which means to create some test users. To do this we un-comment the following statement in the file DBoard.pl
Database::ReportUserDAO->initUsers($db) ;
ed execute the main application:
perl DBoard.pl
By this mechanism some test users will be create, whose credentials are configured into the initUsers
procedure (see above).
To create a custom list of initial users you can edit the initUsers
method. Alternatively users can be entered manually using normal SQL INSERT in the database, making sure to encrypt passwords (using MD5) before to insert them in the SQL statements.
Important: immediately after initializing the database remember to edit again the DBoard.pl
file and and comment the statement:
# Database::ReportUserDAO->initUsers($db) ;
otherwise the application will attempt to add the "demo users" at each new execution (this is not an issue, since it's not possible to insert duplicate users, but would prevent you from running the application).
Download
Perlan Chess demo