[jetrix-cvs] SF.net SVN: jetrix:[743] jetrix/trunk
Brought to you by:
smanux
From: <sm...@us...> - 2008-08-27 09:22:19
|
Revision: 743 http://jetrix.svn.sourceforge.net/jetrix/?rev=743&view=rev Author: smanux Date: 2008-08-27 09:22:05 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Full documentation of the tetrinet 1.14 extension Implemented the tetrinet random number generator Modified Paths: -------------- jetrix/trunk/pom.xml jetrix/trunk/project.properties jetrix/trunk/project.xml jetrix/trunk/src/etc/README jetrix/trunk/src/java/net/jetrix/filter/GenericFilter.java jetrix/trunk/src/java/net/jetrix/filter/package.html jetrix/trunk/src/site/dev-guide.php jetrix/trunk/src/site/index.php jetrix/trunk/src/site/menu.inc.php Added Paths: ----------- jetrix/trunk/src/java/net/jetrix/tools/TetrinetRandomGenerator.java jetrix/trunk/src/site/images/blocks/ jetrix/trunk/src/site/images/blocks/halfcross1.png jetrix/trunk/src/site/images/blocks/halfcross2.png jetrix/trunk/src/site/images/blocks/halfcross3.png jetrix/trunk/src/site/images/blocks/halfcross4.png jetrix/trunk/src/site/images/blocks/leftl1.png jetrix/trunk/src/site/images/blocks/leftl2.png jetrix/trunk/src/site/images/blocks/leftl3.png jetrix/trunk/src/site/images/blocks/leftl4.png jetrix/trunk/src/site/images/blocks/leftz1.png jetrix/trunk/src/site/images/blocks/leftz2.png jetrix/trunk/src/site/images/blocks/line1.png jetrix/trunk/src/site/images/blocks/line2.png jetrix/trunk/src/site/images/blocks/rightl1.png jetrix/trunk/src/site/images/blocks/rightl2.png jetrix/trunk/src/site/images/blocks/rightl3.png jetrix/trunk/src/site/images/blocks/rightl4.png jetrix/trunk/src/site/images/blocks/rightz1.png jetrix/trunk/src/site/images/blocks/rightz2.png jetrix/trunk/src/site/images/blocks/square.png jetrix/trunk/src/test/net/jetrix/tools/TetrinetRandomGeneratorTest.java Modified: jetrix/trunk/pom.xml =================================================================== --- jetrix/trunk/pom.xml 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/pom.xml 2008-08-27 09:22:05 UTC (rev 743) @@ -12,7 +12,7 @@ Jetrix is a new generation TetriNET server written in Java and designed for maximum scalability, extensibility and ease of use. It features a web based administration console and a simple API - to let developpers add custom commands or change the channels' + to let developers add custom commands or change the channels' behavior with little knowledge of the server's inner functioning. The ambitious goal of this project is to create the ideal plateform for server side TetriNET programmers. Jetrix is open source and @@ -126,12 +126,14 @@ <groupId>jetty</groupId> <artifactId>jetty</artifactId> <version>4.1-rc1</version> + <optional>true</optional> </dependency> <dependency> <groupId>jcrontab</groupId> <artifactId>jcrontab</artifactId> <version>1.4.1</version> + <optional>true</optional> </dependency> <!-- Needed for testing --> @@ -139,7 +141,7 @@ <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.2</version> - <scope>tests</scope> + <scope>test</scope> </dependency> </dependencies> Modified: jetrix/trunk/project.properties =================================================================== --- jetrix/trunk/project.properties 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/project.properties 2008-08-27 09:22:05 UTC (rev 743) @@ -1,5 +1,5 @@ version=0.3-dev -version.stable=0.2.2 +version.stable=0.2.3 maven.junit.fork=true maven.junit.dir=target/test-classes Modified: jetrix/trunk/project.xml =================================================================== --- jetrix/trunk/project.xml 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/project.xml 2008-08-27 09:22:05 UTC (rev 743) @@ -19,7 +19,7 @@ Jetrix is a new generation TetriNET server written in Java and designed for maximum scalability, extensibility and ease of use. It features a web based administration console and a simple API - to let developpers add custom commands or change the channels' + to let developers add custom commands or change the channels' behavior with little knowledge of the server's inner functioning. The ambitious goal of this project is to create the ideal plateform for server side TetriNET programmers. Jetrix is open source and Modified: jetrix/trunk/src/etc/README =================================================================== --- jetrix/trunk/src/etc/README 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/etc/README 2008-08-27 09:22:05 UTC (rev 743) @@ -6,7 +6,7 @@ Jetrix is a new generation TetriNET server written in Java and designed for maximum scalability, extensibility and ease of use. It features a web based administration console and a simple API - to let developpers add custom commands or change the channels' + to let developers add custom commands or change the channels' behavior with little knowledge of the server's inner functioning. The ambitious goal of this project is to create the ideal plateform for server side TetriNET programmers. Jetrix is open source and @@ -14,8 +14,8 @@ Installing & Running Jetrix - You need a JRE 1.5 or higher installed on your server to run Jetrix. - You can download it here : http://java.sun.com/j2se/1.5.0/download.jsp + You need Java 6 or higher installed on your server to run Jetrix. + You can download it here : http://java.sun.com/j2se/1.6.0/download.jsp Unix @@ -23,7 +23,7 @@ JAVA_HOME environnement variable pointing to your Java directory. For example on Linux you can add this line to your /etc/profile file: - export JAVA_HOME=/usr/java/jre_1.5.0 + export JAVA_HOME=/usr/java/jre_1.6.0 Then decompress the Jetrix archive to the installation directory: Modified: jetrix/trunk/src/java/net/jetrix/filter/GenericFilter.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/filter/GenericFilter.java 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/java/net/jetrix/filter/GenericFilter.java 2008-08-27 09:22:05 UTC (rev 743) @@ -26,7 +26,7 @@ import net.jetrix.messages.*; /** - * Defines a generic filter to be used and extended by filter developpers. + * Defines a generic filter to be used and extended by filter developers. * GenericFilter makes writing filters easier by dispatching messages to an * appropriate method according to the type of this message (onPline(), * onStartGame(), etc...). Modified: jetrix/trunk/src/java/net/jetrix/filter/package.html =================================================================== --- jetrix/trunk/src/java/net/jetrix/filter/package.html 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/java/net/jetrix/filter/package.html 2008-08-27 09:22:05 UTC (rev 743) @@ -3,7 +3,7 @@ Contains concrete {@link net.jetrix.filter.MessageFilter} implementations. {@link net.jetrix.filter.GenericFilter} provides a high level implementation ready to handle all Jetrix messages. For more information regarding filters get -a look at the <a href="http://jetrix.sourceforge.net/dev-guide.php">Developper +a look at the <a href="http://jetrix.sourceforge.net/dev-guide.php">Developer Guide</a> available on the website. </body> </html> Added: jetrix/trunk/src/java/net/jetrix/tools/TetrinetRandomGenerator.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/tools/TetrinetRandomGenerator.java (rev 0) +++ jetrix/trunk/src/java/net/jetrix/tools/TetrinetRandomGenerator.java 2008-08-27 09:22:05 UTC (rev 743) @@ -0,0 +1,55 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.tools; + +/** + * Random number generator used by Tetrinet (ie. the Random() function in Delphi) + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class TetrinetRandomGenerator +{ + private static final int INCREMENT = 1; + private static final int MULTIPLIER = 0x08088405; + private static final long MODULUS = 0x100000000L; + + private long value; + + public TetrinetRandomGenerator(int seed) + { + this.value = seed; + } + + public long getValue() + { + return value; + } + + public synchronized int nextInt(int L) { + nextValue(); + + return (int) (value * L >> 32); + } + + void nextValue() { + value = (MULTIPLIER * value + INCREMENT) % MODULUS; + } +} Property changes on: jetrix/trunk/src/java/net/jetrix/tools/TetrinetRandomGenerator.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: jetrix/trunk/src/site/dev-guide.php =================================================================== --- jetrix/trunk/src/site/dev-guide.php 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/site/dev-guide.php 2008-08-27 09:22:05 UTC (rev 743) @@ -1,17 +1,19 @@ <? include("header.inc.php") ?> -<h1>Developper Guide</h1> +<h1>Developer Guide</h1> <h2>Table of Contents</h2> <ol> + <!--<li><a href="#section0">Developing with Jetrix</a></li>--> <li><a href="#section1">Architecture</a></li> <li><a href="#section2">Protocols</a> <ul> - <li><a href="#section2-1">TetriNET</a></li> - <li><a href="#section2-2">TetriFast</a></li> - <li><a href="#section2-3">TSpec</a></li> - <li><a href="#section2-4">Query</a></li> + <li><a href="#section2-1">TetriNET 1.13</a></li> + <li><a href="#section2-2">TetriNET 1.14</a></li> + <li><a href="#section2-3">TetriFast</a></li> + <li><a href="#section2-4">TSpec</a></li> + <li><a href="#section2-5">Query</a></li> </ul> </li> <li><a href="#section3">Customization</a> @@ -23,7 +25,16 @@ </li> </ol> +<!-- +<h1><a id="section0"></a>Developing with Jetrix</h1> +@todo + +installing the JDK + +installing & using Apache Ant +--> + <h1><a id="section1"></a>Architecture</h1> Jetrix is designed around the concept of independant threads communicating asynchronously with messages. The three main entities are : @@ -39,21 +50,300 @@ <h1><a id="section2"></a>Protocols</h1> -<h2><a id="section2-1"></a>TetriNET</h2> +<h2><a id="section2-1"></a>TetriNET 1.13</h2> -<h3>Login</h3> +External references: -<h3>Channel Messages</h3> +<ul> + <li><a href="http://knarf2.cheztaz.com/tetrinet.html">Description du protocole TetriNET par knarf2 (french)</a></li> + <li><a href="http://web.archive.org/web/20040413185025/home.planetinternet.be/~m0217000/tsrv/tetrinetproto.htm">Tetrinet protocol on TSRV.COM (archived)</a></li> +</ul> -<h3>Game Messages</h3> +<h2><a id="section2-2"></a>TetriNET 1.14</h2> -<h2><a id="section2-2"></a>TetriFast</h2> +The version 1.14 of the TetriNET protocol is an extension introduced by +Olivier Vidal in August 2003 allowing players to get the same sequence of +blocks. This protocol was first integrated to a server in Jetrix 0.1.3. It +works by adding an extra parameter at the end of the newgame command: -The TetriFast protocol is quite similar to the TetriNET protocol, it has just -been slightly modified to prevent TetriFast clients to connect and cheat on -regular TetriNET servers. +<div class="code">newgame 0 1 2 1 2 1 18 <blocks frequency array> <specials frequency array> 1 1 <b>2A1C21B6</b></div> +The parameter <tt>2A1C21B6</tt> is actually the hexadecimal representation of a +32 bits integer. It determines the seed of the random number generator used by +TetriNET to generate the blocks (see bellow). The number must be zero padded +to 8 digits and use the little endian format. For example <tt>0x123</tt> will +be added as <tt>00000123</tt>. + + +<h3>TetriNET Pseudo Random Number Generator</h3> + +<p>The original TetriNET client designed by St0rmCat uses the standard random +function available in Delphi. It's basically a <a href="http://en.wikipedia.org/wiki/Linear_congruential_generator">linear congruential generator</a>, +the recursive sequence is defined by:</p> + +<div class="code">s<sub>n+1</sub> = (a.s<sub>n</sub> + c) mod M</div> + +<p>with the following parameters:</p> + +<div class="code">a = 0x08088405 +c = 1 +M = 2<sup>32</sup> +</div> + +<p>The seed s<sub><small>0</small></sub> is determined by the last parameter of +the <tt>newgame</tt> message. This sequence gives pseudo random integers between +0 and 2<sup><small>32</small></sup> - 1, but an integer in the [0, 100[ +range is required for selecting the block, and an integer in the [0, 4[ range +for the orientation of the block. So the result is multiplied by the length of +the range and divided by 2<sup><small>32</small></sup>:</p> + +<div class="code">I<sub>n</sub> = s<sub>n</sub> * L / 2<sup><small>32</small></sup></div> + +<p>Where L=100 to select the block and L=4 to select its orientation. The +sequence s<sub><small>n</small></sub> is evaluated twice to determine each block, first for the block +and then for its orientation.</p> + +<p>The following table defines the orientations for each type of block :</p> + +<table class="thin"> + <tr> + <th width="100">Orientation</th> + <th width="75">0</th> + <th width="75">1</th> + <th width="75">2</th> + <th width="75">3</th> + </tr> + <tr> + <th>Line</th> + <td><img src="images/blocks/line1.png" alt="Line"/></td> + <td><img src="images/blocks/line2.png" alt="Line"/></td> + <td><img src="images/blocks/line1.png" alt="Line"/></td> + <td><img src="images/blocks/line2.png" alt="Line"/></td> + </tr> + <tr> + <th>Square</th> + <td><img src="images/blocks/square.png" alt="Square"/></td> + <td><img src="images/blocks/square.png" alt="Square"/></td> + <td><img src="images/blocks/square.png" alt="Square"/></td> + <td><img src="images/blocks/square.png" alt="Square"/></td> + </tr> + <tr> + <th>Left L</th> + <td><img src="images/blocks/leftl1.png" alt="Left L"/></td> + <td><img src="images/blocks/leftl2.png" alt="Left L"/></td> + <td><img src="images/blocks/leftl3.png" alt="Left L"/></td> + <td><img src="images/blocks/leftl4.png" alt="Left L"/></td> + </tr> + <tr> + <th>Right L</th> + <td><img src="images/blocks/rightl1.png" alt="Right L"/></td> + <td><img src="images/blocks/rightl2.png" alt="Right L"/></td> + <td><img src="images/blocks/rightl3.png" alt="Right L"/></td> + <td><img src="images/blocks/rightl4.png" alt="Right L"/></td> + </tr> + <tr> + <th>Left Z</th> + <td><img src="images/blocks/leftz1.png" alt="Left Z"/></td> + <td><img src="images/blocks/leftz2.png" alt="Left Z"/></td> + <td><img src="images/blocks/leftz1.png" alt="Left Z"/></td> + <td><img src="images/blocks/leftz2.png" alt="Left Z"/></td> + </tr> + <tr> + <th>Right Z</th> + <td><img src="images/blocks/rightz1.png" alt="Right Z"/></td> + <td><img src="images/blocks/rightz2.png" alt="Right Z"/></td> + <td><img src="images/blocks/rightz1.png" alt="Right Z"/></td> + <td><img src="images/blocks/rightz2.png" alt="Right Z"/></td> + </tr> + <tr> + <th>Half Cross</th> + <td><img src="images/blocks/halfcross1.png" alt="Half Cross"/></td> + <td><img src="images/blocks/halfcross2.png" alt="Half Cross"/></td> + <td><img src="images/blocks/halfcross3.png" alt="Half Cross"/></td> + <td><img src="images/blocks/halfcross4.png" alt="Half Cross"/></td> + </tr> +</table> + + + +<h3>Examples</h3> + +<p>Here are some examples of block sequences for different seed values. This might +help client programmers to validate their random number generator. The frequencies +for these examples are :</p> + +<table class="thin" style="width: 300px"> + <tr> + <th align="center" colspan="2">Block</th> + <th align="center" width="30%">Frequency</th> + </tr> + <tr> + <td align="center" width="10%">1</td> + <td align="center"><img src="/images/blocks/small/line.png" alt="Line" /></td> + <td align="center">15 %</td> + </tr> + <tr> + <td align="center">2</td> + <td align="center"><img src="/images/blocks/small/square.png" alt="Square" /></td> + <td align="center">15 %</td> + </tr> + <tr> + <td align="center">3</td> + <td align="center"><img src="/images/blocks/small/leftl.png" alt="Left L" /></td> + <td align="center">14 %</td> + </tr> + <tr> + <td align="center">4</td> + <td align="center"><img src="/images/blocks/small/rightl.png" alt="Right L" /></td> + <td align="center">14 %</td> + </tr> + <tr> + <td align="center">5</td> + <td align="center"><img src="/images/blocks/small/leftz.png" alt="Left Z" /></td> + <td align="center">14 %</td> + </tr> + <tr> + <td align="center">6</td> + <td align="center"><img src="/images/blocks/small/rightz.png" alt="Right Z" /></td> + <td align="center">14 %</td> + </tr> + <tr> + <td align="center">7</td> + <td align="center"><img src="/images/blocks/small/halfcross.png" alt="Half Cross" /></td> + <td align="center">14 %</td> + </tr> +</table> + +<br /> + +The corresponding frequency table is : + +<div class="code">F = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7]</div> + +<p>For this example the value of the seed is 0.</p> + +<table class="thin"> + <tr> + <th width="100">Blocks</th> + <th width="150">Sequence</th> + <th width="100">Index</th> + <th width="100">Result</th> + </tr> + <tr> + <td rowspan="2" valign="middle">Block 1</td> + <td>s1 = 0x00000001</td> + <td>0</td> + <td rowspan="2" valign="middle"><img src="images/blocks/line1.png" alt="Line"/></td> + </tr> + <tr> + <td>s2 = 0x08088406</td> + <td>0</td> + </tr> + <tr> + <td rowspan="2" valign="middle">Block 2</td> + <td>s3 = 0xDC6DAC1F</td> + <td>86</td> + <td rowspan="2" valign="middle"><img src="images/blocks/halfcross1.png" alt="Half Cross"/></td> + </tr> + <tr> + <td>s4 = 0x33DC589C</td> + <td>0</td> + </tr> + <tr> + <td rowspan="2" valign="middle">Block 3</td> + <td>s5 = 0x45DE2B0D</td> + <td>27</td> + <td rowspan="2" valign="middle"><img src="images/blocks/square.png" alt="Square"/></td> + </tr> + <tr> + <td>s6 = 0xABF18B42</td> + <td>2</td> + </tr> + + <tr> + <td rowspan="2" valign="middle">Block 4</td> + <td>s7 = 0x5195C04B</td> + <td>31</td> + <td rowspan="2" valign="middle"><img src="images/blocks/leftl1.png" alt="Left L"/></td> + </tr> + <tr> + <td>s8 = 0x296B6D78</td> + <td>0</td> + </tr> +</table> + + +<p>Here are the 10 first blocks for different seed values:</p> + +<table class="thin" cellspacing="1"> + <tbody> + <tr> + <th>Seed</th> + <th>Sequence</th> + </tr> + <tr> + <td>0x00000000</td> + <td> + <img src="images/blocks/line1.png"/> + <img src="images/blocks/halfcross1.png"/> + <img src="images/blocks/square.png"/> + <img src="images/blocks/leftl1.png"/> + <img src="images/blocks/leftl4.png"/> + <img src="images/blocks/line2.png"/> + <img src="images/blocks/line2.png"/> + <img src="images/blocks/line2.png"/> + <img src="images/blocks/halfcross4.png"/> + <img src="images/blocks/leftz2.png"/> + </td> + </tr> + <tr> + <td>0xAABBCCDD</td> + <td> + <img src="images/blocks/rightl4.png"/> + <img src="images/blocks/rightl4.png"/> + <img src="images/blocks/leftl1.png"/> + <img src="images/blocks/leftl3.png"/> + <img src="images/blocks/square.png"/> + <img src="images/blocks/rightz2.png"/> + <img src="images/blocks/square.png"/> + <img src="images/blocks/rightl4.png"/> + <img src="images/blocks/halfcross3.png"/> + <img src="images/blocks/rightl1.png"/> + </td> + </tr> + <tr> + <td>0x12345678</td> + <td> + <img src="images/blocks/leftz2.png"/> + <img src="images/blocks/leftz2.png"/> + <img src="images/blocks/halfcross2.png"/> + <img src="images/blocks/rightz2.png"/> + <img src="images/blocks/leftl2.png"/> + <img src="images/blocks/rightz1.png"/> + <img src="images/blocks/rightz2.png"/> + <img src="images/blocks/halfcross1.png"/> + <img src="images/blocks/line2.png"/> + <img src="images/blocks/rightl1.png"/> + </td> + </tr> + </tbody> +</table> + + +<h2><a id="section2-3"></a>TetriFast</h2> + +TetriFast is a modified TetriNET client that removes the delay between the +block fall and the showing of next block. The TetriFast protocol is quite +similar to the TetriNET protocol, it has just been slightly modified to prevent +TetriFast clients to connect and cheat on regular TetriNET servers. + <h3>Login</h3> TetriFast clients connect on the same port as TetriNET client, that's 31457. The @@ -72,10 +362,10 @@ -<h2><a id="section2-3"></a>TSpec</h2> +<h2><a id="section2-4"></a>TSpec</h2> -<h2><a id="section2-4"></a>Query</h2> +<h2><a id="section2-5"></a>Query</h2> Tetrix first introduced a query protocol to get easily a list of players and channels on TetriNET servers. This protocol consists in 4 commands : Property changes on: jetrix/trunk/src/site/images/blocks/halfcross1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/halfcross2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/halfcross3.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/halfcross4.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftl1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftl2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftl3.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftl4.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftz1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftz2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/line1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/line2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightl1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightl2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightl3.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightl4.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightz1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightz2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/square.png ___________________________________________________________________ Added: svn:mime-type + image/png Modified: jetrix/trunk/src/site/index.php =================================================================== --- jetrix/trunk/src/site/index.php 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/site/index.php 2008-08-27 09:22:05 UTC (rev 743) @@ -5,7 +5,7 @@ Jetrix is a new generation TetriNET server written in Java and designed for maximum scalability, extensibility and ease of use. It features a web based administration console and a simple API -to let developpers add custom commands or change the channels' +to let developers add custom commands or change the channels' behavior with little knowledge of the server's inner functioning. The ambitious goal of this project is to create the ideal plateform for server side TetriNET programmers. Jetrix is open source and Modified: jetrix/trunk/src/site/menu.inc.php =================================================================== --- jetrix/trunk/src/site/menu.inc.php 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/site/menu.inc.php 2008-08-27 09:22:05 UTC (rev 743) @@ -19,7 +19,7 @@ <h1>Documentation</h1> <ul> <li><a href="user-guide.php">User Guide</a></li> - <li><a href="dev-guide.php">Developper Guide</a></li> + <li><a href="dev-guide.php">Developer Guide</a></li> <li><a href="javadoc.php">Javadoc</a></li> <li><a href="docs/project-reports.html">Project Reports</a></li> </ul> Added: jetrix/trunk/src/test/net/jetrix/tools/TetrinetRandomGeneratorTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/tools/TetrinetRandomGeneratorTest.java (rev 0) +++ jetrix/trunk/src/test/net/jetrix/tools/TetrinetRandomGeneratorTest.java 2008-08-27 09:22:05 UTC (rev 743) @@ -0,0 +1,68 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.tools; + +import junit.framework.TestCase; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class TetrinetRandomGeneratorTest extends TestCase +{ + public void testRandom() { + TetrinetRandomGenerator generator = new TetrinetRandomGenerator(0); + + assertEquals("s0", 0x00000000L, generator.getValue()); + generator.nextValue(); + assertEquals("s1", 0x00000001L, generator.getValue()); + generator.nextValue(); + assertEquals("s2", 0x08088406L, generator.getValue()); + generator.nextValue(); + assertEquals("s3", 0xDC6DAC1FL, generator.getValue()); + generator.nextValue(); + assertEquals("s4", 0x33DC589CL, generator.getValue()); + generator.nextValue(); + assertEquals("s5", 0x45DE2B0DL, generator.getValue()); + } + + public void testNextInt() { + TetrinetRandomGenerator generator = new TetrinetRandomGenerator(0); + + assertEquals("i1", 0x00, generator.nextInt(100)); + assertEquals("i2", 0x00, generator.nextInt(4)); + assertEquals("i3", 0x56, generator.nextInt(100)); + assertEquals("i4", 0x00, generator.nextInt(4)); + assertEquals("i5", 0x1B, generator.nextInt(100)); + assertEquals("i6", 0x02, generator.nextInt(4)); + assertEquals("i7", 0x1F, generator.nextInt(100)); + assertEquals("i8", 0x00, generator.nextInt(4)); + assertEquals("i9", 0x25, generator.nextInt(100)); + assertEquals("i10", 0x01, generator.nextInt(4)); + assertEquals("i11", 0x08, generator.nextInt(100)); + assertEquals("i12", 0x01, generator.nextInt(4)); + assertEquals("i13", 0x07, generator.nextInt(100)); + assertEquals("i14", 0x03, generator.nextInt(4)); + assertEquals("i15", 0x05, generator.nextInt(100)); + assertEquals("i16", 0x01, generator.nextInt(4)); + assertEquals("i17", 0x5B, generator.nextInt(100)); + assertEquals("i18", 0x01, generator.nextInt(4)); + } +} Property changes on: jetrix/trunk/src/test/net/jetrix/tools/TetrinetRandomGeneratorTest.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |