[Toss-devel-svn] SF.net SVN: toss:[1694] trunk/Toss
Status: Beta
Brought to you by:
lukaszkaiser
|
From: <luk...@us...> - 2012-03-15 00:19:05
|
Revision: 1694
http://toss.svn.sourceforge.net/toss/?rev=1694&view=rev
Author: lukaszkaiser
Date: 2012-03-15 00:18:58 +0000 (Thu, 15 Mar 2012)
Log Message:
-----------
Simple python script to run server and browser, other small corrections.
Modified Paths:
--------------
trunk/Toss/Client/Main.js
trunk/Toss/Client/index.html
trunk/Toss/Server/Server.ml
Added Paths:
-----------
trunk/Toss/Client/support.html
trunk/Toss/Toss.py
Removed Paths:
-------------
trunk/Toss/run_server.sh
Modified: trunk/Toss/Client/Main.js
===================================================================
--- trunk/Toss/Client/Main.js 2012-03-12 14:12:20 UTC (rev 1693)
+++ trunk/Toss/Client/Main.js 2012-03-15 00:18:58 UTC (rev 1694)
@@ -27,9 +27,7 @@
var GAME_NAME = ""; // name of current game, e.g. "Breakthrough"
var PLAY = [];
-var SIMPLE_SET = false;
-
function disp_name (uname) {
if (uname == "guest") { return ("You"); }
if (uname == "computer") { return ("Computer"); }
@@ -66,6 +64,10 @@
}
if (window.location.href.indexOf("?simple=true") > 0) {
document.getElementById ("ads").style.display = "none";
+ document.getElementById ("leftupperlogo-link").href =
+ "index.html?simple=true";
+ document.getElementById ("backlink-games").href =
+ "index.html?simple=true";
document.getElementById ("more-games-bt-div").style.display = "none";
}
var gindex = window.location.href.indexOf("?game=")
@@ -210,7 +212,7 @@
} else {
console.log ("Discarded " + m.comp_iters +" iterations.");
}
- }, 700); // wait 500 miliseconds more than the 0.2s speedup for local
+ }, 1000); // wait 800 miliseconds more than the 0.2s speedup for local
};
// ASYNCH does not implement multiple plays
// I'm not sure about players being numbered from 1
Modified: trunk/Toss/Client/index.html
===================================================================
--- trunk/Toss/Client/index.html 2012-03-12 14:12:20 UTC (rev 1693)
+++ trunk/Toss/Client/index.html 2012-03-15 00:18:58 UTC (rev 1694)
@@ -33,7 +33,7 @@
<a href="http://itunes.apple.com/us/app/tplay/id438620686"
><img style="height: 24px;" src="img/appstore-small.png" /></a>
</span>
-<span id="toprighttab"><a href="index.html">Games</a></span>
+<span id="toprighttab"><a id="backlink-games" href="index.html">Games</a></span>
</div>
<div id="welcome">
Added: trunk/Toss/Client/support.html
===================================================================
--- trunk/Toss/Client/support.html (rev 0)
+++ trunk/Toss/Client/support.html 2012-03-15 00:18:58 UTC (rev 1694)
@@ -0,0 +1,113 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/xhtml+xml; charset=UTF-8" />
+ <title>tPlay — Support</title>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1" />
+ <link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" />
+ <link rel="stylesheet" type="text/css" href="Style.css" media="screen" title="Default"/>
+</head>
+
+<body>
+
+<div id="main">
+
+<div id="top">
+<div id="logo"><a href="index.html"><img src="img/logo.png" alt="tPlay" /></a></div>
+<div id="topbar"><span id="topuser">Support</span></div>
+</div>
+
+<div style="font-size: 1.1em; margin: 1em; padding: 1em;">
+
+<h2>Contact Us</h2>
+<p style="line-height: 130%;">
+Thank you for your interest in tPlay! We try to make our interface as
+intuitive and simple as possible, and we hope it is mostly self-explanatory.
+If you encounter any problems, have some remarks or just want to tell us
+how you feel about tPlay, write us an email.<br/>
+<span style="position: relative; top: 0px; left: 15em;">
+<script type="text/javascript">
+// Email address obfuscation to prevent some spamming.
+function begin_mailto (name, domain, title) {
+ var address = name + '@' + domain;
+ if(title) {
+ document.write("<a class='contact' href='mailto:" + address + "'>" +
+ title + "<span style='display: none;'>");
+ } else {
+ document.write("<a class='contact' href='mailto:" + address + "'>" +
+ address + "<span style='display: none;'>");
+ }
+}
+
+function end_mailto() {
+ document.write("</span></a>");
+}
+begin_mailto("tossplay", "gmail.com",
+ "Email tos...@gm...");</script>tossplay [AT] gmail [DOT] com
+<script type="text/javascript">end_mailto();</script>
+</span>
+<br/>
+</p>
+
+<h2>How Do I Move?</h2>
+<p style="line-height: 130%;">
+At tPlay you make moves just by clicking on the fields from and to which you
+move. In case there is only a single possible move, it is made directly to
+speed up the play. If you make moves by mistake, activate the
+<span style="font-weight: bold;">Ask Before Move</span> control
+in the bottom-left of the screen. Then you will be asked to confirm
+each selected move before it is taken.
+</p>
+
+<h2>What Are The Rules Of The Games?</h2>
+<ul>
+ <li>Breakthrough — break through opponent's lines, see
+ <a href="http://en.wikipedia.org/wiki/Breakthrough_(board_game)"
+ style="color: #400827;">Breakthrough on Wikipedia</a>
+<li>Checkers — beat opponent's pieces, see
+ <a href="http://en.wikipedia.org/wiki/English_draughts"
+ style="color: #400827;">Checkers on Wikipedia</a>
+<li>Chess — check-mate, see
+ <a href="http://en.wikipedia.org/wiki/Chess"
+ style="color: #400827;">Chess on Wikipedia</a>
+<li>Connect4 — make a line of four, see
+ <a href="http://en.wikipedia.org/wiki/Connect4"
+ style="color: #400827;">Connect4 on Wikipedia</a>
+</li>
+<li>Gomoku — make a line of five, see
+ <a href="http://en.wikipedia.org/wiki/Gomoku"
+ style="color: #400827;">Gomoku on Wikipedia</a>
+</li>
+<li>Pawn-Whopping — get a pawn to the other end, see
+ <a href="http://en.wikipedia.org/wiki/Pawn_(chess)"
+ style="color: #400827;">Pawn Moves on Wikipedia</a>
+</li>
+</ul>
+
+<h2>How Do I Set The Playing Level?</h2>
+<p style="line-height: 130%;">
+The level at tPlay varies according to the
+<span style="font-weight: bold;">Speed</span> setting in the top right
+corner of the screen. Increase the time for slower but better moves.
+</p>
+
+<h2>Can I Play Other Games?</h2>
+<p style="line-height: 130%;">
+We are adding new games to tPlay all the time.
+Email us your suggestion if you desire a particular game!
+</p>
+
+</div>
+
+<div id="bottom">
+<div id="bottomright">
+<a href="http://toss.sourceforge.net" id="toss-link">Contact</a>
+</div>
+</div>
+
+</div>
+
+
+</body>
+</html>
+
Modified: trunk/Toss/Server/Server.ml
===================================================================
--- trunk/Toss/Server/Server.ml 2012-03-12 14:12:20 UTC (rev 1693)
+++ trunk/Toss/Server/Server.ml 2012-03-15 00:18:58 UTC (rev 1694)
@@ -156,6 +156,7 @@
LOG 2 "%s" (String.concat "\n\n" split_msg);
let timeout, gs_s, heurs_s = float_of_string (List.hd split_msg),
List.hd (List.tl split_msg), List.tl (List.tl split_msg) in
+ Play.set_timeout timeout;
let gs = ArenaParser.parse_game_state Lexer.lex (Lexing.from_string gs_s) in
let heurs = ref (List.map (fun s ->
FormulaParser.parse_real_expr Lexer.lex (Lexing.from_string s)) heurs_s) in
@@ -168,7 +169,6 @@
done;
let heur = Array.of_list (List.rev !res_lst) in
Random.self_init ();
- Play.set_timeout timeout;
let (move, _) = Aux.random_elem (Play.maximax_unfold_choose 1000000
(fst gs) (snd gs) heur) in
Play.cancel_timeout ();
Added: trunk/Toss/Toss.py
===================================================================
--- trunk/Toss/Toss.py (rev 0)
+++ trunk/Toss/Toss.py 2012-03-15 00:18:58 UTC (rev 1694)
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+import sys, subprocess, os
+
+def createdir (d):
+ try:
+ os.mkdir (d)
+ print (d + " created")
+ except OSError:
+ print (d + " exists")
+
+
+server = subprocess.Popen(["./TossServer"], stdout=subprocess.PIPE);
+
+caching = True
+while caching:
+ l = server.stdout.readline()
+ if (l.find("caching finished") > -1): caching = False
+
+profiledir = os.getenv("HOME") + "/.tossfirefoxprofile"
+createdir (profiledir)
+f = open (profiledir + "/user.js", "w")
+f.write ('user_pref("browser.tabs.autoHide", true);')
+f.close ()
+createdir (profiledir + "/chrome")
+f = open (profiledir + "/chrome/userChrome.css", "w")
+f.write ('#nav-bar { display: none; }')
+f.close ()
+
+subprocess.call(["firefox", "-no-remote", "--profile", profiledir,
+ "http://localhost:8110/index.html?simple=true"])
+
+server.terminate()
+print "Finished"
Property changes on: trunk/Toss/Toss.py
___________________________________________________________________
Added: svn:executable
+ *
Deleted: trunk/Toss/run_server.sh
===================================================================
--- trunk/Toss/run_server.sh 2012-03-12 14:12:20 UTC (rev 1693)
+++ trunk/Toss/run_server.sh 2012-03-15 00:18:58 UTC (rev 1694)
@@ -1,3 +0,0 @@
-#!/bin/bash
-# Example script to run the TossServer
-OCAMLRUNPARAM=b; export OCAMLRUNPARAM; /var/www/TossServer -d 0 -eof -mail -nosave -html /var/www/html/ -p 80 -s tplay.org -tID toss_id_0679_ -db /var/www/db/tossdb.sqlite &> /var/www/server_log &
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|