jetrix-cvs Mailing List for Jetrix TetriNET Server (Page 8)
Brought to you by:
smanux
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(47) |
Dec
(39) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(11) |
Feb
(34) |
Mar
(52) |
Apr
(79) |
May
(14) |
Jun
(41) |
Jul
(19) |
Aug
(44) |
Sep
(36) |
Oct
(36) |
Nov
(6) |
Dec
(58) |
2004 |
Jan
(23) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(91) |
2005 |
Jan
(137) |
Feb
(10) |
Mar
(2) |
Apr
(41) |
May
(62) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(39) |
Sep
(18) |
Oct
|
Nov
(9) |
Dec
|
2009 |
Jan
|
Feb
(27) |
Mar
(4) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2010 |
Jan
(3) |
Feb
(14) |
Mar
(3) |
Apr
(10) |
May
(15) |
Jun
|
Jul
|
Aug
(9) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Emmanuel B. <sm...@us...> - 2005-06-29 13:44:39
|
Update of /cvsroot/jetrix/jetrix/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22809/doc Modified Files: todo.txt Log Message: new bug to fix: check the end of the game when a player leaves the channel Index: todo.txt =================================================================== RCS file: /cvsroot/jetrix/jetrix/doc/todo.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** todo.txt 8 Jun 2005 17:08:44 -0000 1.4 --- todo.txt 29 Jun 2005 13:44:14 -0000 1.5 *************** *** 19,22 **** --- 19,23 ---- - bonus points when the same player wins several games in a row - immunity mode: a tetris grants a 10 seconds immunity against any special (detrimental and beneficial) + - check the end of the game when a player leaves the channel Commands |
From: Emmanuel B. <sm...@us...> - 2005-06-29 13:43:39
|
Update of /cvsroot/jetrix/jetrix/src/java/net/jetrix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22387/src/java/net/jetrix Modified Files: Channel.java Log Message: Replaced for with foreach in the countRemainingTeams() method Index: Channel.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/java/net/jetrix/Channel.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Channel.java 3 May 2005 17:29:46 -0000 1.38 --- Channel.java 29 Jun 2005 13:43:30 -0000 1.39 *************** *** 1059,1066 **** int nbTeamsLeft = 0; ! for (int i = 0; i < slots.size(); i++) { - Client client = slots.get(i); - if (client != null && client.getUser().isPlaying()) { --- 1059,1064 ---- int nbTeamsLeft = 0; ! for (Client client : slots) { if (client != null && client.getUser().isPlaying()) { |
From: Emmanuel B. <sm...@us...> - 2005-06-08 17:08:53
|
Update of /cvsroot/jetrix/jetrix/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21235/doc Modified Files: todo.txt Log Message: immunity mode and /height Index: todo.txt =================================================================== RCS file: /cvsroot/jetrix/jetrix/doc/todo.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** todo.txt 4 May 2005 10:29:51 -0000 1.3 --- todo.txt 8 Jun 2005 17:08:44 -0000 1.4 *************** *** 18,21 **** --- 18,22 ---- - bonus points depending on the skill of the players (i.e intensity level on tnet.org with 5+ players and at least 4 players in the top 100) - bonus points when the same player wins several games in a row + - immunity mode: a tetris grants a 10 seconds immunity against any special (detrimental and beneficial) Commands *************** *** 29,32 **** --- 30,34 ---- - change dynamically the aliases of a command - per channel commands + - /height n : start the game at the given height for the player issuing the command Administration |
From: Emmanuel B. <sm...@us...> - 2005-06-08 17:07:37
|
Update of /cvsroot/jetrix/jetrix/src/site In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20638/src/site Modified Files: dev-guide.php Log Message: The name of the channel in the listchan result should not contain the leading # Index: dev-guide.php =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/site/dev-guide.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dev-guide.php 7 Jan 2005 10:56:42 -0000 1.8 --- dev-guide.php 8 Jun 2005 17:07:21 -0000 1.9 *************** *** 98,102 **** <div class="code">"<name>" "<description>" <playernum> <playermax> <priority> <status></div> <pre> ! name the name of the channel description the description or topic of the channel playernum the number of players in this channel --- 98,102 ---- <div class="code">"<name>" "<description>" <playernum> <playermax> <priority> <status></div> <pre> ! name the name of the channel (without the leading #) description the description or topic of the channel playernum the number of players in this channel |
From: Emmanuel B. <sm...@us...> - 2005-06-08 17:06:19
|
Update of /cvsroot/jetrix/jetrix/src/java/net/jetrix/protocols In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20143/src/java/net/jetrix/protocols Modified Files: AbstractProtocol.java Log Message: Replaced StringBuffer with StringBuilder Index: AbstractProtocol.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/java/net/jetrix/protocols/AbstractProtocol.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractProtocol.java 26 Apr 2005 20:23:59 -0000 1.1 --- AbstractProtocol.java 8 Jun 2005 17:06:09 -0000 1.2 *************** *** 22,29 **** import net.jetrix.Protocol; - import java.io.Reader; import java.io.IOException; /** * @since 0.3 * --- 22,31 ---- import net.jetrix.Protocol; import java.io.IOException; + import java.io.Reader; /** + * Abstract protocol implementing the readLine(Reader) method. + * * @since 0.3 * *************** *** 35,39 **** public String readLine(Reader in) throws IOException { ! StringBuffer input = new StringBuffer(); int readChar; --- 37,41 ---- public String readLine(Reader in) throws IOException { ! StringBuilder input = new StringBuilder(); int readChar; |
From: Emmanuel B. <sm...@us...> - 2005-06-08 17:05:23
|
Update of /cvsroot/jetrix/jetrix/src/java/net/jetrix/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19745/src/java/net/jetrix/tools Modified Files: ServerDirectory.java Log Message: Changed getServers() to return distinct servers only Index: ServerDirectory.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/java/net/jetrix/tools/ServerDirectory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ServerDirectory.java 23 May 2005 23:10:55 -0000 1.3 --- ServerDirectory.java 8 Jun 2005 17:05:14 -0000 1.4 *************** *** 25,30 **** import java.net.URL; import java.net.MalformedURLException; ! import java.util.Collection; ! import java.util.TreeSet; /** --- 25,31 ---- import java.net.URL; import java.net.MalformedURLException; ! import java.net.InetAddress; ! import java.net.UnknownHostException; ! import java.util.*; /** *************** *** 55,59 **** } ! return servers; } --- 56,60 ---- } ! return getDistinctServers(servers); } *************** *** 108,110 **** --- 109,145 ---- return servers; } + + /** + * Return the distinct hosts from the specified list of servers. + * Host names (i.e tetrinet.fr) are prefered over host addresses + * (i.e 194.117.194.68). + * + * @since 0.3 + */ + private static Set<String> getDistinctServers(Collection<String> servers) + { + Map<String, String> map = new HashMap<String, String>(); + + for (String server : servers) + { + try + { + // get the address of the server + InetAddress address = InetAddress.getByName(server); + + // check if the server is missing from the map, or registered under a numerical form + String hostname = map.get(address.getHostAddress()); + if (hostname == null || hostname.equals(address.getHostAddress())) + { + map.put(address.getHostAddress(), server); + } + } + catch (UnknownHostException e) + { + // ignored + } + } + + return new HashSet<String>(map.values()); + } } |
From: Emmanuel B. <sm...@us...> - 2005-06-07 15:09:08
|
Update of /cvsroot/jetrix/jetrix/src/test/net/jetrix/agent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20876/src/test/net/jetrix/agent Modified Files: QueryAgentTest.java Log Message: More robust parsing for servers sending invalid information: - support quotes in channel descriptions (seen on tetrinet.org) - support N/A as a value for the channel priority (sent by Java Tetrinet Server) Index: QueryAgentTest.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/test/net/jetrix/agent/QueryAgentTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** QueryAgentTest.java 12 Jan 2005 18:47:40 -0000 1.1 --- QueryAgentTest.java 7 Jun 2005 15:08:52 -0000 1.2 *************** *** 85,103 **** assertTrue("ping", ping > 0); } - - public void testParseQuotedTokens() - { - QueryAgent agent = new QueryAgent(); - - String s = "\"a a\" \"bb\" cc dd \"ee\""; - - List<String> tokens = agent.parseQuotedTokens(s); - - assertNotNull("null list", tokens); - assertEquals("1st token", "a a", tokens.get(0)); - assertEquals("2nd token", "bb", tokens.get(1)); - assertEquals("3rd token", "cc", tokens.get(2)); - assertEquals("4th token", "dd", tokens.get(3)); - assertEquals("5th token", "ee", tokens.get(4)); - } } --- 85,87 ---- |
From: Emmanuel B. <sm...@us...> - 2005-06-07 15:09:01
|
Update of /cvsroot/jetrix/jetrix/src/java/net/jetrix/agent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20876/src/java/net/jetrix/agent Modified Files: QueryAgent.java Log Message: More robust parsing for servers sending invalid information: - support quotes in channel descriptions (seen on tetrinet.org) - support N/A as a value for the channel priority (sent by Java Tetrinet Server) Index: QueryAgent.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/java/net/jetrix/agent/QueryAgent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** QueryAgent.java 26 Apr 2005 20:29:25 -0000 1.4 --- QueryAgent.java 7 Jun 2005 15:08:52 -0000 1.5 *************** *** 20,25 **** package net.jetrix.agent; - import net.jetrix.protocols.QueryProtocol; import net.jetrix.Message; import java.io.*; --- 20,25 ---- package net.jetrix.agent; import net.jetrix.Message; + import net.jetrix.protocols.QueryProtocol; import java.io.*; *************** *** 27,30 **** --- 27,33 ---- import java.util.ArrayList; import java.util.List; + import java.util.logging.Logger; + import java.util.regex.Matcher; + import java.util.regex.Pattern; /** *************** *** 41,44 **** --- 44,49 ---- private Writer out; + private Logger log = Logger.getLogger("net.jetrix"); + public void connect(String hostname) throws IOException { *************** *** 129,132 **** --- 134,140 ---- public List<ChannelInfo> getChannels() throws IOException { + // prepare the pattern matcher + Pattern pattern = Pattern.compile("\"(.*)\" \"(.*)\" ([0-9]+) ([0-9]+) ([0-9]+|N/A) ([0-9]+)"); + // send the command send("listchan"); *************** *** 139,153 **** while (!QueryProtocol.OK.equals(line = protocol.readLine(in))) { ! List<String> tokens = parseQuotedTokens(line); ! ChannelInfo channel = new ChannelInfo(); ! channel.setName(tokens.get(0)); ! channel.setDescription(tokens.get(1)); ! channel.setPlayernum(Integer.parseInt(tokens.get(2))); ! channel.setPlayermax(Integer.parseInt(tokens.get(3))); ! channel.setPriority(Integer.parseInt(tokens.get(4))); ! channel.setStatus(Integer.parseInt(tokens.get(5))); ! channels.add(channel); } --- 147,173 ---- while (!QueryProtocol.OK.equals(line = protocol.readLine(in))) { ! Matcher matcher = pattern.matcher(line); ! if (matcher.matches()) ! { ! int i = 1; ! ChannelInfo channel = new ChannelInfo(); ! channel.setName(matcher.group(i++)); ! channel.setDescription(matcher.group(i++)); ! channel.setPlayernum(Integer.parseInt(matcher.group(i++))); ! channel.setPlayermax(Integer.parseInt(matcher.group(i++))); ! String priority = matcher.group(i++); ! if (!"N/A".equals(priority)) ! { ! channel.setPriority(Integer.parseInt(priority)); ! } ! channel.setStatus(Integer.parseInt(matcher.group(i++))); ! channels.add(channel); ! } ! else ! { ! log.warning("Invalid response for the listchan message (" + hostname + ") : " + line); ! } } *************** *** 157,160 **** --- 177,183 ---- public List<PlayerInfo> getPlayers() throws IOException { + // prepare the pattern matcher + Pattern pattern = Pattern.compile("\"(.*)\" \"(.*)\" \"(.*)\" ([0-9]+) ([0-9]+) ([0-9]+) \"(.*)\""); + // send the command send("listuser"); *************** *** 167,182 **** while (!QueryProtocol.OK.equals(line = protocol.readLine(in))) { ! List<String> tokens = parseQuotedTokens(line); ! PlayerInfo player = new PlayerInfo(); ! player.setNick(tokens.get(0)); ! player.setTeam(tokens.get(1)); ! player.setVersion(tokens.get(2)); ! player.setSlot(Integer.parseInt(tokens.get(3))); ! player.setStatus(Integer.parseInt(tokens.get(4))); ! player.setAuthenticationLevel(Integer.parseInt(tokens.get(5))); ! player.setChannel(tokens.get(6)); ! players.add(player); } --- 190,213 ---- while (!QueryProtocol.OK.equals(line = protocol.readLine(in))) { ! Matcher matcher = pattern.matcher(line); ! if (matcher.matches()) ! { ! int i = 1; ! PlayerInfo player = new PlayerInfo(); ! player.setNick(matcher.group(i++)); ! player.setTeam(matcher.group(i++)); ! player.setVersion(matcher.group(i++)); ! player.setSlot(Integer.parseInt(matcher.group(i++))); ! player.setStatus(Integer.parseInt(matcher.group(i++))); ! player.setAuthenticationLevel(Integer.parseInt(matcher.group(i++))); ! player.setChannel(matcher.group(i++)); ! players.add(player); ! } ! else ! { ! log.warning("Invalid response for the listuser message (" + hostname + ") : " + line); ! } } *************** *** 194,246 **** } - List<String> parseQuotedTokens(String s) - { - List<String> tokens = new ArrayList<String>(); - - if (s == null) - { - return new ArrayList<String>(); - } - - StringBuilder token = new StringBuilder(); - boolean quote = false; - - for (int i = 0; i < s.length(); i++) - { - char c = s.charAt(i); - - if (c == '"') - { - if (quote) - { - tokens.add(token.toString()); - token = new StringBuilder(); - } - - quote = !quote; - } - else if (c == ' ') - { - if (quote) - { - token.append(c); - } - else if (token.length() > 0) - { - tokens.add(token.toString()); - token = new StringBuilder(); - } - } - else - { - token.append(c); - if (i == s.length() - 1) - { - tokens.add(token.toString()); - } - } - } - - return tokens; - } } --- 225,227 ---- |
From: Emmanuel B. <sm...@us...> - 2005-06-07 14:58:47
|
Update of /cvsroot/jetrix/jetrix/src/java/net/jetrix/clients In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16479/src/java/net/jetrix/clients Modified Files: QueryClient.java Log Message: Do not display invisible channels Index: QueryClient.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/java/net/jetrix/clients/QueryClient.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** QueryClient.java 3 May 2005 13:39:26 -0000 1.14 --- QueryClient.java 7 Jun 2005 14:58:32 -0000 1.15 *************** *** 122,136 **** ChannelConfig config = channel.getConfig(); ! message.append("\""); ! message.append(config.getName()); ! message.append("\" \""); ! message.append(config.getDescription()); ! message.append("\" "); ! message.append(channel.getPlayerCount()); ! message.append(" "); ! message.append(config.getMaxPlayers()); ! message.append(" 0 "); ! message.append(channel.getGameState().getValue() + 1); ! message.append(QueryProtocol.EOL); } --- 122,139 ---- ChannelConfig config = channel.getConfig(); ! if (config.isVisible()) ! { ! message.append("\""); ! message.append(config.getName()); ! message.append("\" \""); ! message.append(config.getDescription()); ! message.append("\" "); ! message.append(channel.getPlayerCount()); ! message.append(" "); ! message.append(config.getMaxPlayers()); ! message.append(" 0 "); ! message.append(channel.getGameState().getValue() + 1); ! message.append(QueryProtocol.EOL); ! } } |
From: Emmanuel B. <sm...@us...> - 2005-05-23 23:11:58
|
Update of /cvsroot/jetrix/jetrix/src/site In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18224/src/site Modified Files: features.php Log Message: The IP of the server is no longer submitted to tfast.org since the site is dead Index: features.php =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/site/features.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** features.php 23 Jan 2005 23:27:50 -0000 1.12 --- features.php 23 May 2005 23:11:49 -0000 1.13 *************** *** 124,128 **** <ul> ! <li class="done"> automatic advertisement to server directories (tfast.org, tetrinet.org, tsrv.com)</li> <li class="partial"> automatic update</li> <li class="done"> notification of new versions</li> --- 124,128 ---- <ul> ! <li class="done"> automatic advertisement to server directories (tetrinet.org, tsrv.com)</li> <li class="partial"> automatic update</li> <li class="done"> notification of new versions</li> |
From: Emmanuel B. <sm...@us...> - 2005-05-23 23:11:06
|
Update of /cvsroot/jetrix/jetrix/src/java/net/jetrix/services In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17924/src/java/net/jetrix/services Modified Files: PublishingService.java Log Message: The IP of the server is no longer submitted to tfast.org since the site is dead Index: PublishingService.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/java/net/jetrix/services/PublishingService.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PublishingService.java 4 Apr 2005 09:36:18 -0000 1.9 --- PublishingService.java 23 May 2005 23:10:54 -0000 1.10 *************** *** 41,45 **** /** * A service publishing the address of the server on public server lists ! * (tetrinet.org, tfast.org and tsrv.com). The <tt>host</tt> parameter can be * specified if not explicitely defined in the config.xml file (with the host * attribute on the tetrinet-server element), if no hostname is provided the --- 41,45 ---- /** * A service publishing the address of the server on public server lists ! * (tetrinet.org and tsrv.com). The <tt>host</tt> parameter can be * specified if not explicitely defined in the config.xml file (with the host * attribute on the tetrinet-server element), if no hostname is provided the *************** *** 92,109 **** log.info("Publishing server address to online directories... (" + host + ")"); - // publishing to tfast.org - try - { - String url = "http://www.tfast.org/en/add.php"; - Map<String, String> params = new HashMap<String, String>(); - params.put("ip", host); - params.put("desc", Server.getInstance().getConfig().getName()); - post(url, params); - } - catch (IOException e) - { - e.printStackTrace(); - } - // publishing to tetrinet.org try --- 92,95 ---- |
From: Emmanuel B. <sm...@us...> - 2005-05-23 23:11:04
|
Update of /cvsroot/jetrix/jetrix/src/java/net/jetrix/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17924/src/java/net/jetrix/tools Modified Files: ServerDirectory.java Log Message: The IP of the server is no longer submitted to tfast.org since the site is dead Index: ServerDirectory.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/java/net/jetrix/tools/ServerDirectory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ServerDirectory.java 3 May 2005 00:00:23 -0000 1.2 --- ServerDirectory.java 23 May 2005 23:10:55 -0000 1.3 *************** *** 30,34 **** /** * A utility class that fetches a list of tetrinet servers from online ! * directories like tetrinet.org and tfast.org. * * @author Emmanuel Bourg --- 30,34 ---- /** * A utility class that fetches a list of tetrinet servers from online ! * directories like tetrinet.org and tsrv.com. * * @author Emmanuel Bourg *************** *** 47,51 **** try { - servers.addAll(extractServers(new URL("http://tfast.org/en/servers.php"), "serv=", "\"")); servers.addAll(extractServers(new URL("http://slummy.tetrinet.org/grav/slummy_grav.html"), "<TD><font size=\"+0\"><font face=\"helvetica,arial\">", "<")); servers.addAll(extractServers(new URL("http://dieterdhoker.mine.nu:8280/cgi-bin/TSRV/servers.htm"), "serverhost=", "\"")); --- 47,50 ---- |
From: Emmanuel B. <sm...@us...> - 2005-05-23 23:11:03
|
Update of /cvsroot/jetrix/jetrix/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17924/doc Modified Files: changelog.txt Log Message: The IP of the server is no longer submitted to tfast.org since the site is dead Index: changelog.txt =================================================================== RCS file: /cvsroot/jetrix/jetrix/doc/changelog.txt,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** changelog.txt 4 May 2005 21:12:36 -0000 1.79 --- changelog.txt 23 May 2005 23:10:53 -0000 1.80 *************** *** 16,19 **** --- 16,20 ---- - Added a visibility parameter on channels, it's now possible to have an invisible channel on the /list result - Channels can now be created from the administration console + - The IP of the server is no longer submitted to tfast.org since the site is dead Developer visible changes |
From: Emmanuel B. <sm...@us...> - 2005-05-23 22:52:34
|
Update of /cvsroot/jetrix/jetrix/src/etc/data/puzzle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14401 Added Files: game102.settings game108.field game108.settings game109.field game109.settings game128.field game128.settings game93.field game93.settings Log Message: Added puzzles contributed by PoussyAnne --- NEW FILE: game93.field --- 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000550550000 005oo5oo5000 005ooooo5000 0005ooo50000 00005o500000 000005000000 550550550550 555555555555 5oo5555oo555 55o55055o550 055500055500 005000005000 --- NEW FILE: game109.field --- 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 00055s550000 005555555000 0o5505055o00 005500055000 000550550000 000055500000 000005000000 000000000000 000000000000 040404040404 4o40404g404o --- NEW FILE: game108.field --- 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 055500055500 555550555550 555555055555 555550b55555 555n0c555555 55o055555555 550055555550 055q05555500 00550r555000 000555050000 000055500000 000005000000 55555o555555 --- NEW FILE: game128.settings --- NAME "Valentine's Day " COMMENT DESIGNER {}^oo^{} BLOCK 14 14 14 14 14 15 15 SPECIAL 100 0 0 0 0 0 0 0 0 SUDDENDEATH 180 1 30 SUDDENDEATHMSG DIE ! RULES 1 2 1 0 0 18 1 1 MISC 1 1 1 --- NEW FILE: game128.field --- 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000550550000 005aa5aa5000 005aaaaa5000 0005aaa50000 00005a500000 000005000000 550550550550 aa5aa5aa5aa5 aaaaa5aaaaa5 5aaa505aaa50 05a50005a500 005000005000 --- NEW FILE: game109.settings --- NAME "explosive heart" COMMENT none DESIGNER {}^oo^{} BLOCK 14 14 14 14 14 15 15 SPECIAL 32 18 1 11 3 14 1 6 14 SUDDENDEATH 180 1 30 SUDDENDEATHMSG DIE ! RULES 1 2 1 1 0 18 1 1 MISC 1 1 1 --- NEW FILE: game93.settings --- NAME "Broken heart" COMMENT none DESIGNER {}^oo^{} BLOCK 14 14 14 14 14 15 15 SPECIAL 32 18 1 11 3 14 1 6 14 SUDDENDEATH 180 1 30 SUDDENDEATHMSG DIE ! RULES 1 2 1 0 0 18 1 1 MISC 1 1 1 --- NEW FILE: game102.settings --- NAME "My level2" COMMENT yeah baby DESIGNER Sheep BLOCK 14 14 14 14 14 15 15 SPECIAL 32 18 1 11 3 14 1 6 14 SUDDENDEATH 0 0 0 SUDDENDEATHMSG hi RULES 1 0 0 2 1 10 1 1 MISC 1 1 1 --- NEW FILE: game108.settings --- NAME "big heart" COMMENT none DESIGNER {}^oo^{} BLOCK 14 14 14 14 14 15 15 SPECIAL 32 18 1 11 3 14 1 6 14 SUDDENDEATH 180 1 30 SUDDENDEATHMSG DIE ! RULES 1 2 1 1 0 18 1 1 MISC 1 1 1 |
From: Emmanuel B. <sm...@us...> - 2005-05-23 22:30:31
|
Update of /cvsroot/jetrix/jetrix/src/java/net/jetrix/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9440 Modified Files: LogoFilter.java Log Message: Added a "field" parameter to specify an alternate field file Index: LogoFilter.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/java/net/jetrix/filter/LogoFilter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LogoFilter.java 10 May 2005 02:22:52 -0000 1.5 --- LogoFilter.java 23 May 2005 22:30:14 -0000 1.6 *************** *** 44,48 **** try { ! field.load(DEFAULT_FIELD); } catch (IOException e) --- 44,48 ---- try { ! field.load(config.getString("field", DEFAULT_FIELD)); } catch (IOException e) |
From: Emmanuel B. <sm...@us...> - 2005-05-17 20:13:10
|
Update of /cvsroot/jetrix/jetrix/src/etc/data/puzzle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11616 Added Files: game120.field game120.settings game92.field game92.settings Log Message: Added puzzles contributed by Elric --- NEW FILE: game92.field --- 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 044000004400 422400042240 4554ooo45540 4254ooo45240 0424ooo42400 0044ooo44000 00040o040000 000000000000 --- NEW FILE: game120.field --- 000000000000 000000000000 000000000000 000000000000 000000000000 000003000000 000003000000 000003000000 000003000000 000003000000 000003000000 000003000000 000003000000 000003000000 000003000000 004003004000 00444o444000 000001000000 000001000000 000001000000 00000b000000 000000000000 --- NEW FILE: game120.settings --- NAME "Stormbringer" COMMENT See the power of the Black Sword DESIGNER Elric BLOCK 14 14 14 14 14 15 15 SPECIAL 32 18 1 11 3 14 1 6 14 SUDDENDEATH 150 1 10 SUDDENDEATHMSG DIE ! RULES 1 2 1 1 0 18 1 1 MISC 1 1 1 --- NEW FILE: game92.settings --- NAME "Bullet With Butterfly Wings" COMMENT c'est juste pour donner une idee, n'hesitez pas a le retoucher pour le rendre interessant (a na pas mettre tel uel) DESIGNER Elric BLOCK 14 14 14 14 14 15 15 SPECIAL 32 18 1 11 3 14 1 6 14 SUDDENDEATH 180 1 30 SUDDENDEATHMSG DIE ! RULES 1 2 1 1 0 18 1 1 MISC 1 1 1 |
From: Emmanuel B. <sm...@us...> - 2005-05-15 10:37:58
|
Update of /cvsroot/jetrix/jetrix/src/etc/data/puzzle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13450 Added Files: game49.field game49.settings game55.field game55.settings game60.field game60.settings game62.field game62.settings game63.field game63.settings game64.field game64.settings Log Message: Added puzzles contributed by Dañce --- NEW FILE: game64.settings --- (This appears to be a binary file; contents omitted.) --- NEW FILE: game55.field --- 000000000000 000000000000 000000000000 000000000000 000000000000 000003450000 000045043000 000142154100 004305040340 014213454214 020405020402 041241451241 020405040402 014212454214 020405020402 043143154143 g20405040402 041241451341 n20405020202 044143154144 s20405040402 041241451241 --- NEW FILE: game49.field --- 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 111110004o53 000100004a53 001000004c5o 000100004a53 111110004q53 000000004ao3 222220204c53 000000004a53 111110004q5o 101010004a53 100010004a53 000000004co3 222220004a53 200000004q53 200000004a5o --- NEW FILE: game62.field --- 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 a0000000000a 000000000000 000000000000 000000000000 000000000000 000000000000 000055000000 000005500000 000000440000 000000040000 000000040000 000003330000 00000cc30000 00000cc00000 00000cc00000 --- NEW FILE: game63.field --- 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000044440000 000044440000 000044440000 000044440000 044444444440 044444444440 00004r440000 000044440000 000044r40000 000044440000 00004r440000 000044440000 00004r440000 000044440000 000044r40000 --- NEW FILE: game49.settings --- (This appears to be a binary file; contents omitted.) --- NEW FILE: game60.field --- 000000000000 000000000000 000000000000 000000000000 00000000002c 00000000002c 000000000220 000000000220 000000002200 000000002200 000000022000 000000022000 000000220000 000000220000 000002200000 000002200000 000022000000 000022000000 000220000000 000220000000 002200000000 002200000000 --- NEW FILE: game63.settings --- (This appears to be a binary file; contents omitted.) --- NEW FILE: game62.settings --- (This appears to be a binary file; contents omitted.) --- NEW FILE: game60.settings --- (This appears to be a binary file; contents omitted.) --- NEW FILE: game55.settings --- (This appears to be a binary file; contents omitted.) --- NEW FILE: game64.field --- 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000004000000 000304000000 033304400000 333355111100 411115520000 455o22222000 445522111100 011222333444 1o10o23o34o4 111223033444 |
From: Emmanuel B. <sm...@us...> - 2005-05-10 02:45:50
|
Update of /cvsroot/jetrix/jetrix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4853 Modified Files: project.properties Log Message: Added JDIC Tray in the dependencies Index: project.properties =================================================================== RCS file: /cvsroot/jetrix/jetrix/project.properties,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** project.properties 2 May 2005 15:08:58 -0000 1.11 --- project.properties 10 May 2005 02:45:42 -0000 1.12 *************** *** 3,7 **** maven.junit.fork=true ! maven.junit.dir=target maven.test.failure.ignore=true --- 3,7 ---- maven.junit.fork=true ! maven.junit.dir=target/test-classes maven.test.failure.ignore=true *************** *** 10,13 **** --- 10,15 ---- maven.jar.override=on maven.jar.jcrontab=lib/jcrontab-1.4.1-light.jar + maven.jar.jdic-tray=lib/jdic-tray-0.9.jar + maven.jar.jdic-tray-win=lib/jdic-tray-win-0.9.jar maven.javadoc.use=false |
From: Emmanuel B. <sm...@us...> - 2005-05-10 02:44:26
|
Update of /cvsroot/jetrix/jetrix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4711 Modified Files: project.xml Log Message: Added the puzzle in the test classpath Added JDIC Tray in the dependencies Index: project.xml =================================================================== RCS file: /cvsroot/jetrix/jetrix/project.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** project.xml 2 May 2005 15:08:58 -0000 1.10 --- project.xml 10 May 2005 02:44:17 -0000 1.11 *************** *** 152,162 **** <dependency> ! <id>jetty</id> ! <version>4.1-rc1</version> </dependency> <dependency> ! <id>jcrontab</id> ! <version>1.4.1</version> </dependency> --- 152,172 ---- <dependency> ! <id>jetty</id> ! <version>4.1-rc1</version> </dependency> <dependency> ! <id>jcrontab</id> ! <version>1.4.1</version> ! </dependency> ! ! <dependency> ! <id>jdic-tray</id> ! <version>0.9</version> ! </dependency> ! ! <dependency> ! <id>jdic-tray-win</id> ! <version>0.9</version> </dependency> *************** *** 195,198 **** --- 205,216 ---- </includes> </resource> + <resource> + <directory>src/etc/data/puzzle</directory> + <targetPath>/data/puzzle</targetPath> + <includes> + <include>*.field</include> + <include>*.settings</include> + </includes> + </resource> </resources> </unitTest> |
From: Emmanuel B. <sm...@us...> - 2005-05-10 02:41:02
|
Update of /cvsroot/jetrix/jetrix/src/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4269/src/admin Modified Files: settings.jsp Log Message: Added valueOf(char) abd changed the type of the letter (String -> char) Index: settings.jsp =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/admin/settings.jsp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** settings.jsp 6 Dec 2004 00:00:13 -0000 1.7 --- settings.jsp 10 May 2005 02:40:54 -0000 1.8 *************** *** 28,32 **** <% for (Special special : Special.values()) { %> <tr> ! <td align="center" style="border-right: 0px" width="10%"><img src="/images/specials/<%= special.getLetter() %>.png" alt="<%= special.getLetter().toUpperCase() %>"></td> <td><%= special.getName(Locale.ENGLISH) %></td> <td align="center"><input class="thin <%= settings.isDefaultSpecialOccurancy() ? "default" : "" %>" type="text" value="<%= settings.getOccurancy(special) %>" name="<%= special.getCode() %>" style="width: 30px" onchange="updateSpecials()"> %</td> --- 28,32 ---- <% for (Special special : Special.values()) { %> <tr> ! <td align="center" style="border-right: 0px" width="10%"><img src="/images/specials/<%= special.getLetter() %>.png" alt="<%= String.valueOf(special.getLetter()).toUpperCase() %>"></td> <td><%= special.getName(Locale.ENGLISH) %></td> <td align="center"><input class="thin <%= settings.isDefaultSpecialOccurancy() ? "default" : "" %>" type="text" value="<%= settings.getOccurancy(special) %>" name="<%= special.getCode() %>" style="width: 30px" onchange="updateSpecials()"> %</td> |
From: Emmanuel B. <sm...@us...> - 2005-05-10 02:39:32
|
Update of /cvsroot/jetrix/jetrix/src/test/net/jetrix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4057/src/test/net/jetrix Modified Files: FieldTest.java Log Message: more tests Index: FieldTest.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/test/net/jetrix/FieldTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FieldTest.java 4 Apr 2005 09:36:19 -0000 1.2 --- FieldTest.java 10 May 2005 02:39:23 -0000 1.3 *************** *** 1,5 **** /** * Jetrix TetriNET Server ! * Copyright (C) 2001-2003 Emmanuel Bourg * * This program is free software; you can redistribute it and/or --- 1,5 ---- /** * Jetrix TetriNET Server ! * Copyright (C) 2001-2005 Emmanuel Bourg * * This program is free software; you can redistribute it and/or *************** *** 20,23 **** --- 20,25 ---- package net.jetrix; + import static net.jetrix.config.Special.*; + import junit.framework.*; import net.jetrix.messages.*; *************** *** 112,118 **** field.update(message); ! assertEquals("block at (0, 0)", Field.SPECIAL_SWITCHFIELD, field.getBlock(0, 0)); ! assertEquals("block at (1, 0)", Field.SPECIAL_GRAVITY, field.getBlock(1, 0)); ! assertEquals("block at (2, 0)", Field.SPECIAL_QUAKEFIELD, field.getBlock(2, 0)); } --- 114,120 ---- field.update(message); ! assertEquals("block at (0, 0)", SWITCHFIELD.getLetter(), field.getBlock(0, 0)); ! assertEquals("block at (1, 0)", GRAVITY.getLetter(), field.getBlock(1, 0)); ! assertEquals("block at (2, 0)", QUAKEFIELD.getLetter(), field.getBlock(2, 0)); } *************** *** 151,153 **** --- 153,196 ---- } + public void testGetHighest() + { + byte[][] array = new byte[Field.WIDTH][Field.HEIGHT]; + + field = new Field(array); + field.clear(); + + array[5][15] = Field.BLOCK_BLUE; + array[0][0] = Field.BLOCK_RED; + + assertEquals("highest block", 15, field.getHighest()); + } + + public void testIsEmpty() + { + assertTrue("the field is not empty", field.isEmpty()); + + field.update(new FieldMessage("+3H-4H.5H")); + + assertFalse("the field is empty", field.isEmpty()); + } + + public void testHasHoles() + { + byte[][] array = new byte[Field.WIDTH][Field.HEIGHT]; + + field = new Field(array); + field.clear(); + + for (int i = 0; i < Field.WIDTH; i++) + { + array[i][0] = Field.BLOCK_RED; + array[i][1] = Field.BLOCK_BLUE; + } + + assertFalse("no holes", field.hasHoles()); + + array[6][0] = Field.BLOCK_VOID; + + assertTrue("one hole", field.hasHoles()); + } } |
From: Emmanuel B. <sm...@us...> - 2005-05-10 02:38:08
|
Update of /cvsroot/jetrix/jetrix/src/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3755 Modified Files: channels.xml Log Message: New puzzle channel Index: channels.xml =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/etc/channels.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** channels.xml 4 May 2005 21:12:38 -0000 1.9 --- channels.xml 10 May 2005 02:37:58 -0000 1.10 *************** *** 24,27 **** --- 24,28 ---- <alias name="command" class="net.jetrix.filter.CommandFilter"/> <alias name="survival" class="net.jetrix.filter.SurvivalFilter"/> + <alias name="puzzle" class="net.jetrix.filter.PuzzleFilter"/> <alias name="random" class="net.jetrix.filter.RandomFilter"/> </filter-definitions> *************** *** 263,266 **** --- 264,275 ---- </channel> + <channel name="puzzle"> + <description>Downstack 'em all!</description> + <max-players>1</max-players> + <filters> + <filter name="puzzle"/> + </filters> + </channel> + <channel name="admins"> <description>Administrators' Lair</description> |
From: Emmanuel B. <sm...@us...> - 2005-05-10 02:31:01
|
Update of /cvsroot/jetrix/jetrix/src/java/net/jetrix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2732 Modified Files: Field.java Log Message: Added persistence and utility methods Index: Field.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/java/net/jetrix/Field.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Field.java 11 Jan 2005 00:57:14 -0000 1.2 --- Field.java 10 May 2005 02:30:50 -0000 1.3 *************** *** 1,5 **** /** * Jetrix TetriNET Server ! * Copyright (C) 2001-2003 Emmanuel Bourg * * This program is free software; you can redistribute it and/or --- 1,5 ---- /** * Jetrix TetriNET Server ! * Copyright (C) 2001-2005 Emmanuel Bourg * * This program is free software; you can redistribute it and/or *************** *** 20,26 **** --- 20,30 ---- package net.jetrix; + import static net.jetrix.config.Special.*; + import java.util.logging.*; import java.util.*; + import java.io.*; + import net.jetrix.config.*; import net.jetrix.messages.*; *************** *** 44,62 **** public static final byte BLOCK_RANDOM = '6'; - public static final byte SPECIAL_ADDLINE = 'a'; - public static final byte SPECIAL_CLEARLINE = 'c'; - public static final byte SPECIAL_NUKEFIELD = 'n'; - public static final byte SPECIAL_RANDOMCLEAR = 'r'; - public static final byte SPECIAL_SWITCHFIELD = 's'; - public static final byte SPECIAL_CLEARSPECIAL = 'b'; - public static final byte SPECIAL_GRAVITY = 'g'; - public static final byte SPECIAL_QUAKEFIELD = 'q'; - public static final byte SPECIAL_BLOCKBOMB = 'o'; - private static final byte blocks[] = ! new byte[] { BLOCK_VOID, BLOCK_BLUE, BLOCK_YELLOW, BLOCK_GREEN, BLOCK_PURPLE, BLOCK_RED, SPECIAL_ADDLINE, ! SPECIAL_CLEARLINE, SPECIAL_NUKEFIELD, SPECIAL_RANDOMCLEAR, SPECIAL_SWITCHFIELD, ! SPECIAL_CLEARSPECIAL, SPECIAL_GRAVITY, SPECIAL_QUAKEFIELD, SPECIAL_BLOCKBOMB }; private byte[][] field = new byte[WIDTH][HEIGHT]; --- 48,64 ---- public static final byte BLOCK_RANDOM = '6'; private static final byte blocks[] = ! new byte[] { BLOCK_VOID, BLOCK_BLUE, BLOCK_YELLOW, BLOCK_GREEN, BLOCK_PURPLE, BLOCK_RED, ! (byte) ADDLINE.getLetter(), ! (byte) CLEARLINE.getLetter(), ! (byte) NUKEFIELD.getLetter(), ! (byte) RANDOMCLEAR.getLetter(), ! (byte) SWITCHFIELD.getLetter(), ! (byte) CLEARSPECIAL.getLetter(), ! (byte) GRAVITY.getLetter(), ! (byte) QUAKEFIELD.getLetter(), ! (byte) BLOCKBOMB.getLetter() }; + /** Array of blocks. (0, 0) is the bottom left block, and (12, 22) is the upper right block. */ private byte[][] field = new byte[WIDTH][HEIGHT]; *************** *** 93,96 **** --- 95,181 ---- /** + * Check if the field contains the specified special block. + * + * @param special the special to check + * @since 0.3 + */ + public boolean contains(Special special) + { + for (int i = HEIGHT - 1; i >= 0; i--) + { + for (int j = 0; j < WIDTH; j++) + { + if (field[j][i] == special.getLetter()) + { + return true; + } + } + } + + return false; + } + + /** + * Check if the field contains a special block. + */ + public boolean containsSpecialBlock() + { + for (int i = HEIGHT - 1; i >= 0; i--) + { + for (int j = 0; j < WIDTH; j++) + { + if ('a' <= field[j][i] && field[j][i] <= 'z') + { + return true; + } + } + } + + return false; + } + + /** + * Check if the field has holes (i.e. if a gravity block may have an effect). + * + * @since 0.3 + */ + public boolean hasHoles() + { + for (int i = 1; i <= HEIGHT - 1; i++) + { + for (int j = 0; j < WIDTH; j++) + { + if (field[j][i] != BLOCK_VOID && field[j][i - 1] == BLOCK_VOID) + { + return true; + } + } + } + + return false; + } + + /** + * Return the height of the highest block. + * + * @since 0.3 + */ + public int getHighest() + { + for (int i = HEIGHT - 1; i >= 1; i--) + { + for (int j = 0; j < WIDTH; j++) + { + if (field[j][i] != BLOCK_VOID) + { + return i; + } + } + } + + return 0; + } + + /** * Update the field with the specified FieldMessage. */ *************** *** 121,125 **** } } - } else if (fieldString.length() == WIDTH * HEIGHT) --- 206,209 ---- *************** *** 128,132 **** for (int i = 0; i < fieldString.length(); i++) { ! field[i % WIDTH][HEIGHT - i / WIDTH - 1] = (byte) fieldString.charAt(i); } } --- 212,221 ---- for (int i = 0; i < fieldString.length(); i++) { ! char c = fieldString.charAt(i); ! ! // replace random colored blocks ! c = (c == BLOCK_RANDOM) ? (char) (BLOCK_BLUE + ((int) (Math.random() * 5))) : c; ! ! field[i % WIDTH][HEIGHT - i / WIDTH - 1] = (byte) c; } } *************** *** 159,163 **** /** ! * Return the block at the specified location. * * @param x --- 248,253 ---- /** ! * Return the block at the specified location. (0, 0) is the bottom left ! * block, and (12, 22) is the upper right block. * * @param x *************** *** 182,184 **** --- 272,368 ---- } } + + + /** + * Load the field from the specified file + * + * @since 0.3 + */ + public void load(String file) throws IOException + { + BufferedReader in = null; + + try + { + in = new BufferedReader(new FileReader(file)); + + for (int i = 0; i < HEIGHT; i++) + { + String line = in.readLine(); + + if (line == null || line.length() != WIDTH) + { + throw new IOException("Field format error at line " + i); + } + + for (int j = 0; j < WIDTH; j++) + { + byte block = (byte) line.charAt(j); + + if (isValidBlock(block)) + { + field[j][HEIGHT - i - 1] = block; + } + else + { + throw new IOException("Illegal block '" + block + "' at line " + i + " , column " + j); + } + } + } + } + finally + { + if (in != null) + { + in.close(); + } + } + } + + /** + * Save the field to the specified file. + * + * @since 0.3 + */ + public void save(String file) throws IOException + { + FileOutputStream out = null; + + try + { + out = new FileOutputStream(file); + + for (int i = 0; i < WIDTH; i++) + { + for (int j = 0; j < HEIGHT; j++) + { + out.write(field[i][HEIGHT - j - 1]); + } + out.write('\n'); + } + } + finally + { + if (out != null) + { + out.close(); + } + } + } + + private boolean isValidBlock(byte block) + { + if (block >= '0' && block <= '6') + { + return true; + } + else if (Special.valueOf((char) block) != null) + { + return true; + } + else + { + return false; + } + } } |
From: Emmanuel B. <sm...@us...> - 2005-05-10 02:27:18
|
Update of /cvsroot/jetrix/jetrix/src/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2079 Modified Files: jetrix_en.properties jetrix_fr.properties Log Message: Strings for the puzzle filter Index: jetrix_fr.properties =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/lang/jetrix_fr.properties,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** jetrix_fr.properties 3 May 2005 11:46:00 -0000 1.24 --- jetrix_fr.properties 10 May 2005 02:27:09 -0000 1.25 *************** *** 210,213 **** --- 210,216 ---- filter.flood.blocked=<red>Flot de messages bloqué en provenance de <b>{0} + filter.puzzle.announce=<b><brown>Niveay <aqua>{0}</aqua> : <purple>"{1}"</purple> <i>Conçu par</i> <aqua>{2}</aqua>. + filter.puzzle.cleared=<b><red>Félicitations ! Puzzle résolu ! + filter.tetris.start_message=Le premier joueur qui réalise {0} tetris gagne ! filter.tetris.lead={0} mène la partie avec {1} tetris Index: jetrix_en.properties =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/lang/jetrix_en.properties,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** jetrix_en.properties 3 May 2005 11:45:59 -0000 1.26 --- jetrix_en.properties 10 May 2005 02:27:09 -0000 1.27 *************** *** 246,249 **** --- 246,252 ---- filter.flood.blocked=<red>Flood blocked from player <b>{0} + filter.puzzle.announce=<b><brown>Level <aqua>{0}</aqua> : <purple>"{1}"</purple> <i>Designed by</i> <aqua>{2}</aqua>. + filter.puzzle.cleared=<b><red>Congratulations! Puzzle cleared! + filter.tetris.start_message=The first player to complete {0} tetris win! filter.tetris.lead={0} leads with {1} tetris |
From: Emmanuel B. <sm...@us...> - 2005-05-10 02:24:03
|
Update of /cvsroot/jetrix/jetrix/src/test/net/jetrix/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1390 Added Files: DownstackPuzzleGeneratorTest.java Log Message: no message --- NEW FILE: DownstackPuzzleGeneratorTest.java --- /** * Jetrix TetriNET Server * Copyright (C) 2005 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.filter; import junit.framework.*; import net.jetrix.config.*; /** * @author Emmanuel Bourg * @version $Revision: 1.1 $, $Date: 2005/05/10 02:23:55 $ */ public class DownstackPuzzleGeneratorTest extends TestCase { public void testGetNextPuzzle() { PuzzleGenerator generator = new DownstackPuzzleGenerator(); Puzzle puzzle = generator.getNextPuzzle(); assertNotNull("puzzle null", puzzle); assertEquals("author", "Klr", puzzle.getAuthor()); assertEquals("name", "PUzzle BoBblE", puzzle.getName()); assertEquals("comment", "none", puzzle.getComment()); assertNotNull("null field", puzzle.getField()); assertFalse("empty field", puzzle.getField().isEmpty()); Settings settings = puzzle.getSettings(); assertNotNull("null settings", settings); int[] blocks = { 14, 14, 14, 14, 15, 15, 14 }; for (int i = 0; i < DownstackPuzzleGenerator.BLOCKS.length; i++) { Block block = DownstackPuzzleGenerator.BLOCKS[i]; assertEquals(block.getCode() + " occurancy", blocks[i], settings.getOccurancy(block)); } int[] specials = { 32, 18, 1, 11, 3, 14, 1, 6, 14 }; for (Special special : Special.values()) { assertEquals(special.getCode() + " occurancy", specials[special.getValue()], settings.getOccurancy(special)); } assertEquals("sudden death message", "Time! It's SUDDEN DEATH MODE!", settings.getSuddenDeathMessage()); assertEquals("sudden death delay", 30, settings.getSuddenDeathDelay()); assertEquals("sudden death time", 180, settings.getSuddenDeathTime()); assertEquals("sudden death lines", 1, settings.getSuddenDeathLinesAdded()); // RULES 1 2 1 1 0 18 1 1 assertEquals("starting level", 1, settings.getStartingLevel()); assertEquals("lines per level", 2, settings.getLinesPerLevel()); assertEquals("level increase", 1, settings.getLevelIncrease()); assertEquals("lines per special", 1, settings.getLinesPerSpecial()); assertEquals("special added", 0, settings.getSpecialAdded()); assertEquals("special capacity", 18, settings.getSpecialCapacity()); assertEquals("classic rules", true, settings.getClassicRules()); assertEquals("average levels", true, settings.getAverageLevels()); } } |