] >
Write a program ‘chess.cpp’ that prepares a HTML file ‘chess.html’ specifying a chess-like board containing chess pieces. The program should get for an input a file ‘chess.txt’ with the following content.
row, column, color, type
The pieces are to be listed ordered row-wise within the table, and column-wise within the rows.
The HTML file should represent the pieces through unicode characters. The following table lists the characters.
| ♔ | ♔ | white king |
| ♕ | ♕ | white queen |
| ♖ | ♖ | white rook |
| ♗ | ♗ | white bishop |
| ♘ | ♘ | white knight |
| ♙ | ♙ | white pawn |
| ♚ | ♚ | black king |
| ♛ | ♛ | black queen |
| ♜ | ♜ | black rook |
| ♝ | ♝ | black bishop |
| ♞ | ♞ | black knight |
| ♟ | ♟ | black pawn |
Notes.
|
<html>
<head> <style type=’text/css’> table{ font-size:200%; margin-left: auto; margin-right: auto; border: 1px black solid } .white { background-color:#FFFFFF; color:#000000} .black { background-color:#B0B0B0; color:#000000} td{ width:1.3em; height:1.3em; text-align:center } </style> </head> <body> <table class=’chess’> <tr> <td class=’white’/> <td class=’black’/> <td class=’white’/> <td class=’black’/> </tr> <tr> <td class=’black’/> <td class=’white’/> <td class=’black’/> <td class=’white’>♞</td> </tr> <tr> <td class=’white’/> <td class=’black’/> <td class=’white’>♚</td> <td class=’black’>♙</td> </tr> <tr> <td class=’black’>♔</td> <td class=’white’/> <td class=’black’/> <td class=’white’>♖</td> </tr> </table> </body> </html> -_-_-
|
Suggestion. Build your program incrementally. For instance, as described below.
0101
1010
0101
1010
Hints.
Posting web pages. Web pages can be posted in the following manner on the CSE site.
mkdir ~/WWW
chmod 711 ~/WWW
cp chess.html ~/WWW/.
chmod 644 ~/WWW/chess.html
http://www.cse.ohio-state.edu/~your-user-name/chess.html