Use the applet for your own web pages
Bruno Causse designed a very nice Othello applet viewer which was modified by Emmanuel Lazard and Stéphane Nicolet. They all agree to let anyone download and use this applet for personal use.
This applet displays an Othello game in a webpage and enables the viewer to replay though the game one move at a time, forward and backward.
It looks like this:
To add this applet to a page, first download it and put the .jar file next to your html file.
The code to use the applet looks like this:
<applet name="OthelloViewer2" archive="OthelloViewer2.jar" code="OthelloViewer2.class" width="300" height="315">
<param name = "background" value="#88bb88">
<param name = "position" value="---------------------------0X------X0--------------------------- X">
<param name = "ListMoves" value="f5d6c5f4e3c6d3f6e6d7">
<param name = "playMoves" value="5">
</applet>
The applet parameters have the following signification:
- background : background colour.
- position : The board starting position. The last character gives the colour to move. If not present, the usual starting position will be used.
- ListMoves : List of moves which can be played by the user.
- playMoves : Number of moves to be played before displaying the board. If a value of 0 is given, the applet will show the starting position (given by the corresponding parameter) and the user will be able to play the moves forward. If the value is 60 (or any number greater than the number of moves), the applet will display the final position.
Displaying information
If you wish to display some information about the game, you can add two parameters that will be displayed underneath the board.
if none are present, the applet will be displayed without the information panel (see applet on top of page).
Beware that if some information is displayed, the height of the applet must be increased from 315 to 350.
The first version (applet on the left) displays two lines of information given by the webpage, nothing will be added by the applet. The two parameters are:
- place : first line of information (tournament name for example).
- players : second line of information (players and score for example).
If the place parameters is absent, the second one will be displayed on the first line.
The code used to generate the applet on the left is:
<applet name="OthelloViewer2" archive="OthelloViewer2.jar" code="OthelloViewer2.class" width="300" height="350">
<param name = "background" value="#88bb88">
<param name = "position" value="---------------------------0X------X0--------------------------- X">
<param name = "ListMoves" value="f5d6c5f4e3c6d3f6e6d7">
<param name = "playMoves" value="5">
<param name = "place" value="Vladivostok Open">
<param name = "players" value="A. Karpov 15-49 V. Korchnoi">
</applet>
The second version (applet on the right) displays two lines of information given by the webpage with an automatically added score between the players. The three parameters are:
- place : first line of information (tournament name for example).
- BPlayer : Black player, will be left-justified.
- WPlayer : White player, will be right-justified.
The final score (after playing the full list of moves) will be added by the applet and centered between the two players.
The code used to generate the applet on the left is:
<applet name="OthelloViewer2" archive="OthelloViewer2.jar" code="OthelloViewer2.class" width="300" height="350">
<param name = "background" value="#88bb88">
<param name = "position" value="---------------------------0X------X0--------------------------- X">
<param name = "ListMoves" value="f5d6c5f4e3c6d3f6e6d7">
<param name = "playMoves" value="5">
<param name = "place" value="Vladivostok Open">
<param name = "BPlayer" value = "Anatoly Karpov">
<param name = "WPlayer" value = "V. Korchnoi">
</applet>
Some methods are exported by the applet and can be used in a javascript program:
- document.OthelloViewer2.listOfMovesToString() : returns the list of moves
- document.OthelloViewer2.getNumberOfBlackDiscs() : returns number of black discs
- document.OthelloViewer2.getNumberOfWhiteDiscs() : returns number of white discs
If you cannot add the
.jar file next to your
.html file, you can directly point to the archive on
liveothello.com: just add
codebase="http://www.liveothello.com/" to the applet tag, between
archive and
code. But of course be aware that any change I shall make to the archive will be reflected in your pages.