[Gamesnws-commits] r33 - pkg/R pkg/man www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 16 15:46:09 CEST 2009


Author: grafab
Date: 2009-09-16 15:46:08 +0200 (Wed, 16 Sep 2009)
New Revision: 33

Modified:
   pkg/R/adminUno.R
   pkg/man/startUnoGame.Rd
   www/index.php
Log:
startUnoGame(...,config=c(T,T,T,T))->rules can set directly, if not, you will be asked for later

website is overworked, second site uno.html

Modified: pkg/R/adminUno.R
===================================================================
--- pkg/R/adminUno.R	2009-08-13 15:19:34 UTC (rev 32)
+++ pkg/R/adminUno.R	2009-09-16 13:46:08 UTC (rev 33)
@@ -79,7 +79,7 @@
 ############################################################
 startUnoGame <- function(wsName, cardsStart=7, 
 		minPlayers=2, maxPlayers=10, 
-		log=0, logfile=NULL, debug=FALSE,...)
+		log=0, logfile=NULL, debug=FALSE, config=NULL,...)
 {	
 	require(nws)
 	ws<-.createUnoGame(wsName, ...)
@@ -87,6 +87,7 @@
   if(wsclass[1]=="netWorkSpace"){
 	readCommand <- ""
 	while(readCommand != "e"){
+		nwsStore(ws,'rulesbools', config)
 
 		# Ask for command from master user
 		readCommand <- readline("Players online [o], Start Game [s], End Game [e], Start Game in Debugmode [d]?")
@@ -99,13 +100,17 @@
 
 		# Commands for actions depending on master-user Input
 		if(readCommand=="s" && nplayers>=minPlayers && nplayers<=maxPlayers){
-		  .askForRules(ws)
+		  	if(is.null(config)){
+				.askForRules(ws)
+			}
       # Start UNO game	
 			.playUnoMaster(ws, players, cardsStart, log=log, logfile=logfile, debug)
 			cat("For replay you have to reset the Game: createUnoGame()\n")
 			readCommand <- readline("End Game [e]?")
 		}else if(readCommand=="d" && nplayers>=minPlayers && nplayers<=maxPlayers){
-      .askForRules(ws)
+		  	if(is.null(config)){
+				.askForRules(ws)
+			}
       # Start UNO game	
 			.playUnoMaster(ws, players, cardsStart, log=log, logfile=logfile, debug=TRUE)
 			cat("For replay you have to reset the Game: createUnoGame()\n")

Modified: pkg/man/startUnoGame.Rd
===================================================================
--- pkg/man/startUnoGame.Rd	2009-08-13 15:19:34 UTC (rev 32)
+++ pkg/man/startUnoGame.Rd	2009-09-16 13:46:08 UTC (rev 33)
@@ -11,6 +11,7 @@
               log = 0, 
               logfile = NULL, 
               debug = FALSE,
+	      config = NULL,
               ...)
 }
 \arguments{
@@ -21,6 +22,7 @@
   \item{log}{number of log mode : 0 = no logging, !0=logging }
   \item{logfile}{the file, where the log should be saved to(not yet implemented)}
   \item{debug}{a logical, if TRUE, there are several debuginformation shown during the game}
+  \item{config}{vector of four logicals, if not set, the program asks for the rules later, }
   \item{...}{Usual parameters to initialize a netWorkSpace(). See \url{http://nws-r.sourceforge.net/doc/nwsR-1.5.0.pdf} (Page 25) for further information}
 }
 \details{
@@ -36,11 +38,9 @@
 }
 \examples{
 \dontrun{
-  ws<-createUnoGame("test","localhost")
-  startUnoGame(ws,log=1)
+  startUnoGame("test",serverHost="localhost",config=c(T,T,T,T))
 }
 \dontrun{
-  ws<-createUnoGame("test","localhost")
-  startUnoGame(ws, cardsStart=13, minPlayers=4)
+  startUnoGame("test",serverHost="localhost", cardsStart=13, minPlayers=4)
 }
 }
\ No newline at end of file

Modified: www/index.php
===================================================================
--- www/index.php	2009-08-13 15:19:34 UTC (rev 32)
+++ www/index.php	2009-09-16 13:46:08 UTC (rev 33)
@@ -3,13 +3,11 @@
 <!-- It can be changed as liked or replaced by other content -->
 
 <?php
-
 $domain=ereg_replace('[^\.]*\.(.*)$','\1',$_SERVER['HTTP_HOST']);
 $group_name=ereg_replace('([^\.]*)\..*$','\1',$_SERVER['HTTP_HOST']);
 $themeroot='http://r-forge.r-project.org/themes/rforge/';
+echo '<?xml version="1.0" encoding="UTF-8"?>
 
-echo '<?xml version="1.0" encoding="UTF-8"?>';
-?>
 <!DOCTYPE html
 	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -26,7 +24,7 @@
 <!-- R-Forge Logo -->
 <table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr><td>
-<a href="/"><img src="<?php echo $themeroot; ?>/images/logo.png" border="0" alt="R-Forge Logo" /> </a> </td> </tr>
+<a href="/"><img src="images/Rlogo.jpg" border="0" alt="R-Forge Logo" /> </a> </td> </tr>
 <tr><td align="right">
 <img src="images/gamesNWS.jpg" border="0" alt="R-gamesNWS Logo" /></td> </tr>
 </table>
@@ -45,9 +43,9 @@
 
  end of project description -->
  
-<h1>Welcome to Playing games with R using a NWS Server project!</h1>
+<h1>Welcome to Play games with R using the NWS Server technology!</h1>
 <p>The R package 'gamesNWS' provides an infrastructure to play different 
-games (e.g. uno, poker) in a network. You can play the games with your friends 
+card games (e.g. uno, poker) in a network. You can play the games with your friends 
 in the whole world or against several computer players at your local machine. 
 For the communication a NetWorkSpace Server and the R package NWS will be used. 
 Just install a NWS Server, send the login data to your friends and start the game. 
@@ -62,87 +60,45 @@
 Than a master user (one of the players) is required:
 <ul>
   <li>First of all you need a running NWS Server. The installation is quite simple: http://nws-r.sourceforge.net/</li>
-  <li>A master player has to create the game: ws <- createUnoGame('MyGame', serverHost='localhost')</li>
-  <li>The master user has to start the game: startUnoGame(ws) </li>
+  <li>A master player has to create the game(e.g. a Uno game): startUnoGame('MyGame', serverHost='localhost') </li>
 </ul>
-Than all players have to connect to the same server: playUno('MyGame', serverHost='localhost', user='username')<br>
+Than all players have to connect to the same server(e.g. a Uno game): playUno('MyGame', serverHost='localhost', user='username')<br>
 The rest is quite simple and will be explained during the game.
 </p>
 
-<h3>Example:</h3>
-  <p>Run 3 Unix-consoles.<br>
+<h3>Example(UNO):</h3>
+  <p>Start three R sessions<br>
   For all:<ul>
   	<li>install.packages("gamesNws",repos="http://R-Forge.R-project.org")</li>
-  	<li>install.packages("nws")</li>
-  	<li>library(nws)</li>
   	<li>library(gamesNws)</li></ul>
   Console 1:<ul>
-  <li>ws <- createUnoGame('exampleWorkSpace', serverHost='138.245.80.17')</li>
-  <li>startUnoGame(ws)</li></ul>
+  <li>startUnoGame('exampleWorkSpace', serverHost='localhost',config=c(T,T,T,T))</li></ul>
   Console 2:<ul>
-  <li>playUnoGame('exampleWorkSpace', serverHost='138.245.80.17', user='exampleplayer1')</li></ul>
+  <li>playUnoGame('exampleWorkSpace', serverHost='localhost', user='exampleplayer1')</li></ul>
   Console 3:<ul>
-  <li>playUnoGame('exampleWorkSpace', serverHost='138.245.80.17', user='exampleplayer2')</li></ul>
+  <li>playUnoGame('exampleWorkSpace', serverHost='localhost', user='exampleplayer2')</li></ul>
   Console 1:<ul>
-  <li>s</li>
-  <li>y</li>
-  <li>y</li>
-  <li>y</li>
-  <li>y</li></ul>
+  <li>s</li></ul>
   Console 2 or 3:<ul>
-  <li>get-info</li>
-  <li>NO</li>
-  <li>red-5</li></ul>
+  Depending on the played card,you can play one of the following commands:
+  <li>get-info (shows some game-relevant information)</li>
+  <li>NO (if you don't want or can't play a card)</li>
+  <li>color-value (plays one of your hand cards)</li></ul>
 </ul>
 </p>
 
+<h2>Implemented Games:</h2>
+<ul>
+<li><a href="uno.html">UNO</a></li>
+</ul>
+
 <h2>ToDo's</h2>
 <ul>
-  <li>logfile-directory</li>
-  <li>GUI</li>
-  <li>Further logging-modes for more statistical information</li>
-  <li>Further computer player with different skills:<ul>
-  	<li>Try to concatenate penalties</li>
-  	<li>Randomly forget to say "UNO"</li>
-  	<li>Try not to have rybg-cards at the end</li>
-  	<li>Try to combine BREAK and/or BACK cards in 2-Player-game</li>
-  	<li>Try to play maximum-scored card</li>
-  	<li>Try to play minimum-scored card</li>
-  	<li>...</li></ul></li>
   <li>Provide NWS-Game Server for everyone</li>
   <li>Implement second game: POKER</li>
   <li>Chat</li>
 </ul>
 
-<h2>UNO-Rules</h2>
-<p>We used the rules discribed in <a href="http://en.wikipedia.org/wiki/Uno_(game)">wikipedia(engl)</a>.<br>
-And we started to implement some of the additional rules described in <a href="http://de.wikipedia.org/wiki/Uno_(Kartenspiel)">German wikipedia</a>.</p>
-
-<h2>UNO-Commands</h2>
-<table border=1>
-	<tr>
-		<th>Command</th>
-		<th>Function</th>		
-	</tr>
-	<tr>
-		<td>get-info</td>
-		<td>shows some game-relevant information</td>
-	</tr>
-	<tr>
-		<td>say-uno</td>
-		<td>this command has to be issued, before the second-last card is played</td>
-	</tr>
-	<tr>
-		<td>NO</td>
-		<td>if you don't want or can't play a card</td>
-	</tr>
-	<tr>
-		<td>(color)-(value)</td>
-		<td>color = {red, yellow, blue, green, rybg}<br>value = {0:9, 2+, 4+, BREAK, BACK}</td>
-	</tr>
-</table>
-
-
 <h2>How to add further games to the 'gamesNWS' package?</h2>
 <p>ToDo</p>
 



More information about the Gamesnws-commits mailing list