wok-current rev 18844
Slitaz Tic Tac Toe game
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/slitaz-tic-tac-toe/receipt Fri Jan 22 21:35:30 2016 -0200 1.3 @@ -0,0 +1,17 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="slitaz-tic-tac-toe" 1.7 +VERSION="1.2" 1.8 +CATEGORY="games" 1.9 +SHORT_DESC="Play Tic Tac Toe game with Slitaz" 1.10 +MAINTAINER="hackdorte@sapo.pt" 1.11 +LICENSE="BSD" 1.12 +WEB_SITE="http://people.slitaz.org/~leonardolaporte/slitaz/source/games/" 1.13 +DEPENDS="tazweb" 1.14 + 1.15 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.16 +genpkg_rules() 1.17 +{ 1.18 + mkdir -p $fs/usr 1.19 + cp -a stuff/* $fs/usr 1.20 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/slitaz-tic-tac-toe/stuff/share/applications/slitaz-tic-tac-toe.desktop Fri Jan 22 21:35:30 2016 -0200 2.3 @@ -0,0 +1,18 @@ 2.4 +[Desktop Entry] 2.5 +Type=Application 2.6 +Name=Slitaz Tic Tac Toe 2.7 +Name[es]=Slitaz Tic Tac Toe 2.8 +Name[fr]=Slitaz Tic Tac Toe 2.9 +Name[pt]=Slitaz Tic Tac Toe 2.10 +Name[pt_BR]=Slitaz Tic Tac Toe 2.11 +Name[ru]=Slitaz Tic Tac Toe 2.12 +Comment=Play Tic Tac Toe Game With Slitaz GNU/Linux 2.13 +Comment[es]=Play Tic Tac Toe Game With Slitaz GNU/Linux 2.14 +Comment[fr]=Play Tic Tac Toe Game With Slitaz GNU/Linux 2.15 +Comment[pt]=Play Tic Tac Toe Game With Slitaz GNU/Linux 2.16 +Comment[pt_BR]=Play Tic Tac Toe Game With Slitaz GNU/Linux 2.17 +Comment[ru]=Play Tic Tac Toe Game With Slitaz GNU/Linux 2.18 +Icon=slitaz-tic-tac-toe 2.19 +Categories=Game;BoardGame; 2.20 +Terminal=false 2.21 +Exec=sh -c "url=file:////usr/share/games/slitaz-tic-tac-toe/slitaz-tic-tac-toe.html ; tazweb --notoolbar \$url || browser \$url" 2.22 \ No newline at end of file
3.1 Binary file slitaz-tic-tac-toe/stuff/share/games/slitaz-tic-tac-toe/bg.jpg has changed
4.1 Binary file slitaz-tic-tac-toe/stuff/share/games/slitaz-tic-tac-toe/black-stone.png has changed
5.1 Binary file slitaz-tic-tac-toe/stuff/share/games/slitaz-tic-tac-toe/blank.png has changed
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/slitaz-tic-tac-toe/stuff/share/games/slitaz-tic-tac-toe/data.js Fri Jan 22 21:35:30 2016 -0200 6.3 @@ -0,0 +1,251 @@ 6.4 +var x = "black-stone.png"; 6.5 + 6.6 +var o = "white-stone.png"; 6.7 + 6.8 +var blank = "blank.png"; 6.9 + 6.10 +var pause = 0; 6.11 +var all = 0; 6.12 +var a = 0; 6.13 +var b = 0; 6.14 +var c = 0; 6.15 +var d = 0; 6.16 +var e = 0; 6.17 +var f = 0; 6.18 +var g = 0; 6.19 +var h = 0; 6.20 +var i = 0; 6.21 +var temp=""; 6.22 +var ok = 0; 6.23 +var cf = 0; 6.24 +var choice=9; 6.25 +var aRandomNumber = 0; 6.26 +var comp = 0; 6.27 +var t = 0; 6.28 +var wn = 0; 6.29 +var ls = 0; 6.30 +var ts = 0; 6.31 +function help() { 6.32 +alert("Game Help \n\n ------------------ \n\n You play with black stone and Slitaz with white stone. \n\n Choose an empty space and click. \n\n The first complete three lines is the winner. \n\n ------------------ \n\n To start a new round, click 'New Round' button. \n\n To start a new game, click 'Restart Game' button. \n\n") 6.33 +} 6.34 +function logicOne() { 6.35 +if ((a==1)&&(b==1)&&(c==1)) all=1; 6.36 +if ((a==1)&&(d==1)&&(g==1)) all=1; 6.37 +if ((a==1)&&(e==1)&&(i==1)) all=1; 6.38 +if ((b==1)&&(e==1)&&(h==1)) all=1; 6.39 +if ((d==1)&&(e==1)&&(f==1)) all=1; 6.40 +if ((g==1)&&(h==1)&&(i==1)) all=1; 6.41 +if ((c==1)&&(f==1)&&(i==1)) all=1; 6.42 +if ((g==1)&&(e==1)&&(c==1)) all=1; 6.43 +if ((a==2)&&(b==2)&&(c==2)) all=2; 6.44 +if ((a==2)&&(d==2)&&(g==2)) all=2; 6.45 +if ((a==2)&&(e==2)&&(i==2)) all=2; 6.46 +if ((b==2)&&(e==2)&&(h==2)) all=2; 6.47 +if ((d==2)&&(e==2)&&(f==2)) all=2; 6.48 +if ((g==2)&&(h==2)&&(i==2)) all=2; 6.49 +if ((c==2)&&(f==2)&&(i==2)) all=2; 6.50 +if ((g==2)&&(e==2)&&(c==2)) all=2; 6.51 +if ((a != 0)&&(b != 0)&&(c != 0)&&(d != 0)&&(e != 0)&&(f != 0)&&(g != 0)&&(h != 0)&&(i != 0)&&(all == 0)) all = 3; 6.52 +} 6.53 +function logicTwo() { 6.54 +if ((a==2)&&(b==2)&&(c== 0)&&(temp=="")) temp="C"; 6.55 +if ((a==2)&&(b== 0)&&(c==2)&&(temp=="")) temp="B"; 6.56 +if ((a== 0)&&(b==2)&&(c==2)&&(temp=="")) temp="A"; 6.57 +if ((a==2)&&(d==2)&&(g== 0)&&(temp=="")) temp="G"; 6.58 +if ((a==2)&&(d== 0)&&(g==2)&&(temp=="")) temp="D"; 6.59 +if ((a== 0)&&(d==2)&&(g==2)&&(temp=="")) temp="A"; 6.60 +if ((a==2)&&(e==2)&&(i== 0)&&(temp=="")) temp="I"; 6.61 +if ((a==2)&&(e== 0)&&(i==2)&&(temp=="")) temp="E"; 6.62 +if ((a== 0)&&(e==2)&&(i==2)&&(temp=="")) temp="A"; 6.63 +if ((b==2)&&(e==2)&&(h== 0)&&(temp=="")) temp="H"; 6.64 +if ((b==2)&&(e== 0)&&(h==2)&&(temp=="")) temp="E"; 6.65 +if ((b== 0)&&(e==2)&&(h==2)&&(temp=="")) temp="B"; 6.66 +if ((d==2)&&(e==2)&&(f== 0)&&(temp=="")) temp="F"; 6.67 +if ((d==2)&&(e== 0)&&(f==2)&&(temp=="")) temp="E"; 6.68 +if ((d== 0)&&(e==2)&&(f==2)&&(temp=="")) temp="D"; 6.69 +if ((g==2)&&(h==2)&&(i== 0)&&(temp=="")) temp="I"; 6.70 +if ((g==2)&&(h== 0)&&(i==2)&&(temp=="")) temp="H"; 6.71 +if ((g== 0)&&(h==2)&&(i==2)&&(temp=="")) temp="G"; 6.72 +if ((c==2)&&(f==2)&&(i== 0)&&(temp=="")) temp="I"; 6.73 +if ((c==2)&&(f== 0)&&(i==2)&&(temp=="")) temp="F"; 6.74 +if ((c== 0)&&(f==2)&&(i==2)&&(temp=="")) temp="C"; 6.75 +if ((g==2)&&(e==2)&&(c== 0)&&(temp=="")) temp="C"; 6.76 +if ((g==2)&&(e== 0)&&(c==2)&&(temp=="")) temp="E"; 6.77 +if ((g== 0)&&(e==2)&&(c==2)&&(temp=="")) temp="G"; 6.78 +} 6.79 +function logicThree() { 6.80 +if ((a==1)&&(b==1)&&(c==0)&&(temp=="")) temp="C"; 6.81 +if ((a==1)&&(b==0)&&(c==1)&&(temp=="")) temp="B"; 6.82 +if ((a==0)&&(b==1)&&(c==1)&&(temp=="")) temp="A"; 6.83 +if ((a==1)&&(d==1)&&(g==0)&&(temp=="")) temp="G"; 6.84 +if ((a==1)&&(d==0)&&(g==1)&&(temp=="")) temp="D"; 6.85 +if ((a==0)&&(d==1)&&(g==1)&&(temp=="")) temp="A"; 6.86 +if ((a==1)&&(e==1)&&(i==0)&&(temp=="")) temp="I"; 6.87 +if ((a==1)&&(e==0)&&(i==1)&&(temp=="")) temp="E"; 6.88 +if ((a==0)&&(e==1)&&(i==1)&&(temp=="")) temp="A"; 6.89 +if ((b==1)&&(e==1)&&(h==0)&&(temp=="")) temp="H"; 6.90 +if ((b==1)&&(e==0)&&(h==1)&&(temp=="")) temp="E"; 6.91 +if ((b==0)&&(e==1)&&(h==1)&&(temp=="")) temp="B"; 6.92 +if ((d==1)&&(e==1)&&(f==0)&&(temp=="")) temp="F"; 6.93 +if ((d==1)&&(e==0)&&(f==1)&&(temp=="")) temp="E"; 6.94 +if ((d==0)&&(e==1)&&(f==1)&&(temp=="")) temp="D"; 6.95 +if ((g==1)&&(h==1)&&(i==0)&&(temp=="")) temp="I"; 6.96 +if ((g==1)&&(h==0)&&(i==1)&&(temp=="")) temp="H"; 6.97 +if ((g==0)&&(h==1)&&(i==1)&&(temp=="")) temp="G"; 6.98 +if ((c==1)&&(f==1)&&(i==0)&&(temp=="")) temp="I"; 6.99 +if ((c==1)&&(f==0)&&(i==1)&&(temp=="")) temp="F"; 6.100 +if ((c==0)&&(f==1)&&(i==1)&&(temp=="")) temp="C"; 6.101 +if ((g==1)&&(e==1)&&(c==0)&&(temp=="")) temp="C"; 6.102 +if ((g==1)&&(e==0)&&(c==1)&&(temp=="")) temp="E"; 6.103 +if ((g==0)&&(e==1)&&(c==1)&&(temp=="")) temp="G"; 6.104 +} 6.105 +function clearOut() { 6.106 +document.game.you.value="0"; 6.107 +document.game.slitaz.value="0"; 6.108 +document.game.ties.value="0"; 6.109 +} 6.110 +function checkSpace() { 6.111 +if ((temp=="A")&&(a==0)) { 6.112 +ok=1; 6.113 +if (cf==0) a=1; 6.114 +if (cf==1) a=2; 6.115 +} 6.116 +if ((temp=="B")&&(b==0)) { 6.117 +ok=1; 6.118 +if (cf==0) b=1; 6.119 +if (cf==1) b=2; 6.120 +} 6.121 +if ((temp=="C")&&(c==0)) { 6.122 +ok=1; 6.123 +if (cf==0) c=1; 6.124 +if (cf==1) c=2; 6.125 +} 6.126 +if ((temp=="D")&&(d==0)) { 6.127 +ok=1; 6.128 +if (cf==0) d=1; 6.129 +if (cf==1) d=2; 6.130 +} 6.131 +if ((temp=="E")&&(e==0)) { 6.132 +ok=1; 6.133 +if (cf==0) e=1; 6.134 +if (cf==1) e=2; 6.135 +} 6.136 +if ((temp=="F")&&(f==0)) { 6.137 +ok=1 6.138 +if (cf==0) f=1; 6.139 +if (cf==1) f=2; 6.140 +} 6.141 +if ((temp=="G")&&(g==0)) { 6.142 +ok=1 6.143 +if (cf==0) g=1; 6.144 +if (cf==1) g=2; 6.145 +} 6.146 +if ((temp=="H")&&(h==0)) { 6.147 +ok=1; 6.148 +if (cf==0) h=1; 6.149 +if (cf==1) h=2; 6.150 +} 6.151 +if ((temp=="I")&&(i==0)) { 6.152 +ok=1; 6.153 +if (cf==0) i=1; 6.154 +if (cf==1) i=2; 6.155 +} 6.156 +} 6.157 +function yourChoice(chName) { 6.158 +pause = 0; 6.159 +if (all!=0) ended(); 6.160 +if (all==0) { 6.161 +cf = 0; 6.162 +ok = 0; 6.163 +temp=chName; 6.164 +checkSpace(); 6.165 +if (ok==1) { 6.166 +document.images[chName].src = x; 6.167 +} 6.168 +if (ok==0)taken(); 6.169 +process(); 6.170 +if ((all==0)&&(pause==0)) myChoice(); 6.171 + } 6.172 +} 6.173 +function taken() { 6.174 +alert("Please, select an empty. \n\n") 6.175 +pause=1; 6.176 +} 6.177 +function myChoice() { 6.178 +temp=""; 6.179 +ok = 0; 6.180 +cf=1; 6.181 +logicTwo(); 6.182 +logicThree(); 6.183 +checkSpace(); 6.184 +while(ok==0) { 6.185 +aRandomNumber=Math.random() 6.186 +comp=Math.round((choice-1)*aRandomNumber)+1; 6.187 +if (comp==1) temp="A"; 6.188 +if (comp==2) temp="B"; 6.189 +if (comp==3) temp="C"; 6.190 +if (comp==4) temp="D"; 6.191 +if (comp==5) temp="E"; 6.192 +if (comp==6) temp="F"; 6.193 +if (comp==7) temp="G"; 6.194 +if (comp==8) temp="H"; 6.195 +if (comp==9) temp="I"; 6.196 +checkSpace(); 6.197 +} 6.198 +document.images[temp].src= o; 6.199 +process(); 6.200 +} 6.201 +function restart() { 6.202 + if (confirm('Delete all score and restart game?')) { 6.203 + window.location="slitaz-tic-tac-toe.html" 6.204 +} 6.205 +} 6.206 +function ended() { 6.207 +alert("Ops! This round is over. \n\n To play again click 'New Round' button. \n\n To restart all game click 'Restart' button.") 6.208 +} 6.209 +function process() { 6.210 +logicOne(); 6.211 +if (all==1){ alert("Woohoooo! \n\n You are amazing " + player + "! \n\n I'm not buying it. \n\n New round? \n\n"); wn++;} 6.212 +if (all==2){ alert("Awww, that's too bad! \n\n Try to win me! \n\n"); ls++;} 6.213 +if (all==3){ alert("Tie! Let's play again?"); ts++;} 6.214 +if (all!=0) { 6.215 +document.game.you.value = wn; 6.216 +document.game.slitaz.value = ls; 6.217 +document.game.ties.value = ts; 6.218 + } 6.219 +} 6.220 +function playAgain() { 6.221 +if (all==0) { 6.222 +if(confirm("Start new round?")) reset(); 6.223 +} 6.224 +if (all>0) reset(); 6.225 +} 6.226 +function reset() { 6.227 +all = 0; 6.228 +a = 0; 6.229 +b = 0; 6.230 +c = 0; 6.231 +d = 0; 6.232 +e = 0; 6.233 +f = 0; 6.234 +g = 0; 6.235 +h = 0; 6.236 +i = 0; 6.237 +temp=""; 6.238 +ok = 0; 6.239 +cf = 0; 6.240 +choice=9; 6.241 +aRandomNumber = 0; 6.242 +comp = 0; 6.243 +document.images.A.src= blank; 6.244 +document.images.B.src= blank; 6.245 +document.images.C.src= blank; 6.246 +document.images.D.src= blank; 6.247 +document.images.E.src= blank; 6.248 +document.images.F.src= blank; 6.249 +document.images.G.src= blank; 6.250 +document.images.H.src= blank; 6.251 +document.images.I.src= blank; 6.252 +if (t==0) { t=2; myChoice(); } 6.253 +t--; 6.254 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/slitaz-tic-tac-toe/stuff/share/games/slitaz-tic-tac-toe/design.css Fri Jan 22 21:35:30 2016 -0200 7.3 @@ -0,0 +1,31 @@ 7.4 +@charset "utf-8"; 7.5 + 7.6 + html,body {background:#F3F3F3 url(bg.jpg) 50% 50% repeat;color:#000;font:normal normal 12px/23px "Sans", sans-serif;padding:0;margin:0 auto;} 7.7 + a {color:#800;text-decoration:none;} 7.8 + 7.9 + header {background:#000;color:#FFF;border-bottom:2px solid #E1E1E1;} 7.10 + header h1 {background:url(slitaz-ico.png) 10px 4px no-repeat;font-size:14px;font-weight:normal;text-indent:40px;padding:10px 0; margin:0 auto;} 7.11 + 7.12 + form {background:#EEE;width:565px;padding-left:30px;margin:10px auto;} 7.13 + 7.14 + .square {float:left;width:101px;height:101px;padding:0;margin:0;box-shadow:1px 1px 3px 0 #C1C1C1;} 7.15 + .square img {background:#FFF;width:100px;height:100px;border-width:0;} 7.16 + 7.17 + .box {background:transparent;text-align:center;width:305px;margin:3% auto;float:left;} 7.18 + .frame {display:table;width:100%;margin:0 auto;clear:both;} 7.19 + 7.20 + #panel {font-size:10px;text-transform:uppercase;width:200px;padding:2%;margin:3% auto;float:left;} 7.21 + #panel input {background:#555;color:white;font-weight:bold;padding:4px;margin-right:4px;border-width:0;} 7.22 + #panel br {line-height:23px;} 7.23 + 7.24 + #controls,footer {text-align:center;padding:2%;margin:0 auto;clear:both;} 7.25 + #controls input {background:#333;color:#FFF;padding:10px;margin:0 2px;border-width:0;} 7.26 + #controls input:focus,#controls input:hover {background:#B14613;} 7.27 + #controls input.restart {background:#CF2F29;} 7.28 + #controls input.newround {background:#599E3F;} 7.29 + 7.30 + * {line-height:1;outline-width:0;} 7.31 + [type="button"] {cursor:pointer;border-radius:2px;box-shadow:0 2px 4px 0 #CCC;} 7.32 + .clear {border:1px dashed #CF2F29;color:#333;padding:4px;} 7.33 + 7.34 + hr {line-height:0;margin:10px 0;border-width:0;border-bottom:1px solid #CCC;}
8.1 Binary file slitaz-tic-tac-toe/stuff/share/games/slitaz-tic-tac-toe/slitaz-ico.png has changed
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/slitaz-tic-tac-toe/stuff/share/games/slitaz-tic-tac-toe/slitaz-tic-tac-toe.html Fri Jan 22 21:35:30 2016 -0200 9.3 @@ -0,0 +1,115 @@ 9.4 +<!DOCTYPE html> 9.5 +<html> 9.6 +<head> 9.7 + <meta charset="utf-8" /> 9.8 + <title>Slitaz GNU/Linux : Tic-Tac-Toe Game.</title> 9.9 + <link rel="stylesheet" href="design.css" /> 9.10 + <script src="data.js"></script> 9.11 +</head> 9.12 +<body> 9.13 + 9.14 +<header> 9.15 + <h1>Slitaz GNU/Linux : Tic-Tac-Toe Game.</h1> 9.16 +</header> 9.17 + 9.18 +<form name="game"> 9.19 + 9.20 + <div class="box"> 9.21 + 9.22 + <div class="frame"> 9.23 + 9.24 + <div class="square"> 9.25 + <a href="javascript:yourChoice('A')"> 9.26 + <img src="blank.png" name="A" alt="Top-Left" /> 9.27 + </a> 9.28 + </div><!-- square:A --> 9.29 + 9.30 + <div class="square"> 9.31 + <a href="javascript:yourChoice('B')"> 9.32 + <img src="blank.png" name="B" alt="Top-Center" /> 9.33 + </a> 9.34 + </div><!-- square:B --> 9.35 + 9.36 + <div class="square"> 9.37 + <a href="javascript:yourChoice('C')"> 9.38 + <img src="blank.png" name="C" alt="Top-Right" /> 9.39 + </a> 9.40 + </div><!-- square:C --> 9.41 + 9.42 + </div><!-- frame --> 9.43 + <div class="frame"> 9.44 + 9.45 + <div class="square"> 9.46 + <a href="javascript:yourChoice('D')"> 9.47 + <img src="blank.png" name="D" alt="Middle-Left" /> 9.48 + </a> 9.49 + </div><!-- square:D --> 9.50 + 9.51 + <div class="square"> 9.52 + <a href="javascript:yourChoice('E')"> 9.53 + <img src="blank.png" name="E" alt="Middle-Center" /> 9.54 + </a> 9.55 + </div><!-- square:E --> 9.56 + <div class="square"> 9.57 + <a href="javascript:yourChoice('F')"> 9.58 + <img src="blank.png" name="F" alt="Middle-Right" /> 9.59 + </a> 9.60 + </div><!-- square:F --> 9.61 + 9.62 + </div><!-- frame --> 9.63 + <div class="frame"> 9.64 + 9.65 + <div class="square"> 9.66 + <a href="javascript:yourChoice('G')"> 9.67 + <img src="blank.png" name="G" alt="Bottom-Left" /> 9.68 + </a> 9.69 + </div><!-- square:G --> 9.70 + 9.71 + <div class="square"> 9.72 + <a href="javascript:yourChoice('H')"> 9.73 + <img src="blank.png" name="H" alt="Bottom-Center" /> 9.74 + </a> 9.75 + </div><!-- square:H --> 9.76 + 9.77 + <div class="square"> 9.78 + <a href="javascript:yourChoice('I')"> 9.79 + <img src="blank.png" name="I" alt="Bottom-Right" /> 9.80 + </a> 9.81 + </div><!-- square:I --> 9.82 + 9.83 + </div><!-- frame --> 9.84 + 9.85 + 9.86 + </div><!-- box --> 9.87 + 9.88 + <div id="panel"> 9.89 + <p>Game Score</p> 9.90 + <input type="text" readonly="readonly" size="2" name="you" /><label><script>var player = prompt("What's your first name?");document.write(player);</script></label><br /> 9.91 + <input type="text" readonly="readonly" size="2" name="slitaz" /><label>Slitaz</label><br /> 9.92 + <input type="text" readonly="readonly" size="2" name="ties" /><label>Ties</label><hr /> 9.93 + <p><strong>Tips:</strong></p> 9.94 + <p>Click <strong><q>New Round</q></strong> button to start a round with Slitaz.</p> 9.95 + <p class="clear">(!) To clear all score click <strong><q>Restart Game</q></strong>.</p><hr /> 9.96 + <p>You're playing with Slitaz. He is good at this game. <br /> Good Game!</p> 9.97 + </div><!-- panel --> 9.98 + 9.99 + <div id="controls"> 9.100 + <input class="newround" type="button" value="New Round" onClick="playAgain();" /> 9.101 + <input type="button" value="How To Play?" onClick="help();" /> 9.102 + <input class="restart" type="button" value="Restart Game" onClick="restart();" /> 9.103 + </div><!-- controls --> 9.104 + 9.105 +</form> 9.106 + 9.107 +<footer role="contentinfo"> 9.108 + <p> 9.109 + <a href="http://www.slitaz.org/"> 9.110 + • Tic-Tac-Toe with Slitaz • 9.111 + <hr /> 9.112 + Copyright © Slitaz GNU/Linux - BSD License. 9.113 + </a> 9.114 + </p> 9.115 +</footer> 9.116 + 9.117 +</body> 9.118 +</html>
10.1 Binary file slitaz-tic-tac-toe/stuff/share/games/slitaz-tic-tac-toe/white-stone.png has changed
11.1 Binary file slitaz-tic-tac-toe/stuff/share/pixmaps/slitaz-tic-tac-toe.png has changed