added tafl module
BIN
src/games/tafl/ardri-3dthumb.png
Normal file
After Width: | Height: | Size: 18 KiB |
8
src/games/tafl/credits-fr.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<p>Crédits pour les jeux de Tafl
|
||||
<br>
|
||||
- règles orginales: certainement quelqu'un dans le grand Nord, il y a très très longtemps de cela... ;)
|
||||
<br>
|
||||
- développement: Michel Gutierrez (@<a target="_blank" href="http://twitter.com/_mig_">_mig_</a>) & Jérôme Choain (@<a target="_blank" href="http://twitter.com/jcfrog">jcfrog</a>)
|
||||
<br>
|
||||
- graphismes: Jérôme Choain (@<a target="_blank" href="http://twitter.com/jcfrog">jcfrog</a>).
|
||||
</p>
|
8
src/games/tafl/credits.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<p>Credits for Jocly version of the Tafl games:
|
||||
<br>
|
||||
- original rules: probably someone in the North, a long long time ago ;)
|
||||
<br>
|
||||
- development: Michel Gutierrez (@<a target="_blank" href="http://twitter.com/_mig_">_mig_</a>) & Jérôme Choain (@<a target="_blank" href="http://twitter.com/jcfrog">jcfrog</a>)
|
||||
<br>
|
||||
- graphic design: Jérôme Choain (@<a target="_blank" href="http://twitter.com/jcfrog">jcfrog</a>).
|
||||
</p>
|
2
src/games/tafl/description-fr.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
<p>Les jeux de Tafl sont de vieux jeux de plateau germaniques et celtiques.
|
||||
Les jeux de Tafl en général sont mal documentés. Nous avons du choisir des règles mais l'un des intérêts de Jocly est de construire des communautés autour de ces jeux. C'est une excellente opportunité pour les amoureux ou les experts de ces jeux anciens d'échanger avec nous en utilisant pour cela <a href='http://www.jocly.com/forum/16' target='_blank'>le forum dédié</a>.</p>
|
3
src/games/tafl/description-tg-fr.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<p>Ce jeu est une variante de l'<a href='http://www.jocly.com/jocly/ardri/play' target='_blank'>Ard-Ri</a></p>
|
||||
<p>Les jeux de Tafl sont de vieux jeux de plateau germaniques et celtiques. Malheureusement <em>"Ard-Ri est le moins documenté des variantes de Tafl"</em> <a href='http://en.wikipedia.org/wiki/Tafl_games' target='_blank'>d'après Wikipedia</a>.
|
||||
Les jeux de Tafl en général sont mal documentés. Nous avons du choisir des règles mais l'un des intérêts de Jocly est de construire des communautés autour de ces jeux. C'est une excellente opportunité pour les amoureux ou les experts de ces jeux anciens d'échanger avec nous en utilisant pour cela <a href='http://www.jocly.com/forum/16' target='_blank'>le forum dédié</a>.</p>
|
3
src/games/tafl/description-tg.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<p>This game is a Thanksgiving variant of <a href='http://www.jocly.com/jocly/ardri/play' target='_blank'>Ard-Ri</a></p>
|
||||
<p>Tafl games are old germanic and celtic board games. Unfortunately <em>"Ard-Ri is the least documented of the known tafl variants"</em> <a href='http://en.wikipedia.org/wiki/Tafl_games' target='_blank'>Wikipedia said</a>. Tafl games in general are not well documented. We had to choose some rules but one of the exciting aspects of Jocly is to build communities around games. It is a great opportunity for lovers of ancient games to participate and interact, to propose ideas or correct mistakes we can make.</p>
|
||||
<p>If you are an expert or just a fan of Ard-Ri / Fitchneal, please use the <a href='http://www.jocly.com/forum/16' target='_blank'>dedicated forum</a> to share with us.</p>
|
2
src/games/tafl/description.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
<p>Tafl games are old germanic and celtic board games. Tafl games in general are not well documented. We had to choose some rules but one of the exciting aspects of Jocly is to build communities around games. It is a great opportunity for lovers of ancient games to participate and interact, to propose ideas or correct mistakes we can make.</p>
|
||||
<p>If you are an expert or just a fan of Tafl games, please use the <a href='http://www.jocly.com/forum/16' target='_blank'>dedicated forum</a> to share with us.</p>
|
BIN
src/games/tafl/fitchneal-3dthumb.png
Normal file
After Width: | Height: | Size: 18 KiB |
1340
src/games/tafl/index.js
Normal file
BIN
src/games/tafl/res/images/ardriblackcell.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
src/games/tafl/res/images/ardriboard_bgx1024.jpg
Normal file
After Width: | Height: | Size: 293 KiB |
BIN
src/games/tafl/res/images/ardricellborders.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
src/games/tafl/res/images/ardrikingcell.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
src/games/tafl/res/images/blackcell.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
src/games/tafl/res/images/pieces.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
src/games/tafl/res/images/selectcell2.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
src/games/tafl/res/images/unselectcell.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
src/games/tafl/res/images/whitecell.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
src/games/tafl/res/rules/2d/alea-evangelii.jpg
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
src/games/tafl/res/rules/2d/tafl-ardri.jpg
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
src/games/tafl/res/rules/2d/tafl-brandubh.jpg
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
src/games/tafl/res/rules/2d/tafl-hnefatafl.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
src/games/tafl/res/rules/2d/tafl-tablut.jpg
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
src/games/tafl/res/rules/2d/tawlbwrdd.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
src/games/tafl/res/rules/3d/alea-evangelii.jpg
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
src/games/tafl/res/rules/3d/tafl-ardri.jpg
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
src/games/tafl/res/rules/3d/tafl-brandubh.jpg
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
src/games/tafl/res/rules/3d/tafl-hnefatafl.jpg
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
src/games/tafl/res/rules/3d/tafl-tablut.jpg
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
src/games/tafl/res/rules/3d/tawlbwrdd.jpg
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
src/games/tafl/res/rules/capture2.gif
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
src/games/tafl/res/rules/rulesbuttons-exc.png
Normal file
After Width: | Height: | Size: 948 B |
BIN
src/games/tafl/res/rules/rulesbuttons-play.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
src/games/tafl/res/rules/rulesbuttons-win.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
src/games/tafl/res/sounds/death1.mp3
Normal file
BIN
src/games/tafl/res/sounds/death1.ogg
Normal file
BIN
src/games/tafl/res/sounds/death2.mp3
Normal file
BIN
src/games/tafl/res/sounds/death2.ogg
Normal file
BIN
src/games/tafl/res/sounds/death3.mp3
Normal file
BIN
src/games/tafl/res/sounds/death3.ogg
Normal file
BIN
src/games/tafl/res/sounds/hat.mp3
Normal file
BIN
src/games/tafl/res/sounds/hat.ogg
Normal file
BIN
src/games/tafl/res/sounds/move1.mp3
Normal file
BIN
src/games/tafl/res/sounds/move1.ogg
Normal file
BIN
src/games/tafl/res/sounds/move2.mp3
Normal file
BIN
src/games/tafl/res/sounds/move2.ogg
Normal file
BIN
src/games/tafl/res/sounds/move3.mp3
Normal file
BIN
src/games/tafl/res/sounds/move3.ogg
Normal file
BIN
src/games/tafl/res/sounds/move4.mp3
Normal file
BIN
src/games/tafl/res/sounds/move4.ogg
Normal file
BIN
src/games/tafl/res/sounds/turkey.mp3
Normal file
BIN
src/games/tafl/res/sounds/turkey.ogg
Normal file
BIN
src/games/tafl/res/visuals/alea-evangelii-600x600-2d.jpg
Normal file
After Width: | Height: | Size: 123 KiB |
BIN
src/games/tafl/res/visuals/alea-evangelii-600x600-3d.jpg
Normal file
After Width: | Height: | Size: 123 KiB |
BIN
src/games/tafl/res/visuals/ardri-600x600-2d.jpg
Normal file
After Width: | Height: | Size: 114 KiB |
BIN
src/games/tafl/res/visuals/ardri-600x600-3d.jpg
Normal file
After Width: | Height: | Size: 104 KiB |
BIN
src/games/tafl/res/visuals/brandubh-600x600-2d.jpg
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
src/games/tafl/res/visuals/brandubh-600x600-3d.jpg
Normal file
After Width: | Height: | Size: 104 KiB |
BIN
src/games/tafl/res/visuals/hnefatafl-600x600-2d.jpg
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
src/games/tafl/res/visuals/hnefatafl-600x600-3d.jpg
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
src/games/tafl/res/visuals/tablut-600x600-2d.jpg
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
src/games/tafl/res/visuals/tablut-600x600-3d.jpg
Normal file
After Width: | Height: | Size: 108 KiB |
BIN
src/games/tafl/res/visuals/tawlbwrdd-600x600-2d.jpg
Normal file
After Width: | Height: | Size: 113 KiB |
BIN
src/games/tafl/res/visuals/tawlbwrdd-600x600-3d.jpg
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
src/games/tafl/res/xd-view/meshes/ardri-sprites.png
Normal file
After Width: | Height: | Size: 68 KiB |
BIN
src/games/tafl/res/xd-view/meshes/ardriboardx1024.jpg
Normal file
After Width: | Height: | Size: 312 KiB |
72
src/games/tafl/res/xd-view/meshes/ring-target.js
Normal file
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
|
||||
"metadata" :
|
||||
{
|
||||
"formatVersion" : 3.1,
|
||||
"generatedBy" : "Blender 2.63 Exporter",
|
||||
"vertices" : 72,
|
||||
"faces" : 62,
|
||||
"normals" : 24,
|
||||
"colors" : 0,
|
||||
"uvs" : [],
|
||||
"materials" : 1,
|
||||
"morphTargets" : 0,
|
||||
"bones" : 0
|
||||
},
|
||||
|
||||
"scale" : 1.000000,
|
||||
|
||||
"materials" : [ {
|
||||
"DbgColor" : 15658734,
|
||||
"DbgIndex" : 0,
|
||||
"DbgName" : "ring",
|
||||
"blending" : "NormalBlending",
|
||||
"colorDiffuse" : [0.24284644488761487, 0.38950949295624326, 0.0],
|
||||
"colorSpecular" : [0.5, 0.5, 0.5],
|
||||
"depthTest" : true,
|
||||
"depthWrite" : true,
|
||||
"shading" : "Phong",
|
||||
"specularCoef" : 50,
|
||||
"opacity" : 1.0,
|
||||
"transparent" : false,
|
||||
"vertexColors" : false
|
||||
},
|
||||
|
||||
{
|
||||
"DbgColor" : 15597568,
|
||||
"DbgIndex" : 1,
|
||||
"DbgName" : "square",
|
||||
"blending" : "NormalBlending",
|
||||
"colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
|
||||
"colorSpecular" : [0.5, 0.5, 0.5],
|
||||
"depthTest" : true,
|
||||
"depthWrite" : true,
|
||||
"shading" : "Lambert",
|
||||
"specularCoef" : 50,
|
||||
"opacity" : 1.0,
|
||||
"transparent" : false,
|
||||
"vertexColors" : false
|
||||
}],
|
||||
|
||||
"vertices" : [-0.600834,0.0792329,0.66495,-0.665212,0.0792329,0.66495,-0.665212,0.0792329,0.600834,-0.600834,0.0792329,0.600834,-0.600834,0.120851,0.66495,-0.665212,0.120851,0.66495,-0.665212,0.120851,0.600834,-0.600834,0.120851,0.600834,-0.665212,0.0792329,0.27917,-0.600834,0.0792329,0.27917,-0.665212,0.120851,0.27917,-0.600834,0.120851,0.27917,-0.27917,0.0792329,0.66495,-0.27917,0.0792329,0.600834,-0.27917,0.120851,0.66495,-0.27917,0.120851,0.600834,0.66495,0.0792328,0.600834,0.66495,0.0792328,0.665212,0.600834,0.0792328,0.665213,0.600834,0.0792328,0.600834,0.66495,0.120851,0.600834,0.66495,0.120851,0.665212,0.600834,0.120851,0.665213,0.600834,0.120851,0.600834,0.27917,0.0792328,0.665213,0.27917,0.0792328,0.600834,0.27917,0.120851,0.665213,0.27917,0.120851,0.600834,0.66495,0.0792328,0.279171,0.600834,0.0792328,0.279171,0.66495,0.120851,0.279171,0.600834,0.120851,0.279171,0.600834,0.0792328,-0.66495,0.665212,0.0792328,-0.66495,0.665212,0.0792328,-0.600834,0.600834,0.0792328,-0.600834,0.600834,0.120851,-0.66495,0.665212,0.120851,-0.66495,0.665212,0.120851,-0.600834,0.600834,0.120851,-0.600834,0.665212,0.0792328,-0.27917,0.600834,0.0792328,-0.27917,0.665212,0.120851,-0.27917,0.600834,0.120851,-0.27917,0.27917,0.0792328,-0.66495,0.27917,0.0792328,-0.600834,0.27917,0.120851,-0.66495,0.27917,0.120851,-0.600834,-0.66495,0.0792328,-0.600834,-0.66495,0.0792328,-0.665212,-0.600834,0.0792328,-0.665212,-0.600834,0.0792328,-0.600834,-0.66495,0.120851,-0.600834,-0.66495,0.120851,-0.665212,-0.600834,0.120851,-0.665212,-0.600834,0.120851,-0.600834,-0.27917,0.0792328,-0.665212,-0.27917,0.0792328,-0.600834,-0.27917,0.120851,-0.665212,-0.27917,0.120851,-0.600834,-0.66495,0.0792328,-0.27917,-0.600834,0.0792328,-0.27917,-0.66495,0.120851,-0.27917,-0.600834,0.120851,-0.27917,-0.850384,-0.101447,0.850384,-0.850384,-0.101447,-0.850384,0.850384,-0.101447,-0.850384,0.850384,-0.101447,0.850384,-0.850384,-0.0489159,0.850384,-0.850384,-0.048916,-0.850384,0.850384,-0.048916,-0.850384,0.850384,-0.0489159,0.850384],
|
||||
|
||||
"morphTargets" : [],
|
||||
|
||||
"normals" : [-0.577349,-0.577349,0.577349,0,-0.707083,0.707083,0,0.707083,0.707083,-0.577349,0.577349,0.577349,-0.707083,0.707083,0,-0.707083,-0.707083,0,0.301492,0.904508,-0.301492,0.301492,-0.904508,-0.301492,0.577349,-0.577349,-0.577349,0.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,-0.577349,-0.577349,0.577349,0.577349,0.577349,0.577349,-0.577349,0.577349,0.707083,0.707083,0,0.707083,-0.707083,0,-0.301492,0.904508,-0.301492,-0.301492,-0.904508,-0.301492,0,0.707083,-0.707083,0,-0.707083,-0.707083,-0.301492,0.904508,0.301492,-0.301492,-0.904508,0.301492,0.301492,0.904508,0.301492,0.301492,-0.904508,0.301492],
|
||||
|
||||
"colors" : [],
|
||||
|
||||
"uvs" : [],
|
||||
|
||||
"faces" : [35,1,0,4,5,0,0,1,2,3,35,5,6,2,1,0,3,4,5,0,35,7,3,9,11,0,6,7,8,9,35,3,7,15,13,0,7,6,9,8,35,0,1,2,3,0,1,0,5,7,35,7,6,5,4,0,6,4,3,2,35,10,11,9,8,0,10,9,8,11,35,2,6,10,8,0,5,4,10,11,35,3,2,8,9,0,7,5,11,8,35,6,7,11,10,0,4,6,9,10,35,15,14,12,13,0,9,12,13,8,35,7,4,14,15,0,6,2,12,9,35,4,0,12,14,0,2,1,13,12,35,0,3,13,12,0,1,7,8,13,35,20,21,17,16,0,14,12,13,15,35,21,22,18,17,0,12,2,1,13,35,23,19,25,27,0,16,17,11,10,35,19,23,31,29,0,17,16,10,11,35,16,17,18,19,0,15,13,1,17,35,23,22,21,20,0,16,2,12,14,35,26,27,25,24,0,3,10,11,0,35,18,22,26,24,0,1,2,3,0,35,19,18,24,25,0,17,1,0,11,35,22,23,27,26,0,2,16,10,3,35,31,30,28,29,0,10,9,8,11,35,23,20,30,31,0,16,14,9,10,35,20,16,28,30,0,14,15,8,9,35,16,19,29,28,0,15,17,11,8,35,36,37,33,32,0,18,9,8,19,35,37,38,34,33,0,9,14,15,8,35,39,35,41,43,0,20,21,0,3,35,35,39,47,45,0,21,20,3,0,35,32,33,34,35,0,19,8,15,21,35,39,38,37,36,0,20,14,9,18,35,42,43,41,40,0,12,3,0,13,35,34,38,42,40,0,15,14,12,13,35,35,34,40,41,0,21,15,13,0,35,38,39,43,42,0,14,20,3,12,35,47,46,44,45,0,3,10,11,0,35,39,36,46,47,0,20,18,10,3,35,36,32,44,46,0,18,19,11,10,35,32,35,45,44,0,19,21,0,11,35,52,53,49,48,0,4,10,11,5,35,53,54,50,49,0,10,18,19,11,35,55,51,57,59,0,22,23,13,12,35,51,55,63,61,0,23,22,12,13,35,48,49,50,51,0,5,11,19,23,35,55,54,53,52,0,22,18,10,4,35,58,59,57,56,0,9,12,13,8,35,50,54,58,56,0,19,18,9,8,35,51,50,56,57,0,23,19,8,13,35,54,55,59,58,0,18,22,12,9,35,63,62,60,61,0,12,3,0,13,35,55,52,62,63,0,22,4,3,12,35,52,48,60,62,0,4,5,0,3,35,48,51,61,60,0,5,23,13,0,35,65,64,68,69,1,11,0,3,10,35,69,70,66,65,1,10,9,8,11,35,70,71,67,66,1,9,12,13,8,35,64,67,71,68,1,0,13,12,3,35,64,65,66,67,1,0,11,8,13,35,71,70,69,68,1,12,9,10,3],
|
||||
|
||||
"bones" : [],
|
||||
|
||||
"skinIndices" : [],
|
||||
|
||||
"skinWeights" : [],
|
||||
|
||||
"animation" : {}
|
||||
|
||||
|
||||
}
|
72
src/games/tafl/res/xd-view/meshes/taflboard.js
Normal file
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
|
||||
"metadata" :
|
||||
{
|
||||
"formatVersion" : 3.1,
|
||||
"generatedBy" : "Blender 2.66 Exporter",
|
||||
"vertices" : 20,
|
||||
"faces" : 18,
|
||||
"normals" : 0,
|
||||
"colors" : 0,
|
||||
"uvs" : [5],
|
||||
"materials" : 2,
|
||||
"morphTargets" : 0,
|
||||
"bones" : 0
|
||||
},
|
||||
|
||||
"scale" : 1.000000,
|
||||
|
||||
"materials" : [ {
|
||||
"DbgColor" : 15658734,
|
||||
"DbgIndex" : 0,
|
||||
"DbgName" : "boardsquare",
|
||||
"blending" : "NormalBlending",
|
||||
"colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
|
||||
"colorSpecular" : [0.5, 0.5, 0.5],
|
||||
"depthTest" : true,
|
||||
"depthWrite" : true,
|
||||
"shading" : "Lambert",
|
||||
"specularCoef" : 50,
|
||||
"opacity" : 1.0,
|
||||
"transparent" : false,
|
||||
"vertexColors" : false
|
||||
},
|
||||
|
||||
{
|
||||
"DbgColor" : 15597568,
|
||||
"DbgIndex" : 1,
|
||||
"DbgName" : "board",
|
||||
"blending" : "NormalBlending",
|
||||
"colorDiffuse" : [0.0, 0.0, 0.0],
|
||||
"colorSpecular" : [0.5, 0.5, 0.5],
|
||||
"depthTest" : true,
|
||||
"depthWrite" : true,
|
||||
"shading" : "Lambert",
|
||||
"specularCoef" : 50,
|
||||
"opacity" : 1.0,
|
||||
"transparent" : false,
|
||||
"vertexColors" : false
|
||||
}],
|
||||
|
||||
"vertices" : [-5,-0.487999,5,-5,-0.488,-5,5,-0.488,-5,5,-0.487999,5,-4.59559,0.00417968,4.59559,-4.59559,0.00417928,-4.59559,4.59559,0.00417928,-4.59559,4.59559,0.00417968,4.59559,-4.96935,0.0041797,4.96935,-5,-0.0332844,5,-5,-0.0332848,-5,-4.96935,0.00417926,-4.96935,5,-0.0332848,-5,4.96935,0.00417926,-4.96935,5,-0.0332844,5,4.96935,0.0041797,4.96935,-4.55176,-0.0818931,4.55176,-4.55176,-0.0818935,-4.55176,4.55176,-0.0818935,-4.55176,4.55176,-0.0818931,4.55176],
|
||||
|
||||
"morphTargets" : [],
|
||||
|
||||
"normals" : [],
|
||||
|
||||
"colors" : [],
|
||||
|
||||
"uvs" : [[0,0,0.9999,0.0001,0.9999,0.9999,0.0001,0.9999,0.0001,0.0001]],
|
||||
|
||||
"faces" : [11,0,3,14,9,1,0,0,0,0,11,13,11,5,6,1,0,0,0,0,11,15,13,6,7,1,0,0,0,0,11,8,15,7,4,1,0,0,0,0,11,0,1,2,3,1,0,0,0,0,11,11,8,4,5,1,0,0,0,0,11,6,5,17,18,1,0,0,0,0,11,10,12,2,1,1,0,0,0,0,11,12,14,3,2,1,0,0,0,0,11,8,11,10,9,1,0,0,0,0,11,11,13,12,10,1,0,0,0,0,11,13,15,14,12,1,0,0,0,0,11,15,8,9,14,1,0,0,0,0,11,1,0,9,10,1,0,0,0,0,11,19,18,17,16,0,1,2,3,4,11,7,6,18,19,1,0,0,0,0,11,4,7,19,16,1,0,0,0,0,11,5,4,16,17,1,0,0,0,0],
|
||||
|
||||
"bones" : [],
|
||||
|
||||
"skinIndices" : [],
|
||||
|
||||
"skinWeights" : [],
|
||||
|
||||
"animation" : {}
|
||||
|
||||
|
||||
}
|
BIN
src/games/tafl/res/xd-view/meshes/woodtoken-diffuse-black.jpg
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
src/games/tafl/res/xd-view/meshes/woodtoken-diffuse.jpg
Normal file
After Width: | Height: | Size: 62 KiB |
76
src/games/tafl/res/xd-view/meshes/woodtoken.js
Normal file
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
|
||||
"metadata" :
|
||||
{
|
||||
"formatVersion" : 3.1,
|
||||
"generatedBy" : "Blender 2.66 Exporter",
|
||||
"vertices" : 107,
|
||||
"faces" : 126,
|
||||
"normals" : 107,
|
||||
"colors" : 0,
|
||||
"uvs" : [53],
|
||||
"materials" : 1,
|
||||
"morphTargets" : 0,
|
||||
"bones" : 0
|
||||
},
|
||||
|
||||
"scale" : 1.000000,
|
||||
|
||||
"materials" : [ {
|
||||
"DbgColor" : 15658734,
|
||||
"DbgIndex" : 0,
|
||||
"DbgName" : "redstar",
|
||||
"blending" : "NormalBlending",
|
||||
"colorDiffuse" : [0.6400000190734865, 0.021817703870202654, 0.0],
|
||||
"colorSpecular" : [1.0, 1.0, 1.0],
|
||||
"depthTest" : true,
|
||||
"depthWrite" : true,
|
||||
"shading" : "Phong",
|
||||
"specularCoef" : 250,
|
||||
"opacity" : 1.0,
|
||||
"transparent" : false,
|
||||
"vertexColors" : false
|
||||
},
|
||||
|
||||
{
|
||||
"DbgColor" : 15597568,
|
||||
"DbgIndex" : 1,
|
||||
"DbgName" : "wood",
|
||||
"blending" : "NormalBlending",
|
||||
"colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
|
||||
"colorSpecular" : [0.8,0.8,0.8],
|
||||
"depthTest" : true,
|
||||
"depthWrite" : true,
|
||||
"mapDiffuse" : "woodtoken-diffuse.jpg",
|
||||
"mapBump" : "woodtoken-diffuse.jpg",
|
||||
"mapBumpScale" : 0.01,
|
||||
"mapBumpWrap" : ["repeat", "repeat"],
|
||||
"shading" : "Phong",
|
||||
"specularCoef" : 250,
|
||||
"opacity" : 1.0,
|
||||
"transparent" : false,
|
||||
"vertexColors" : false
|
||||
}],
|
||||
|
||||
"vertices" : [0,2.05368,-0.513647,0.169172,2.05368,-0.232846,0.488507,2.05368,-0.158726,0.273727,2.05368,0.0889391,0.301914,2.05368,0.415549,-1.7085e-08,2.05368,0.287813,-0.301914,2.05368,0.415549,-0.273727,2.05368,0.0889391,-0.488507,2.05368,-0.158726,-0.169172,2.05368,-0.232846,3.06157e-08,2.27649,-9.95085e-08,0.0974883,0.138942,-0.959619,3.72529e-09,0.0334215,-0.885785,-0.0974883,0.138942,-0.959619,-0.0974883,1.9279,-0.959619,1.11759e-08,2.03342,-0.885785,0.0974883,1.9279,-0.959619,0.747488,0.138942,-0.609618,0.626345,0.0334215,-0.626345,0.609618,0.138942,-0.747488,0.609618,1.9279,-0.747488,0.626345,2.03342,-0.626345,0.747488,1.9279,-0.609619,0.959619,0.138942,0.0974884,0.885785,0.0334215,3.95173e-08,0.959619,0.138942,-0.0974883,0.959619,1.9279,-0.0974884,0.885785,2.03342,-5.16308e-08,0.959619,1.9279,0.0974883,0.609618,0.138942,0.747488,0.626345,0.0334215,0.626345,0.747488,0.138942,0.609618,0.747488,1.9279,0.609618,0.626345,2.03342,0.626345,0.609618,1.9279,0.747488,-0.0974884,0.138942,0.959619,-6.33299e-08,0.0334216,0.885785,0.0974883,0.138942,0.959619,0.0974882,1.9279,0.959619,-7.07805e-08,2.03342,0.885785,-0.0974884,1.9279,0.959619,-0.747488,0.138942,0.609618,-0.626345,0.0334215,0.626345,-0.609619,0.138942,0.747488,-0.609619,1.9279,0.747488,-0.626345,2.03342,0.626345,-0.747488,1.9279,0.609618,-0.959619,0.138942,-0.0974884,-0.885785,0.0334215,-8.91148e-09,-0.959619,0.138942,0.0974883,-0.959619,1.9279,0.0974882,-0.885785,2.03342,-1.03785e-07,-0.959619,1.9279,-0.0974884,-0.609619,0.138942,-0.747488,-0.626345,0.0334215,-0.626345,-0.747488,0.138942,-0.609618,-0.747488,1.9279,-0.609618,-0.626345,2.03342,-0.626345,-0.609619,1.9279,-0.747488,-0.0974883,0.970741,-0.959619,0.0974883,0.970741,-0.959619,0.747488,0.970741,-0.609618,0.609618,0.970741,-0.747488,0.959619,0.970741,0.0974883,0.959619,0.970741,-0.0974883,0.609618,0.970741,0.747488,0.747488,0.970741,0.609618,-0.0974884,0.970741,0.959619,0.0974882,0.970741,0.959619,-0.747488,0.970741,0.609618,-0.609619,0.970741,0.747488,-0.959619,0.970741,-0.0974884,-0.959619,0.970741,0.0974883,-0.609619,0.970741,-0.747488,-0.747488,0.970741,-0.609618,-0.0886222,1.13188,-0.872346,0.554176,1.13188,-0.679507,0.872346,1.13188,-0.0886222,0.679507,1.13188,0.554176,0.0886221,1.13188,0.872346,-0.554176,1.13188,0.679507,-0.872346,1.13188,0.0886221,-0.679507,1.13188,-0.554176,0.0886222,1.13188,-0.872346,0.679507,1.13188,-0.554176,0.872346,1.13188,0.0886222,0.554176,1.13188,0.679507,-0.0886223,1.13188,0.872346,-0.679507,1.13188,0.554176,-0.872346,1.13188,-0.0886222,-0.554176,1.13188,-0.679507,-0.0974883,1.34015,-0.959619,0.609618,1.34015,-0.747488,0.959619,1.34015,-0.0974883,0.747488,1.34015,0.609618,0.0974882,1.34015,0.959619,-0.609619,1.34015,0.747488,-0.959619,1.34015,0.0974883,-0.747488,1.34015,-0.609618,0.0974883,1.34015,-0.959619,0.747488,1.34015,-0.609618,0.959619,1.34015,0.0974883,0.609618,1.34015,0.747488,-0.0974884,1.34015,0.959619,-0.747488,1.34015,0.609618,-0.959619,1.34015,-0.0974884,-0.609619,1.34015,-0.747488],
|
||||
|
||||
"morphTargets" : [],
|
||||
|
||||
"normals" : [0.92407,0.236396,0.300241,0.581805,-0.142216,0.800775,0,0.236396,0.971648,-0.581805,-0.142216,0.800775,-0.92407,0.236396,0.300241,-0.941374,-0.142216,-0.305856,0.941374,-0.142216,-0.305856,0.571123,0.236396,-0.786065,-0.571123,0.236396,-0.786065,0,-0.142216,-0.989807,0,1,0,-0.54677,-0.192694,-0.814783,-0.502396,0.346782,-0.792016,-0.20481,0.346782,-0.915281,-0.189489,-0.192694,-0.962767,0.962767,-0.192694,0.189489,0.915281,0.346782,0.20481,0.792016,0.346782,0.502365,0.814783,-0.192694,0.54677,0.54677,-0.192694,0.814783,0.502396,0.346782,0.792016,0.20481,0.346782,0.915281,0.189489,-0.192694,0.962767,-0.189489,-0.192694,0.962767,-0.20481,0.346782,0.915281,-0.502396,0.346782,0.792016,-0.54677,-0.192694,0.814783,-0.814783,-0.192694,0.54677,-0.792016,0.346782,0.502365,-0.915281,0.346782,0.20481,-0.962767,-0.192694,0.189489,-0.962767,-0.192694,-0.189489,-0.915281,0.346782,-0.20481,-0.792016,0.346782,-0.502396,-0.814783,-0.192694,-0.54677,0.814783,-0.192694,-0.54677,0.792016,0.346782,-0.502365,0.915281,0.346782,-0.20481,0.962767,-0.192694,-0.189489,0.338755,0.877743,-0.338755,0,0.877743,-0.47911,-0.338755,0.877743,-0.338755,0.47911,0.877743,0,-0.47911,0.877743,0,-0.338755,0.877743,0.338755,0.338755,0.877743,0.338755,0,0.877743,0.47911,0.189489,-0.192694,-0.962767,0.20481,0.346782,-0.915281,0.502396,0.346782,-0.792016,0.54677,-0.192694,-0.814783,0.20481,-0.346782,-0.915281,0,-0.877743,-0.47911,-0.20481,-0.346782,-0.915281,0.792016,-0.346782,-0.502396,0.338755,-0.877743,-0.338755,0.502365,-0.346782,-0.792016,0.915281,-0.346782,0.20481,0.47911,-0.877743,0,0.915281,-0.346782,-0.20481,0.502396,-0.346782,0.792016,0.338755,-0.877743,0.338755,0.792016,-0.346782,0.502365,-0.20481,-0.346782,0.915281,0,-0.877743,0.47911,0.20481,-0.346782,0.915281,-0.792016,-0.346782,0.502365,-0.338755,-0.877743,0.338755,-0.502396,-0.346782,0.792016,-0.915281,-0.346782,-0.20481,-0.47911,-0.877743,0,-0.915281,-0.346782,0.20481,-0.502396,-0.346782,-0.792016,-0.338755,-0.877743,-0.338755,-0.792016,-0.346782,-0.502396,0.806116,0.238868,-0.541368,0.541368,0.238868,-0.806116,0.952818,0.238868,0.18717,0.952818,0.238868,-0.18717,0.541368,0.238868,0.806116,0.806116,0.238868,0.541368,-0.18717,0.238868,0.952818,0.18717,0.238868,0.952818,-0.806116,0.238868,0.541368,-0.541368,0.238868,0.806116,-0.952818,0.238868,-0.18717,-0.952818,0.238868,0.18717,-0.541368,0.238868,-0.806116,-0.806116,0.238868,-0.541368,-0.18717,0.238868,-0.952818,0.18717,0.238868,-0.952818,0.833369,0.052614,-0.550188,0.550188,0.052614,-0.833369,0.978301,0.052614,0.200232,0.978301,0.052614,-0.200232,0.550188,0.052614,0.833369,0.833369,0.052614,0.550188,-0.200232,0.052614,0.978301,0.200232,0.052614,0.978301,-0.833369,0.052614,0.550188,-0.550188,0.052614,0.833369,-0.978301,0.052614,-0.200232,-0.978301,0.052614,0.200232,-0.550188,0.052614,-0.833369,-0.833369,0.052614,-0.550188,-0.200232,0.052614,-0.978301,0.200232,0.052614,-0.978301],
|
||||
|
||||
"colors" : [],
|
||||
|
||||
"uvs" : [[0.994763,0.390452,0.994763,0.556023,0.83883,0.556023,0.83883,0.390452,0.785343,0.390452,0.785343,0.556023,0.636176,0.556023,0.636176,0.390452,0.505175,0.881273,0.317519,0.957206,0.129059,0.875836,0.579458,0.692573,0.044909,0.6901,0.120793,0.502243,0.499185,0.503535,0.309479,0.424739,0.785343,0.040445,0.807664,0.002676,0.83883,0.040445,0.285694,0.994201,0.348477,0.995986,0.582401,0.040445,0.622215,0.002676,0.636176,0.040445,0.509373,0.92949,0.554357,0.885894,0.617322,0.723454,0.617844,0.660545,0.548175,0.498979,0.504136,0.453612,0.341067,0.387178,0.277993,0.385979,0.116493,0.453718,0.071425,0.497455,0.007281,0.659527,0.00729,0.72227,0.080098,0.880998,0.124099,0.925813,0.582401,0.274087,0.636176,0.274087,0.994763,0.040445,0.994763,0.002676,0.785343,0.274087,0.83883,0.274087,0,0,0.994763,0.274087,0.582401,0.326253,0.636176,0.326253,0.785343,0.326253,0.83883,0.326253,0.994763,0.326253,0.582401,0.390452,0.582401,0.556023]],
|
||||
|
||||
"faces" : [34,3,4,5,0,0,1,2,34,5,6,7,0,2,3,4,34,3,5,7,0,0,2,4,34,3,7,8,0,0,4,5,34,2,3,8,0,6,0,5,34,1,2,8,0,7,6,5,34,1,8,9,0,7,5,8,34,0,1,9,0,9,7,8,34,0,10,1,0,9,10,7,34,1,10,2,0,7,10,6,34,2,10,3,0,6,10,0,34,3,10,4,0,0,10,1,34,4,10,5,0,1,10,2,34,5,10,6,0,2,10,3,34,6,10,7,0,3,10,4,34,7,10,8,0,4,10,5,34,10,0,9,0,10,9,8,34,8,10,9,0,5,10,8,43,106,58,14,91,1,0,1,2,3,11,12,13,14,43,101,28,32,94,1,4,5,6,7,15,16,17,18,43,102,34,38,95,1,0,1,2,3,19,20,21,22,43,103,40,44,96,1,4,5,6,7,23,24,25,26,43,104,46,50,97,1,0,1,2,3,27,28,29,30,43,105,52,56,98,1,4,5,6,7,31,32,33,34,43,100,22,26,93,1,0,1,2,3,35,36,37,38,42,21,15,57,1,8,9,10,39,40,41,42,21,57,27,1,8,10,11,39,41,42,42,57,51,27,1,10,12,11,41,43,42,42,51,45,27,1,12,13,11,43,44,42,42,45,33,27,1,13,14,11,44,45,42,42,45,39,33,1,13,15,14,44,46,45,43,99,16,20,92,1,4,5,6,7,47,48,49,50,42,11,12,13,1,16,17,18,51,52,53,42,14,15,16,1,19,9,20,13,40,48,42,17,18,19,1,21,22,23,54,55,56,42,20,21,22,1,24,8,25,49,39,36,42,23,24,25,1,16,17,18,57,58,59,42,26,27,28,1,26,11,27,37,42,16,42,29,30,31,1,21,22,23,60,61,62,42,32,33,34,1,28,14,29,17,45,20,42,35,36,37,1,16,17,18,63,64,65,42,38,39,40,1,30,15,31,21,46,24,42,41,42,43,1,21,22,23,66,67,68,42,44,45,46,1,32,13,33,25,44,28,42,47,48,49,1,16,17,18,69,70,71,42,50,51,52,1,34,12,35,29,43,32,42,53,54,55,1,21,22,23,72,73,74,42,56,57,58,1,36,10,37,33,41,12,43,11,19,18,12,1,16,23,22,17,51,56,55,52,43,20,16,15,21,1,24,20,9,8,49,48,40,39,43,91,14,16,99,1,3,2,5,4,14,13,48,47,43,61,17,19,62,1,38,21,23,39,75,54,56,76,43,17,25,24,18,1,40,18,17,41,54,59,58,55,43,26,22,21,27,1,26,25,8,11,37,36,39,42,43,63,23,25,64,1,42,16,18,43,77,57,59,78,43,23,31,30,24,1,16,23,22,17,57,62,61,58,43,32,28,27,33,1,28,27,11,14,17,16,42,45,43,65,29,31,66,1,38,21,23,39,79,60,62,80,43,29,37,36,30,1,40,18,17,41,60,65,64,61,43,38,34,33,39,1,30,29,14,15,21,20,45,46,43,67,35,37,68,1,42,16,18,43,81,63,65,82,43,35,43,42,36,1,16,23,22,17,63,68,67,64,43,44,40,39,45,1,32,31,15,13,25,24,46,44,43,69,41,43,70,1,38,21,23,39,83,66,68,84,43,41,49,48,42,1,40,18,17,41,66,71,70,67,43,50,46,45,51,1,34,33,13,12,29,28,44,43,43,71,47,49,72,1,42,16,18,43,85,69,71,86,43,47,55,54,48,1,16,23,22,17,69,74,73,70,43,56,52,51,57,1,36,35,12,10,33,32,43,41,43,73,53,55,74,1,38,21,23,39,87,72,74,88,43,53,13,12,54,1,40,18,17,41,72,53,52,73,43,14,58,57,15,1,19,37,10,9,13,12,41,40,42,30,36,42,1,44,44,44,61,64,67,42,24,30,42,1,44,44,44,58,61,67,42,24,42,48,1,44,44,44,58,67,70,42,18,24,48,1,44,44,44,55,58,70,42,18,48,54,1,44,44,44,55,70,73,42,12,18,54,1,44,44,44,52,55,73,43,53,73,59,13,1,40,45,43,18,72,87,89,53,43,23,63,66,31,1,16,42,39,23,57,77,80,62,43,29,65,68,37,1,40,45,43,18,60,79,82,65,43,35,67,70,43,1,16,42,39,23,63,81,84,68,43,41,69,72,49,1,40,45,43,18,66,83,86,71,43,47,71,74,55,1,16,42,39,23,69,85,88,74,43,17,61,64,25,1,40,45,43,18,54,75,78,59,43,11,60,62,19,1,16,42,39,23,51,90,76,56,43,60,11,13,59,1,42,16,18,43,90,51,53,89,43,84,61,62,76,1,46,38,39,47,91,75,76,92,43,85,63,64,77,1,48,42,43,49,93,77,78,94,43,86,65,66,78,1,46,38,39,47,95,79,80,96,43,87,67,68,79,1,48,42,43,49,97,81,82,98,43,88,69,70,80,1,46,38,39,47,99,83,84,100,43,89,71,72,81,1,48,42,43,49,101,85,86,102,43,90,73,74,82,1,46,38,39,47,103,87,88,104,43,73,90,75,59,1,45,50,49,43,87,103,105,89,43,63,85,78,66,1,42,48,47,39,77,93,96,80,43,65,86,79,68,1,45,50,49,43,79,95,98,82,43,67,87,80,70,1,42,48,47,39,81,97,100,84,43,69,88,81,72,1,45,50,49,43,83,99,102,86,43,71,89,82,74,1,42,48,47,39,85,101,104,88,43,61,84,77,64,1,45,50,49,43,75,91,94,78,43,60,83,76,62,1,42,48,47,39,90,106,92,76,43,59,75,83,60,1,43,49,48,42,89,105,106,90,43,100,84,76,92,1,51,46,47,7,35,91,92,50,43,101,85,77,93,1,4,48,49,3,15,93,94,38,43,102,86,78,94,1,51,46,47,7,19,95,96,18,43,103,87,79,95,1,4,48,49,3,23,97,98,22,43,104,88,80,96,1,51,46,47,7,27,99,100,26,43,105,89,81,97,1,4,48,49,3,31,101,102,30,43,106,90,82,98,1,51,46,47,7,11,103,104,34,43,90,106,91,75,1,50,0,3,49,103,11,14,105,43,85,101,94,78,1,48,4,7,47,93,15,18,96,43,86,102,95,79,1,50,0,3,49,95,19,22,98,43,87,103,96,80,1,48,4,7,47,97,23,26,100,43,88,104,97,81,1,50,0,3,49,99,27,30,102,43,89,105,98,82,1,48,4,7,47,101,31,34,104,43,84,100,93,77,1,50,0,3,49,91,35,38,94,43,83,99,92,76,1,48,4,7,47,106,47,50,92,43,75,91,99,83,1,49,3,4,48,105,14,47,106,43,22,100,92,20,1,52,51,7,6,36,35,50,49,43,28,101,93,26,1,5,4,3,2,16,15,38,37,43,34,102,94,32,1,52,51,7,6,20,19,18,17,43,40,103,95,38,1,5,4,3,2,24,23,22,21,43,46,104,96,44,1,52,51,7,6,28,27,26,25,43,52,105,97,50,1,5,4,3,2,32,31,30,29,43,58,106,98,56,1,52,51,7,6,12,11,34,33],
|
||||
|
||||
"bones" : [],
|
||||
|
||||
"skinIndices" : [],
|
||||
|
||||
"skinWeights" : [],
|
||||
|
||||
"animation" : {}
|
||||
|
||||
|
||||
}
|
32
src/games/tafl/rules-alea-evangelii-fr.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">Pour gagner</p>
|
||||
<p>Si le Roi atteint un des bords du plateau, les blancs gagnent.</p>
|
||||
<p>Si le Roi est capturé, les noirs gagnent.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">Pour jouer</p>
|
||||
<p>Bouger un pion horizontalement ou verticalement sur une case libre.</p>
|
||||
<p>Si une pièce est encadrée par 2 pièces de l'adversaire (dessus+dessous ou droite+gauche), elle est retirée du jeu.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>Si le Roi est entouré de 4 noirs, il est capturé.</p>
|
||||
<p>Si vous êtes encadrés suite à votre déplacement, vous n'êtes pas capturé.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- Il y a une "case du Roi", où "trône", au centre du plateau. Seul le Roi peut se positionner sur le trône.</p>
|
||||
<p>2- Le trône est considéré comme une piece d'encerclement pour tout le monde.</p>
|
||||
<p>3- La partie est déclarée nulle si la même séquence de jeu est jouée 3 fois de suite.</p>
|
||||
<p class='rules-h2'>Positions de démarrage</p>
|
||||
<p>Vue 3D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/alea-evangelii.jpg" class="imgfit"></p>
|
||||
<p>Vue2D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/alea-evangelii.jpg" class="imgfit"></p>
|
||||
|
31
src/games/tafl/rules-alea-evangelii.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">To win</p>
|
||||
<p>If the King reaches any board edge, the whites win.</p>
|
||||
<p>If the King is captured, the blacks win.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">To play</p>
|
||||
<p>Move one piece in a horizontal or vertical direction to an available square.</p>
|
||||
<p>If a piece is bracketed by 2 opponent's pieces (top+bottom or left+right), it is removed.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>If the King is surrounded by 4 blacks, it is captured.</p>
|
||||
<p>If you are surrounded or bracketed as a result of your move, you are not taken.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- There is a "King's square" in the middle of the board. Only the king can land on it.</p>
|
||||
<p>2- The "King's square" is considered as a surrounding piece by everyone.</p>
|
||||
<p>3- A draw occurs if the same sequence is played three times.</p>
|
||||
<p class='rules-h2'>Start positions</p>
|
||||
<p>3D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/alea-evangelii.jpg" class="imgfit"></p>
|
||||
<p>2D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/alea-evangelii.jpg" class="imgfit"></p>
|
31
src/games/tafl/rules-tafl-ardri-fr.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">Pour gagner</p>
|
||||
<p>Si le Roi atteint un des bords du plateau, les blancs gagnent.</p>
|
||||
<p>Si le Roi est capturé, les noirs gagnent.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">Pour jouer</p>
|
||||
<p>Bouger un pion horizontalement ou verticalement sur une case libre. Les déplacements sont limités à une case.</p>
|
||||
<p>Si une pièce est encadrée par 2 pièces de l'adversaire (dessus+dessous ou droite+gauche), elle est retirée du jeu.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>Si le Roi est entouré de 4 noirs, il est capturé.</p>
|
||||
<p>Si vous êtes encadrés suite à votre déplacement, vous n'êtes pas capturé.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- Il y a une "case du Roi", où "trône", au centre du plateau. Seul le Roi peut se positionner sur le trône.</p>
|
||||
<p>2- Le trône est considéré comme une piece d'encerclement pour tout le monde.</p>
|
||||
<p>3- La partie est déclarée nulle si la même séquence de jeu est jouée 3 fois de suite.</p>
|
||||
<p class='rules-h2'>Positions de démarrage</p>
|
||||
<p>Vue 3D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/tafl-ardri.jpg" class="imgfit"></p>
|
||||
<p>Vue2D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/tafl-ardri.jpg" class="imgfit"></p>
|
31
src/games/tafl/rules-tafl-ardri.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">To win</p>
|
||||
<p>If the King reaches any board edge, the whites win.</p>
|
||||
<p>If the King is captured, the blacks win.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">To play</p>
|
||||
<p>Move one piece in a horizontal or vertical direction to an available square. Moves are limited to one square.</p>
|
||||
<p>If a piece is bracketed by 2 opponent's pieces (top+bottom or left+right), it is removed.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>If the King is surrounded by 4 blacks, it is captured.</p>
|
||||
<p>If you are surrounded or bracketed as a result of your move, you are not taken.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- There is a "King's square" in the middle of the board. Only the king can land on it.</p>
|
||||
<p>2- The "King's square" is considered as a surrounding piece by everyone.</p>
|
||||
<p>3- A draw occurs if the same sequence is played three times.</p>
|
||||
<p class='rules-h2'>Start positions</p>
|
||||
<p>3D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/tafl-ardri.jpg" class="imgfit"></p>
|
||||
<p>2D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/tafl-ardri.jpg" class="imgfit"></p>
|
31
src/games/tafl/rules-tafl-brandubh-fr.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">Pour gagner</p>
|
||||
<p>Si le Roi atteint un des bords du plateau, les blancs gagnent.</p>
|
||||
<p>Si le Roi est capturé, les noirs gagnent.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">Pour jouer</p>
|
||||
<p>Bouger un pion horizontalement ou verticalement sur une case libre. Les déplacements sont limités à une case.</p>
|
||||
<p>Si une pièce est encadrée par 2 pièces de l'adversaire (dessus+dessous ou droite+gauche), elle est retirée du jeu.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>Si le Roi est entouré de 4 noirs, il est capturé.</p>
|
||||
<p>Si vous êtes encadrés suite à votre déplacement, vous n'êtes pas capturé.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- Il y a une "case du Roi", où "trône", au centre du plateau. Seul le Roi peut se positionner sur le trône.</p>
|
||||
<p>2- Le trône est considéré comme une piece d'encerclement pour tout le monde.</p>
|
||||
<p>3- La partie est déclarée nulle si la même séquence de jeu est jouée 3 fois de suite.</p>
|
||||
<p class='rules-h2'>Positions de démarrage</p>
|
||||
<p>Vue 3D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/tafl-brandubh.jpg" class="imgfit"></p>
|
||||
<p>Vue2D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/tafl-brandubh.jpg" class="imgfit"></p>brandubh
|
31
src/games/tafl/rules-tafl-brandubh.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">To win</p>
|
||||
<p>If the King reaches any board edge, the whites win.</p>
|
||||
<p>If the King is captured, the blacks win.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">To play</p>
|
||||
<p>Move one piece in a horizontal or vertical direction to an available square. Moves are limited to one square.</p>
|
||||
<p>If a piece is bracketed by 2 opponent's pieces (top+bottom or left+right), it is removed.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>If the King is surrounded by 4 blacks, it is captured.</p>
|
||||
<p>If you are surrounded or bracketed as a result of your move, you are not taken.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- There is a "King's square" in the middle of the board. Only the king can land on it.</p>
|
||||
<p>2- The "King's square" is considered as a surrounding piece by everyone.</p>
|
||||
<p>3- A draw occurs if the same sequence is played three times.</p>
|
||||
<p class='rules-h2'>Start positions</p>
|
||||
<p>3D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/tafl-brandubh.jpg" class="imgfit"></p>
|
||||
<p>2D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/tafl-brandubh.jpg" class="imgfit"></p>
|
31
src/games/tafl/rules-tafl-hnefatafl-fr.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">Pour gagner</p>
|
||||
<p>Si le Roi atteint un des bords du plateau, les blancs gagnent.</p>
|
||||
<p>Si le Roi est capturé, les noirs gagnent.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">Pour jouer</p>
|
||||
<p>Bouger un pion horizontalement ou verticalement sur une case libre.</p>
|
||||
<p>Si une pièce est encadrée par 2 pièces de l'adversaire (dessus+dessous ou droite+gauche), elle est retirée du jeu.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>Si le Roi est entouré de 4 noirs, il est capturé.</p>
|
||||
<p>Si vous êtes encadrés suite à votre déplacement, vous n'êtes pas capturé.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- Il y a une "case du Roi", où "trône", au centre du plateau. Seul le Roi peut se positionner sur le trône.</p>
|
||||
<p>2- Le trône est considéré comme une piece d'encerclement pour tout le monde.</p>
|
||||
<p>3- La partie est déclarée nulle si la même séquence de jeu est jouée 3 fois de suite.</p>
|
||||
<p class='rules-h2'>Positions de démarrage</p>
|
||||
<p>Vue 3D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/tafl-hnefatafl.jpg" class="imgfit"></p>
|
||||
<p>Vue2D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/tafl-hnefatafl.jpg" class="imgfit"></p>brandubh
|
31
src/games/tafl/rules-tafl-hnefatafl.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">To win</p>
|
||||
<p>If the King reaches any board edge, the whites win.</p>
|
||||
<p>If the King is captured, the blacks win.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">To play</p>
|
||||
<p>Move one piece in a horizontal or vertical direction to an available square.</p>
|
||||
<p>If a piece is bracketed by 2 opponent's pieces (top+bottom or left+right), it is removed.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>If the King is surrounded by 4 blacks, it is captured.</p>
|
||||
<p>If you are surrounded or bracketed as a result of your move, you are not taken.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- There is a "King's square" in the middle of the board. Only the king can land on it.</p>
|
||||
<p>2- The "King's square" is considered as a surrounding piece by everyone.</p>
|
||||
<p>3- A draw occurs if the same sequence is played three times.</p>
|
||||
<p class='rules-h2'>Start positions</p>
|
||||
<p>3D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/tafl-hnefatafl.jpg" class="imgfit"></p>
|
||||
<p>2D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/tafl-hnefatafl.jpg" class="imgfit"></p>
|
32
src/games/tafl/rules-tafl-tablut-fr.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">Pour gagner</p>
|
||||
<p>Si le Roi atteint un des bords du plateau, les blancs gagnent.</p>
|
||||
<p>Si le Roi est capturé, les noirs gagnent.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">Pour jouer</p>
|
||||
<p>Bouger un pion horizontalement ou verticalement sur une case libre.</p>
|
||||
<p>Si une pièce est encadrée par 2 pièces de l'adversaire (dessus+dessous ou droite+gauche), elle est retirée du jeu.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>Si le Roi est entouré de 4 noirs, il est capturé.</p>
|
||||
<p>Si vous êtes encadrés suite à votre déplacement, vous n'êtes pas capturé.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- Il y a une "case du Roi", où "trône", au centre du plateau. Seul le Roi peut se positionner sur le trône.</p>
|
||||
<p>2- Le trône est considéré comme une piece d'encerclement pour tout le monde.</p>
|
||||
<p>3- La partie est déclarée nulle si la même séquence de jeu est jouée 3 fois de suite.</p>
|
||||
<p class='rules-h2'>Positions de démarrage</p>
|
||||
<p>Vue 3D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/tafl-tablut.jpg" class="imgfit"></p>
|
||||
<p>Vue2D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/tafl-tablut.jpg" class="imgfit"></p>
|
||||
|
31
src/games/tafl/rules-tafl-tablut.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">To win</p>
|
||||
<p>If the King reaches any board edge, the whites win.</p>
|
||||
<p>If the King is captured, the blacks win.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">To play</p>
|
||||
<p>Move one piece in a horizontal or vertical direction to an available square.</p>
|
||||
<p>If a piece is bracketed by 2 opponent's pieces (top+bottom or left+right), it is removed.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>If the King is surrounded by 4 blacks, it is captured.</p>
|
||||
<p>If you are surrounded or bracketed as a result of your move, you are not taken.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- There is a "King's square" in the middle of the board. Only the king can land on it.</p>
|
||||
<p>2- The "King's square" is considered as a surrounding piece by everyone.</p>
|
||||
<p>3- A draw occurs if the same sequence is played three times.</p>
|
||||
<p class='rules-h2'>Start positions</p>
|
||||
<p>3D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/tafl-tablut.jpg" class="imgfit"></p>
|
||||
<p>2D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/tafl-tablut.jpg" class="imgfit"></p>
|
32
src/games/tafl/rules-tawlbwrdd-fr.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">Pour gagner</p>
|
||||
<p>Si le Roi atteint un des bords du plateau, les blancs gagnent.</p>
|
||||
<p>Si le Roi est capturé, les noirs gagnent.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">Pour jouer</p>
|
||||
<p>Bouger un pion horizontalement ou verticalement sur une case libre.</p>
|
||||
<p>Si une pièce est encadrée par 2 pièces de l'adversaire (dessus+dessous ou droite+gauche), elle est retirée du jeu.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>Si le Roi est entouré de 4 noirs, il est capturé.</p>
|
||||
<p>Si vous êtes encadrés suite à votre déplacement, vous n'êtes pas capturé.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- Il y a une "case du Roi", où "trône", au centre du plateau. Seul le Roi peut se positionner sur le trône.</p>
|
||||
<p>2- Le trône est considéré comme une piece d'encerclement pour tout le monde.</p>
|
||||
<p>3- La partie est déclarée nulle si la même séquence de jeu est jouée 3 fois de suite.</p>
|
||||
<p class='rules-h2'>Positions de démarrage</p>
|
||||
<p>Vue 3D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/tawlbwrdd.jpg" class="imgfit"></p>
|
||||
<p>Vue2D</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/tawlbwrdd.jpg" class="imgfit"></p>
|
||||
|
31
src/games/tafl/rules-tawlbwrdd.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<style>
|
||||
.rules-h2{
|
||||
font-size:2em;
|
||||
}
|
||||
img.imgfit {
|
||||
width: auto !important;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-win.png" class="rules-but">To win</p>
|
||||
<p>If the King reaches any board edge, the whites win.</p>
|
||||
<p>If the King is captured, the blacks win.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-play.png" class="rules-but">To play</p>
|
||||
<p>Move one piece in a horizontal or vertical direction to an available square.</p>
|
||||
<p>If a piece is bracketed by 2 opponent's pieces (top+bottom or left+right), it is removed.</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/capture2.gif" class="rules-but"></p>
|
||||
<p>If the King is surrounded by 4 blacks, it is captured.</p>
|
||||
<p>If you are surrounded or bracketed as a result of your move, you are not taken.</p>
|
||||
<p class='rules-h2'><img src="{GAME}/res/rules/rulesbuttons-exc.png" class="rules-but">Exceptions</p>
|
||||
<p>1- There is a "King's square" in the middle of the board. Only the king can land on it.</p>
|
||||
<p>2- The "King's square" is considered as a surrounding piece by everyone.</p>
|
||||
<p>3- A draw occurs if the same sequence is played three times.</p>
|
||||
<p class='rules-h2'>Start positions</p>
|
||||
<p>3D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/3d/tawlbwrdd.jpg" class="imgfit"></p>
|
||||
<p>2D view</p>
|
||||
<p align="center"><img src="{GAME}/res/rules/2d/tawlbwrdd.jpg" class="imgfit"></p>
|
386
src/games/tafl/tafl-model.js
Normal file
|
@ -0,0 +1,386 @@
|
|||
/*
|
||||
* Copyright (c) 2013 - Jocly - www.jocly.com - All rights reserved
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var SIZE; // the actual board size
|
||||
|
||||
// pos to [column,row]
|
||||
function Cr(pos) {
|
||||
var c=pos%SIZE;
|
||||
return [c,(pos-c)/SIZE];
|
||||
}
|
||||
|
||||
// column, row to pos
|
||||
function Pos(c,r) {
|
||||
return r*SIZE+c;
|
||||
}
|
||||
|
||||
function DistBorder(pos) {
|
||||
var cr=Cr(pos);
|
||||
return Math.min(cr[0],cr[1],SIZE-cr[0]-1,SIZE-cr[1]-1);
|
||||
}
|
||||
|
||||
Model.Game.InitGame = function() {
|
||||
var $this=this;
|
||||
SIZE=this.mOptions.centerDistance*2+1;
|
||||
var directions=[[0,-1],[1,0],[0,1],[-1,0]]; // dx, dy
|
||||
this.g.attackersCount=this.mOptions.initial.attackers.length;
|
||||
this.g.defendersCount=this.mOptions.initial.defenders.soldiers.length;
|
||||
|
||||
this.g.excludeMap={};
|
||||
this.mOptions.exclude.forEach(function(pos) {
|
||||
$this.g.excludeMap[pos]=true;
|
||||
});
|
||||
|
||||
this.g.home=this.mOptions.initial.defenders.king;
|
||||
|
||||
this.g.Graph=[];
|
||||
this.g.borders={};
|
||||
|
||||
for(var pos=0;pos<SIZE*SIZE;pos++) {
|
||||
var graph=[];
|
||||
var cr=Cr(pos);
|
||||
directions.forEach(function(dir) {
|
||||
var x=cr[0]+dir[0];
|
||||
if(x<0 || x>=SIZE) {
|
||||
graph.push(null);
|
||||
$this.g.borders[pos]=true;
|
||||
} else {
|
||||
var y=cr[1]+dir[1];
|
||||
if(y<0 || y>=SIZE) {
|
||||
graph.push(null);
|
||||
$this.g.borders[pos]=true;
|
||||
} else {
|
||||
var pos1=Pos(x,y);
|
||||
if($this.g.excludeMap[pos1])
|
||||
graph.push(null)
|
||||
else
|
||||
graph.push(pos1);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.g.Graph.push(graph);
|
||||
}
|
||||
|
||||
this.zobrist=new JocGame.Zobrist({
|
||||
board: {
|
||||
type: "array",
|
||||
size: SIZE*SIZE,
|
||||
values: ['s1','s-1','k1','k-1'],
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Model.Move.Init = function(args) {
|
||||
var $this=this;
|
||||
this.f=args.f;
|
||||
this.t=args.t;
|
||||
this.c=[];
|
||||
if(args.c)
|
||||
for(var ci=0;ci<args.c.length;ci++)
|
||||
$this.c.push(args.c[ci]);
|
||||
}
|
||||
|
||||
Model.Move.CopyFrom=function(move) {
|
||||
this.Init(move);
|
||||
}
|
||||
|
||||
Model.Move.ToString=function() {
|
||||
var str=this.f+">"+this.t;
|
||||
if(this.c.length>0)
|
||||
str+="x"+this.c.join(",");
|
||||
return str;
|
||||
}
|
||||
|
||||
Model.Board.Init = function(aGame) {
|
||||
this.zSign=0;
|
||||
}
|
||||
|
||||
Model.Board.InitialPosition = function(aGame) {
|
||||
var $this=this;
|
||||
this.board=[];
|
||||
this.pieces=[];
|
||||
for(var pos=0;pos<SIZE*SIZE;pos++)
|
||||
this.board.push(-1);
|
||||
function AddPiece(pos,side,type) {
|
||||
$this.zSign=aGame.zobrist.update($this.zSign,"board",type+side,pos);
|
||||
$this.board[pos]=$this.pieces.length;
|
||||
$this.pieces.push({
|
||||
i: $this.pieces.length,
|
||||
p: pos,
|
||||
s: side,
|
||||
t: type,
|
||||
});
|
||||
}
|
||||
var attackersSide=aGame.mOptions.attackers;
|
||||
AddPiece(aGame.mOptions.initial.defenders.king,-attackersSide,'k');
|
||||
var defenders=aGame.mOptions.initial.defenders.soldiers;
|
||||
this.defendersCount=0;
|
||||
for(var i=0;i<defenders.length;i++) {
|
||||
AddPiece(defenders[i],-attackersSide,'s');
|
||||
this.defendersCount++;
|
||||
}
|
||||
this.defendersCount=defenders.length;
|
||||
var attackers=aGame.mOptions.initial.attackers;
|
||||
this.attackersCount=0;
|
||||
for(var i=0;i<attackers.length;i++) {
|
||||
AddPiece(attackers[i],attackersSide,'s');
|
||||
var cr=Cr(attackers[i]);
|
||||
this.attackersCount++;
|
||||
}
|
||||
}
|
||||
|
||||
Model.Board.CopyFrom = function(aBoard) {
|
||||
var $this=this;
|
||||
this.board=[];
|
||||
var board0=aBoard.board;
|
||||
for(var pos=0;pos<board0.length;pos++)
|
||||
$this.board.push(board0[pos]);
|
||||
this.pieces=[];
|
||||
var pieces0=aBoard.pieces;
|
||||
for(var pi=0;pi<pieces0.length;pi++) {
|
||||
var piece=pieces0[pi];
|
||||
$this.pieces.push({
|
||||
i: piece.i,
|
||||
p: piece.p,
|
||||
s: piece.s,
|
||||
t: piece.t,
|
||||
});
|
||||
};
|
||||
this.defendersCount=aBoard.defendersCount;
|
||||
this.attackersCount=aBoard.attackersCount;
|
||||
this.mWho=aBoard.mWho;
|
||||
this.zSign=aBoard.zSign;
|
||||
}
|
||||
|
||||
Model.Board.GenerateMoves = function(aGame) {
|
||||
var $this=this;
|
||||
var moves=[];
|
||||
for(var pi=0;pi<this.pieces.length;pi++) {
|
||||
var piece=this.pieces[pi];
|
||||
if(piece.s!=$this.mWho || piece.p<0)
|
||||
continue;
|
||||
for(var dir=0;dir<4;dir++) {
|
||||
var pos=aGame.g.Graph[piece.p][dir];
|
||||
while(pos!=null) {
|
||||
var index1=$this.board[pos];
|
||||
if(index1<0 && (pos!=aGame.g.home || !aGame.mOptions.privateHome || piece.t=='k')) {
|
||||
var move={
|
||||
f: piece.p,
|
||||
t: pos,
|
||||
c: [],
|
||||
}
|
||||
for(var dir2=0;dir2<4;dir2++) {
|
||||
var pos2=aGame.g.Graph[pos][dir2];
|
||||
if(pos2!=null) {
|
||||
var index2=$this.board[pos2];
|
||||
if(index2>=0) {
|
||||
var piece2=$this.pieces[index2];
|
||||
if(piece2.s==-piece.s) {
|
||||
if(piece2.t=='k') {
|
||||
for(var dir3=0;dir3<4;dir3++) {
|
||||
var pos3=aGame.g.Graph[pos2][dir3];
|
||||
if(pos3==null)
|
||||
break;
|
||||
var index3=$this.board[pos3];
|
||||
if(index3<0) {
|
||||
if(pos3!=pos && (pos3!=aGame.g.home || !aGame.mOptions.homeCatch))
|
||||
break;
|
||||
} else {
|
||||
var piece3=$this.pieces[index3];
|
||||
if(piece3.s==piece2.s)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(dir3==4)
|
||||
move.c.push(pos2);
|
||||
} else { // piece2.t=='s'
|
||||
var pos3=aGame.g.Graph[pos2][dir2];
|
||||
if(pos3!=null) {
|
||||
var index3=$this.board[pos3];
|
||||
if(pos3==aGame.g.home && aGame.mOptions.homeCatch)
|
||||
move.c.push(pos2);
|
||||
else if(index3>=0) {
|
||||
var piece3=$this.pieces[index3];
|
||||
if(piece3.s==piece.s)
|
||||
move.c.push(pos2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
moves.push(move);
|
||||
} else
|
||||
break;
|
||||
if(!aGame.mOptions.longMove)
|
||||
break;
|
||||
pos=aGame.g.Graph[pos][dir];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.mMoves=moves;
|
||||
}
|
||||
|
||||
Model.Board.Evaluate = function(aGame) {
|
||||
var debug=arguments[3]=="debug";
|
||||
this.mEvaluation=0;
|
||||
if(this.pieces[0].p<0) {
|
||||
this.mFinished=true;
|
||||
this.mWinner=aGame.mOptions.attackers;
|
||||
return;
|
||||
}
|
||||
if(this.pieces[0].p in aGame.g.borders) {
|
||||
this.mFinished=true;
|
||||
this.mWinner=-aGame.mOptions.attackers;
|
||||
return;
|
||||
}
|
||||
if(aGame.GetRepeatOccurence(this)>2) {
|
||||
this.mFinished=true;
|
||||
this.mWinner=JocGame.DRAW;
|
||||
return;
|
||||
}
|
||||
|
||||
var posKing=this.pieces[0].p;
|
||||
var crKing=Cr(posKing);
|
||||
var distKing=0
|
||||
for(var i=aGame.mOptions.initial.attackers.length+1;i<this.pieces.length;i++) {
|
||||
var piece=this.pieces[i];
|
||||
if(piece.p>=0) {
|
||||
var cr=Cr(piece.p);
|
||||
var dist=Math.max(Math.abs(cr[0]-crKing[0]),Math.abs(cr[1]-crKing[1]));
|
||||
distKing+=dist;
|
||||
}
|
||||
}
|
||||
|
||||
// metric based on the pathes the king may take to reach borders
|
||||
// plus, empty squares area from king
|
||||
var pool={},poolDone={};
|
||||
pool[posKing]=1;
|
||||
var poolCount=1;
|
||||
var kingPath=0;
|
||||
var kingFreedom=0;
|
||||
while(poolCount>0) {
|
||||
var nextPool={};
|
||||
poolCount=0;
|
||||
for(var pos in pool) {
|
||||
var posValue=pool[pos];
|
||||
var deltaPosValue=posValue/4;
|
||||
var graph=aGame.g.Graph[pos];
|
||||
for(var dir=0;dir<4;dir++) {
|
||||
var pos1=graph[dir];
|
||||
while(pos1) {
|
||||
if(this.board[pos1]>=0)
|
||||
break;
|
||||
if(!(pos1 in poolDone) && !(pos1 in pool)) {
|
||||
if(pos1 in aGame.g.borders)
|
||||
kingPath+=posValue;
|
||||
else {
|
||||
if(!(pos1 in nextPool)) {
|
||||
kingFreedom++;
|
||||
poolCount++;
|
||||
nextPool[pos1]=deltaPosValue;
|
||||
} else
|
||||
nextPool[pos1]+=deltaPosValue;
|
||||
}
|
||||
}
|
||||
if(!aGame.mOptions.longMove)
|
||||
break;
|
||||
pos1=aGame.g.Graph[pos1][dir];
|
||||
}
|
||||
}
|
||||
poolDone[pos]=posValue;
|
||||
}
|
||||
pool=nextPool;
|
||||
}
|
||||
|
||||
var evalValues={
|
||||
"attackersCount": this.attackersCount,
|
||||
"defendersCount": this.defendersCount,
|
||||
"kingPath": kingPath,
|
||||
"kingFreedom": kingFreedom,
|
||||
"distKing": distKing,
|
||||
}
|
||||
|
||||
var evParams=aGame.mOptions.levelOptions;
|
||||
for(var name in evalValues) {
|
||||
var value=evalValues[name];
|
||||
var factor=evParams[name+'Factor'] || 0;
|
||||
var weighted=value*factor;
|
||||
if(debug)
|
||||
console.log(name,"=",value,"*",factor,"=>",weighted);
|
||||
this.mEvaluation+=weighted;
|
||||
}
|
||||
this.mEvaluation*=aGame.mOptions.attackers;
|
||||
if(debug)
|
||||
console.log("Evaluation",this.mEvaluation);
|
||||
}
|
||||
|
||||
Model.Board.ApplyMove = function(aGame,move) {
|
||||
//this.taflIntegrity(aGame);
|
||||
var $this=this;
|
||||
var index=this.board[move.f];
|
||||
var piece=this.pieces[index];
|
||||
this.zSign=aGame.zobrist.update(this.zSign,"board",piece.t+piece.s,move.f);
|
||||
this.zSign=aGame.zobrist.update(this.zSign,"board",piece.t+piece.s,move.t);
|
||||
this.board[move.f]=-1;
|
||||
this.board[move.t]=index;
|
||||
piece.p=move.t;
|
||||
if(this.mWho==aGame.mOptions.attackers) {
|
||||
var cr0=Cr(move.f);
|
||||
var cr=Cr(move.t);
|
||||
}
|
||||
var capts=move.c;
|
||||
for(var ci=0;ci<capts.length;ci++) {
|
||||
var pos1=capts[ci];
|
||||
var index1=$this.board[pos1];
|
||||
var piece1=$this.pieces[index1];
|
||||
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece1.t+piece1.s,pos1);
|
||||
$this.board[pos1]=-1;
|
||||
piece1.p=-1;
|
||||
if($this.mWho==-aGame.mOptions.attackers)
|
||||
$this.attackersCount--;
|
||||
else if(piece1.t=='s')
|
||||
$this.defendersCount--;
|
||||
}
|
||||
//this.taflIntegrity(aGame);
|
||||
}
|
||||
|
||||
Model.Board.taflIntegrity = function(aGame) {
|
||||
var $this=this;
|
||||
// debug: check integrity
|
||||
var aCount=0;
|
||||
var dCount=0;
|
||||
this.board.forEach(function(index,pos) {
|
||||
if(index>=0) {
|
||||
var piece=$this.pieces[index];
|
||||
if(piece.p!=pos)
|
||||
debugger;
|
||||
if(piece.t=='s')
|
||||
if(piece.s==aGame.mOptions.attackers)
|
||||
aCount++;
|
||||
else
|
||||
dCount++;
|
||||
}
|
||||
});
|
||||
if(aCount!=this.attackersCount)
|
||||
debugger;
|
||||
if(dCount!=this.defendersCount)
|
||||
debugger;
|
||||
this.pieces.forEach(function(piece,index) {
|
||||
if(piece.p>=0) {
|
||||
if($this.board[piece.p]!=index)
|
||||
debugger;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Model.Board.GetSignature = function() {
|
||||
return this.zSign;
|
||||
}
|
||||
|
||||
})();
|
||||
|
861
src/games/tafl/tafl-xd-view.js
Normal file
|
@ -0,0 +1,861 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2013 - Jocly - www.jocly.com
|
||||
*
|
||||
* This file is part of the Jocly game platform and cannot be used outside of this context without the written permission of Jocly.
|
||||
*
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var SIZE, CSIZE, fullPath;
|
||||
|
||||
var fieldZ=0;
|
||||
|
||||
|
||||
// pos to [column,row]
|
||||
function Cr(pos) {
|
||||
var c=pos%SIZE;
|
||||
return [c,(pos-c)/SIZE];
|
||||
}
|
||||
|
||||
// column, row to pos
|
||||
function Pos(c,r) {
|
||||
return r*SIZE+c;
|
||||
}
|
||||
|
||||
// get coordinates from either r,c or pos params
|
||||
function Coord() {
|
||||
if(arguments.length==2)
|
||||
return [(arguments[0]-SIZE/2+.5)*CSIZE,(arguments[1]-SIZE/2+.5)*CSIZE];
|
||||
else {
|
||||
var c=arguments[0]%SIZE;
|
||||
return Coord(c%SIZE,(arguments[0]-c)/SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
View.Game.xdInit = function(xdv) {
|
||||
var $this=this;
|
||||
SIZE=this.mOptions.centerDistance*2+1;
|
||||
CSIZE=Math.ceil(11500/(SIZE+1));
|
||||
fullPath=this.mViewOptions.fullPath;
|
||||
|
||||
var pieceScale=CSIZE/3000;
|
||||
var ringScale=CSIZE/1400;
|
||||
var boardScale=0.129*SIZE*CSIZE/1000;
|
||||
|
||||
|
||||
xdv.createGadget("extralights",{
|
||||
"3d": {
|
||||
type: "custommesh3d",
|
||||
create: function(callback){
|
||||
// spot lighting
|
||||
var spotLight1 = new THREE.SpotLight( 0xffffff, 0.5 );
|
||||
//spotLight1.shadowCameraVisible = true;
|
||||
spotLight1.shadow.camera.near = 10;
|
||||
spotLight1.shadow.camera.far = 25;
|
||||
spotLight1.castShadow = true;
|
||||
//spotLight1.shadowDarkness = .25;
|
||||
spotLight1.shadow.mapSize.width = 2048;
|
||||
spotLight1.shadow.mapSize.height = 2048;
|
||||
|
||||
spotLight1.position.set(-6, 8, -6);
|
||||
|
||||
var spotLight2 = new THREE.SpotLight( 0xffffff, 0.5 );
|
||||
//spotLight2.shadowCameraVisible = true;
|
||||
spotLight2.position.set(7, 7, 7);
|
||||
spotLight2.shadow.camera.near = 10;
|
||||
spotLight2.shadow.camera.far = 25;
|
||||
spotLight2.castShadow = true;
|
||||
//spotLight2.shadowDarkness = .15;
|
||||
spotLight2.shadow.mapSize.width = 2048;
|
||||
spotLight2.shadow.mapSize.height = 2048;
|
||||
|
||||
var mesh=new THREE.Mesh();
|
||||
mesh.add(spotLight1);
|
||||
mesh.add(spotLight2);
|
||||
var target = new THREE.Object3D();
|
||||
mesh.add(target);
|
||||
spotLight1.target = target;
|
||||
spotLight2.target = target;
|
||||
callback(mesh);
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function DrawBoard(avatar,boardCanvas,bNotations,callback) {
|
||||
var BOARDSZ = 1024; // texture painting bitmap width in pixels
|
||||
|
||||
var innerBOARDcx = 872;
|
||||
var innerBOARDcy = 872;
|
||||
var innerBOARDx = 76;
|
||||
var innerBOARDy = 76;
|
||||
var NBROWS = SIZE;
|
||||
var NBCOLS = SIZE;
|
||||
|
||||
var nbRes = 6;
|
||||
|
||||
var boardImage,cellImage,blackCell,kingCell,attackCell,defendCell;
|
||||
|
||||
|
||||
function drawIfReady() {
|
||||
nbRes--;
|
||||
if (nbRes == 0) {
|
||||
// do the job
|
||||
var ctx = boardCanvas.getContext('2d');
|
||||
// draw wood background
|
||||
ctx.drawImage(boardImage, 0, 0, BOARDSZ, BOARDSZ);
|
||||
|
||||
|
||||
// draw cells limits
|
||||
var cellCx = innerBOARDcx / NBCOLS;
|
||||
var cellCy = innerBOARDcy / NBROWS;
|
||||
var pos = 0;
|
||||
for (var row = 0; row < NBROWS; row++) {
|
||||
for (var col = 0; col < NBCOLS; col++) {
|
||||
if (bNotations && ($this.mOptions.exclude.indexOf(pos)<0)) {
|
||||
// top left small
|
||||
ctx.textAlign = 'left';
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.fillStyle = "#000000";
|
||||
ctx.font = Math.ceil(cellCx / 4) + 'px Monospace';
|
||||
ctx.fillText(pos, innerBOARDx + (col + .05) * cellCx, innerBOARDy + (row + .05) * cellCy);
|
||||
}
|
||||
oldBlendingMode = ctx.globalCompositeOperation;
|
||||
oldAlpha = ctx.globalAlpha ;
|
||||
if ($this.mOptions.initial.defenders.king==pos) {
|
||||
ctx.globalCompositeOperation = 'multiply';
|
||||
ctx.drawImage(kingCell, innerBOARDx + col * cellCx, innerBOARDy + row * cellCy, cellCx, cellCy);
|
||||
}
|
||||
if ($this.mOptions.exclude.indexOf(pos)>=0) {
|
||||
ctx.globalCompositeOperation = 'multiply';
|
||||
ctx.drawImage(blackCell, innerBOARDx + col * cellCx, innerBOARDy + row * cellCy, cellCx, cellCy);
|
||||
}
|
||||
if ($this.mOptions.initial.attackers.indexOf(pos)>=0) {
|
||||
ctx.globalCompositeOperation = 'multiply';
|
||||
ctx.globalAlpha = 0.8;
|
||||
ctx.drawImage(attackCell, innerBOARDx + col * cellCx, innerBOARDy + row * cellCy, cellCx, cellCy);
|
||||
}
|
||||
if ($this.mOptions.initial.defenders.soldiers.indexOf(pos)>=0) {
|
||||
ctx.globalCompositeOperation = 'multiply';
|
||||
ctx.globalAlpha = 0.5;
|
||||
ctx.drawImage(defendCell, innerBOARDx + col * cellCx, innerBOARDy + row * cellCy, cellCx, cellCy);
|
||||
}
|
||||
ctx.globalCompositeOperation = oldBlendingMode;
|
||||
ctx.globalAlpha = oldAlpha ;
|
||||
ctx.drawImage(cellImage, innerBOARDx + col * cellCx, innerBOARDy + row * cellCy, cellCx, cellCy);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
callback();
|
||||
}
|
||||
}
|
||||
avatar.getResource("image|"+fullPath+"/res/images/ardriboard_bgx1024.jpg",function(img){
|
||||
boardImage=img;
|
||||
drawIfReady();
|
||||
});
|
||||
avatar.getResource("image|"+fullPath+"/res/images/ardricellborders.png",function(img){
|
||||
cellImage=img;
|
||||
drawIfReady();
|
||||
});
|
||||
avatar.getResource("image|"+fullPath+"/res/images/ardriblackcell.png",function(img){
|
||||
blackCell=img;
|
||||
drawIfReady();
|
||||
});
|
||||
avatar.getResource("image|"+fullPath+"/res/images/ardrikingcell.png",function(img){
|
||||
kingCell=img;
|
||||
drawIfReady();
|
||||
});
|
||||
avatar.getResource("image|"+fullPath+"/res/images/blackcell.png",function(img){
|
||||
attackCell=img;
|
||||
drawIfReady();
|
||||
});
|
||||
avatar.getResource("image|"+fullPath+"/res/images/whitecell.png",function(img){
|
||||
defendCell=img;
|
||||
drawIfReady();
|
||||
});
|
||||
}
|
||||
|
||||
function create3DBoard(bNotations,callback){
|
||||
var smooth=0;
|
||||
var url="smoothedfilegeo|"+smooth+"|"+fullPath+"/res/xd-view/meshes/taflboard.js";
|
||||
var avat=this;
|
||||
this.getResource(url,function(geometry , materials){
|
||||
|
||||
RequestBoardCanvas(avat,bNotations,function(boardCanvas) {
|
||||
|
||||
DrawBoard(avat,boardCanvas,bNotations,function(){
|
||||
|
||||
var texBoard = new THREE.Texture(boardCanvas);
|
||||
// And tell Three.js that it needs to update the texture.
|
||||
texBoard.needsUpdate = true;
|
||||
|
||||
var materials0=[];
|
||||
for(var i=0;i<materials.length;i++){
|
||||
var mat=materials[i].clone();
|
||||
if (mat.name=="boardsquare"){
|
||||
mat=new THREE.MeshPhongMaterial({
|
||||
// light
|
||||
specular: '#050505',
|
||||
// intermediate
|
||||
//color: '#ff0000',
|
||||
// dark
|
||||
emissive: '#000000',
|
||||
shininess: 250,
|
||||
//transparent: true,
|
||||
map: texBoard,
|
||||
bumpMap: texBoard,
|
||||
bumpScale:0.01,
|
||||
name:"boardsquare",
|
||||
});
|
||||
}
|
||||
if (mat.name=="board"){
|
||||
mat=new THREE.MeshPhongMaterial({
|
||||
color: '#000000',
|
||||
shininess: 500,
|
||||
specular: '#888888',
|
||||
//ambient: '#000000',
|
||||
emissive: '#000000',
|
||||
name: "board",
|
||||
});
|
||||
}
|
||||
materials0.push(mat);
|
||||
}
|
||||
|
||||
|
||||
var board = new THREE.Mesh( geometry , new THREE.MultiMaterial(materials0));
|
||||
//board.overdraw = true;
|
||||
|
||||
callback(board);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var boardCanvas={
|
||||
'plain': null,
|
||||
'notation': null,
|
||||
}
|
||||
function RequestBoardCanvas(avatar,notation,callback) {
|
||||
var key=notation?'notation':'plain';
|
||||
if(boardCanvas[key])
|
||||
callback(boardCanvas[key]);
|
||||
else {
|
||||
var bc=document.createElement('canvas');
|
||||
boardCanvas[key]=bc;
|
||||
bc.width=1024;
|
||||
bc.height=1024;
|
||||
DrawBoard(avatar,bc,notation,function() {
|
||||
callback(bc);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var BOARDSIZE = SIZE*CSIZE*1.18;
|
||||
|
||||
xdv.createGadget("board",{
|
||||
base: {
|
||||
},
|
||||
"2d": {
|
||||
type: "canvas",
|
||||
width: BOARDSIZE,
|
||||
height: BOARDSIZE,
|
||||
draw: function(ctx) {
|
||||
ctx.save();
|
||||
RequestBoardCanvas(this,false,function(boardCanvas){
|
||||
ctx.drawImage(boardCanvas,-BOARDSIZE/2,-BOARDSIZE/2,BOARDSIZE,BOARDSIZE);
|
||||
ctx.restore();
|
||||
});
|
||||
},
|
||||
},
|
||||
"3d": {
|
||||
type: "custommesh3d",
|
||||
scale: [boardScale,boardScale,boardScale],
|
||||
z:150,
|
||||
receiveShadow:true,
|
||||
create: function(callback){
|
||||
create3DBoard.call(this,false,callback);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
xdv.createGadget("boardnotations",{
|
||||
base: {
|
||||
},
|
||||
"2d": {
|
||||
type: "canvas",
|
||||
width: SIZE*CSIZE*1.18,
|
||||
height: SIZE*CSIZE*1.18,
|
||||
draw: function(ctx,pixSize){
|
||||
ctx.save();
|
||||
RequestBoardCanvas(this,true,function(boardCanvas){
|
||||
ctx.drawImage(boardCanvas,-BOARDSIZE/2,-BOARDSIZE/2,BOARDSIZE,BOARDSIZE);
|
||||
ctx.restore();
|
||||
});
|
||||
},
|
||||
},
|
||||
"3d": {
|
||||
type: "custommesh3d",
|
||||
scale: [boardScale,boardScale,boardScale],
|
||||
z:150,
|
||||
receiveShadow:true,
|
||||
create: function(callback){
|
||||
create3DBoard.call(this,true,callback);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for(var pos=0;pos<SIZE*SIZE;pos++)
|
||||
(function(pos) {
|
||||
var coord=Coord(pos);
|
||||
var cellClass;
|
||||
if($this.g.excludeMap[pos])
|
||||
cellClass="cell-exclude";
|
||||
else if(pos%2)
|
||||
cellClass="cell-white";
|
||||
else
|
||||
cellClass="cell-black";
|
||||
if(pos==$this.g.home)
|
||||
cellClass+=" cell-home";
|
||||
xdv.createGadget("cell#"+pos,{
|
||||
base: {
|
||||
x: coord[0],
|
||||
y: coord[1],
|
||||
},
|
||||
"2d": {
|
||||
z: 1,
|
||||
type: "element",
|
||||
initialClasses: "cell",
|
||||
width: CSIZE*1.01,
|
||||
height: CSIZE*1.01,
|
||||
},
|
||||
});
|
||||
xdv.createGadget("clicker#"+pos,{
|
||||
base: {
|
||||
x: coord[0],
|
||||
y: coord[1],
|
||||
},
|
||||
"2d": {
|
||||
z: 3,
|
||||
type: "element",
|
||||
initialClasses: "clicker",
|
||||
width: CSIZE,
|
||||
height: CSIZE,
|
||||
},
|
||||
"3d": {
|
||||
z: fieldZ,
|
||||
type: "meshfile",
|
||||
file : fullPath+"/res/xd-view/meshes/ring-target.js",
|
||||
flatShading: true,
|
||||
castShadow: true,
|
||||
smooth : 0,
|
||||
scale:[ringScale,ringScale,ringScale],
|
||||
materials: {
|
||||
"square" : {
|
||||
transparent: true,
|
||||
opacity: 0,
|
||||
},
|
||||
"ring" : {
|
||||
color : 0xffffff,
|
||||
opacity: 1,
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
})(pos);
|
||||
|
||||
var PIECE_TEXT_SZ=512;
|
||||
function DrawPieceTexture(avatar,cnv,bWhite,callback){
|
||||
var url="image|"+fullPath+"/res/xd-view/meshes/woodtoken-diffuse"+(bWhite?".jpg":"-black.jpg");
|
||||
avatar.getResource(url,function(img){
|
||||
var ctx = cnv.getContext('2d');
|
||||
ctx.drawImage(img,0,0,PIECE_TEXT_SZ, PIECE_TEXT_SZ);
|
||||
callback();
|
||||
});
|
||||
}
|
||||
var pieceTextures={
|
||||
'white': null,
|
||||
'plain': null,
|
||||
}
|
||||
function RequestPieceTexture(avatar,bWhite,bKing,callback) {
|
||||
var key=bWhite?'white':'plain';
|
||||
if(Array.isArray(pieceTextures[key]))
|
||||
pieceTextures[key].push(callback);
|
||||
else if(pieceTextures[key]===null) {
|
||||
var bc=document.createElement('canvas');
|
||||
bc.width=PIECE_TEXT_SZ;
|
||||
bc.height=PIECE_TEXT_SZ;
|
||||
pieceTextures[key]=[callback];
|
||||
DrawPieceTexture(avatar,bc,bWhite,function() {
|
||||
var texPiece = new THREE.Texture(bc);
|
||||
texPiece.needsUpdate = true;
|
||||
while(pieceTextures[key].length>0)
|
||||
(pieceTextures[key].shift())(texPiece);
|
||||
pieceTextures[key] = texPiece;
|
||||
});
|
||||
} else
|
||||
callback(pieceTextures[key]);
|
||||
}
|
||||
|
||||
function create3DPiece(bWhite,bKing,callback){
|
||||
var smooth=0;
|
||||
var url="smoothedfilegeo|"+smooth+"|"+fullPath +"/res/xd-view/meshes/woodtoken.js";
|
||||
var avat=this;
|
||||
this.getResource(url,function(geometry , materials){
|
||||
|
||||
RequestPieceTexture(avat,bWhite,bKing,function(texPiece) {
|
||||
|
||||
var materials0=[];
|
||||
for(var i=0;i<materials.length;i++){
|
||||
var mat=materials[i].clone();
|
||||
if (mat.name=="wood"){
|
||||
mat=new THREE.MeshPhongMaterial({
|
||||
// light
|
||||
specular: '#222222',
|
||||
color: '#dddddd',
|
||||
shininess: 30,
|
||||
map: texPiece,
|
||||
bumpMap: texPiece,
|
||||
bumpScale:0.03,
|
||||
name:"wood",
|
||||
});
|
||||
}
|
||||
if (mat.name=="redstar"){
|
||||
mat=new THREE.MeshPhongMaterial({
|
||||
color: '#aa0000',
|
||||
shininess: 150,
|
||||
specular: '#666666',
|
||||
emissive: '#000000',
|
||||
name: "redstar",
|
||||
transparent:!(bKing),
|
||||
opacity: bKing?1:0,
|
||||
shading: THREE.FlatShading,
|
||||
});
|
||||
}
|
||||
materials0.push(mat);
|
||||
}
|
||||
|
||||
|
||||
var piece = new THREE.Mesh( geometry , new THREE.MultiMaterial(materials0));
|
||||
//board.overdraw = true;
|
||||
|
||||
callback(piece);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function MakePiece(index,side,type) {
|
||||
var clipx;
|
||||
if(side==$this.mOptions.attackers)
|
||||
clipx=0;
|
||||
else if(type=='k')
|
||||
clipx=310;
|
||||
else
|
||||
clipx=155;
|
||||
xdv.createGadget("piece#"+index,{
|
||||
base: {
|
||||
},
|
||||
"2d": {
|
||||
z: 4,
|
||||
type: "sprite",
|
||||
file: fullPath+"/res/xd-view/meshes/ardri-sprites.png",
|
||||
clipwidth: 155,
|
||||
clipheight: 155,
|
||||
clipx: clipx,
|
||||
clipy: 0,
|
||||
width: CSIZE*.85,
|
||||
height: CSIZE*.85,
|
||||
},
|
||||
"3d": {
|
||||
type: "custommesh3d",
|
||||
castShadow: true,
|
||||
receiveShadow: false,
|
||||
scale:[pieceScale,pieceScale,(type=="k")?pieceScale*1.5:pieceScale],
|
||||
create: function(callback){
|
||||
create3DPiece.call(this,side!=$this.mOptions.attackers,type=="k",callback);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
var index=0;
|
||||
MakePiece(index++,-this.mOptions.attackers,'k');
|
||||
for(var i=0;i<this.mOptions.initial.defenders.soldiers.length;i++)
|
||||
MakePiece(index++,-this.mOptions.attackers,'s');
|
||||
for(var i=0;i<this.mOptions.initial.attackers.length;i++)
|
||||
MakePiece(index++,this.mOptions.attackers,'s');
|
||||
|
||||
|
||||
// flat screens
|
||||
function createScreen(videoTexture) {
|
||||
var $this=this;
|
||||
var gg=new THREE.PlaneGeometry(4,3,1,1);
|
||||
var gm=new THREE.MeshPhongMaterial({color:0xffffff,map:videoTexture,shading:THREE.FlatShading});
|
||||
var mesh = new THREE.Mesh( gg , gm );
|
||||
$this.objectReady(mesh);
|
||||
return null;
|
||||
};
|
||||
var scaleScreen=2;
|
||||
var zScreen=2000;
|
||||
xdv.createGadget("videoa",{
|
||||
"3d": {
|
||||
type : "video3d",
|
||||
makeMesh: function(videoTexture){
|
||||
return createScreen.call(this,videoTexture);
|
||||
},
|
||||
z: zScreen,
|
||||
scale: [scaleScreen,scaleScreen,scaleScreen],
|
||||
},
|
||||
});
|
||||
xdv.createGadget("videoabis",{
|
||||
"3d": {
|
||||
type : "video3d",
|
||||
makeMesh: function(videoTexture){
|
||||
return createScreen.call(this,videoTexture);
|
||||
},
|
||||
z: zScreen-1000,
|
||||
scale: [scaleScreen/4,scaleScreen/4,scaleScreen/4],
|
||||
},
|
||||
});
|
||||
xdv.createGadget("videob",{
|
||||
"3d": {
|
||||
type : "video3d",
|
||||
makeMesh: function(videoTexture){
|
||||
return createScreen.call(this,videoTexture);
|
||||
},
|
||||
z: zScreen,
|
||||
scale: [scaleScreen,scaleScreen,scaleScreen],
|
||||
},
|
||||
});
|
||||
xdv.createGadget("videobbis",{
|
||||
"3d": {
|
||||
type : "video3d",
|
||||
makeMesh: function(videoTexture){
|
||||
return createScreen.call(this,videoTexture);
|
||||
},
|
||||
z: zScreen-1000,
|
||||
scale: [scaleScreen/4,scaleScreen/4,scaleScreen/4],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
var tokens={},tokenCounter=1;
|
||||
|
||||
View.Game.xdBuildScene = function(xdv) {
|
||||
xdv.updateGadget("extralights",{
|
||||
"3d":{
|
||||
visible:true,
|
||||
}
|
||||
});
|
||||
xdv.updateGadget("board",{
|
||||
base: {
|
||||
visible: !this.mNotation,
|
||||
},
|
||||
});
|
||||
xdv.updateGadget("boardnotations",{
|
||||
base: {
|
||||
visible: this.mNotation,
|
||||
},
|
||||
});
|
||||
for(var pos=0;pos<SIZE*SIZE;pos++) {
|
||||
var coord=Coord(pos);
|
||||
xdv.updateGadget("cell#"+pos,{
|
||||
base: {
|
||||
visible: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
var xScreen=0;
|
||||
var yScreen=9000;
|
||||
var thumbDist=.99;
|
||||
var thumbOffset=4000;
|
||||
xdv.updateGadget("videoa",{
|
||||
"3d": {
|
||||
visible: true,
|
||||
playerSide: 1,
|
||||
x: xScreen,
|
||||
y: this.mViewAs==1?yScreen:-yScreen,
|
||||
rotate: this.mViewAs==1?180:0,
|
||||
},
|
||||
});
|
||||
xdv.updateGadget("videoabis",{
|
||||
"3d": {
|
||||
visible: true,
|
||||
playerSide: -1,
|
||||
x: this.mViewAs==1?-thumbOffset:thumbOffset,
|
||||
y: this.mViewAs==1?thumbDist*yScreen:-thumbDist*yScreen,
|
||||
rotate: this.mViewAs==1?180:0,
|
||||
},
|
||||
});
|
||||
|
||||
xdv.updateGadget("videob",{
|
||||
"3d": {
|
||||
visible: true,
|
||||
playerSide: -1,
|
||||
x: -xScreen,
|
||||
y: this.mViewAs==1?-yScreen:yScreen,
|
||||
rotate: this.mViewAs==1?0:180,
|
||||
},
|
||||
});
|
||||
xdv.updateGadget("videobbis",{
|
||||
"3d": {
|
||||
visible: true,
|
||||
playerSide: 1,
|
||||
x: this.mViewAs==1?thumbOffset:-thumbOffset,
|
||||
y: this.mViewAs==1?-thumbDist*yScreen:thumbDist*yScreen,
|
||||
rotate: this.mViewAs==1?0:180,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
View.Board.xdDisplay = function(xdv, aGame) {
|
||||
for(var i=0;i<this.pieces.length;i++) {
|
||||
var piece=this.pieces[i];
|
||||
if(piece.p<0)
|
||||
xdv.updateGadget("piece#"+i,{
|
||||
base: {
|
||||
visible: false,
|
||||
},
|
||||
});
|
||||
else {
|
||||
var coord=Coord(piece.p);
|
||||
xdv.updateGadget("piece#"+i,{
|
||||
base: {
|
||||
visible: true,
|
||||
x: coord[0],
|
||||
y: coord[1],
|
||||
},
|
||||
"2d": {
|
||||
opacity: 1,
|
||||
},
|
||||
"3d":{
|
||||
z:0,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
View.Board.xdBuildHTStateMachine = function(xdv, htsm, aGame) {
|
||||
var $this=this;
|
||||
var move={};
|
||||
|
||||
function Clean(args) {
|
||||
for(var pos=0;pos<SIZE*SIZE;pos++) {
|
||||
xdv.updateGadget("clicker#"+pos,{
|
||||
base: {
|
||||
visible: false,
|
||||
click: null,
|
||||
}
|
||||
});
|
||||
xdv.updateGadget("cell#"+pos,{
|
||||
base: {
|
||||
},
|
||||
"2d": {
|
||||
classes: "",
|
||||
},
|
||||
});
|
||||
}
|
||||
$this.pieces.forEach(function(piece) {
|
||||
xdv.updateGadget("piece#"+piece.i,{
|
||||
base: {
|
||||
click: null,
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function SelectFrom(args) {
|
||||
var poss={};
|
||||
function Click(pos) {
|
||||
htsm.smQueueEvent("E_CLICK",{pos:pos});
|
||||
}
|
||||
$this.mMoves.forEach(function(move) {
|
||||
poss[move.f]=true;
|
||||
});
|
||||
for(var pos in poss)
|
||||
(function(pos) {
|
||||
var index=$this.board[pos];
|
||||
xdv.updateGadget("piece#"+index,{
|
||||
base: {
|
||||
click: function() {
|
||||
Click(pos);
|
||||
},
|
||||
}
|
||||
});
|
||||
xdv.updateGadget("clicker#"+pos,{
|
||||
base: {
|
||||
visible: true,
|
||||
click: function() {
|
||||
Click(pos);
|
||||
},
|
||||
},
|
||||
"3d" : {
|
||||
materials : {
|
||||
"ring" : {
|
||||
color : 0xffffff,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
});
|
||||
xdv.updateGadget("cell#"+pos,{
|
||||
base: {
|
||||
},
|
||||
"2d": {
|
||||
classes: "cell-select",
|
||||
}
|
||||
});
|
||||
})(pos);
|
||||
}
|
||||
function SaveFrom(args) {
|
||||
move.f=parseInt(args.pos);
|
||||
}
|
||||
function SelectTo(args) {
|
||||
var poss={};
|
||||
xdv.updateGadget("piece#"+$this.board[move.f],{
|
||||
base: {
|
||||
click: function() {
|
||||
htsm.smQueueEvent("E_CANCEL",{});
|
||||
},
|
||||
}
|
||||
});
|
||||
xdv.updateGadget("clicker#"+move.f,{
|
||||
base: {
|
||||
visible: true,
|
||||
click: function() {
|
||||
htsm.smQueueEvent("E_CANCEL",{});
|
||||
},
|
||||
},
|
||||
"3d" : {
|
||||
materials : {
|
||||
"ring" : {
|
||||
color : 0xff8800,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
});
|
||||
xdv.updateGadget("cell#"+move.f,{
|
||||
"2d": {
|
||||
classes: "cell-cancel",
|
||||
}
|
||||
});
|
||||
function Click(pos) {
|
||||
htsm.smQueueEvent("E_CLICK",{move:poss[pos]});
|
||||
}
|
||||
$this.mMoves.forEach(function(m) {
|
||||
if(m.f==move.f)
|
||||
poss[m.t]=m;
|
||||
});
|
||||
for(var pos in poss)
|
||||
(function(pos) {
|
||||
xdv.updateGadget("clicker#"+pos,{
|
||||
base: {
|
||||
visible: true,
|
||||
click: function() {
|
||||
Click(pos);
|
||||
},
|
||||
},
|
||||
"3d" : {
|
||||
materials : {
|
||||
"ring" : {
|
||||
color : 0xffffff,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
});
|
||||
xdv.updateGadget("cell#"+pos,{
|
||||
base: {
|
||||
},
|
||||
"2d": {
|
||||
classes: "cell-select",
|
||||
}
|
||||
});
|
||||
})(pos);
|
||||
}
|
||||
function SaveTo(args) {
|
||||
move.t=parseInt(args.move.t);
|
||||
move.c=args.move.c;
|
||||
}
|
||||
function Animate(args) {
|
||||
$this.taflAnimate(xdv,aGame,move,function() {
|
||||
htsm.smQueueEvent("E_ANIMATED",{});
|
||||
});
|
||||
}
|
||||
function SendMove(args) {
|
||||
aGame.MakeMove(move);
|
||||
}
|
||||
function Cancel(args) {
|
||||
move={}
|
||||
}
|
||||
htsm.smTransition("S_INIT", "E_INIT", "S_SELECT_FROM", [ ]);
|
||||
htsm.smEntering("S_SELECT_FROM",[SelectFrom]);
|
||||
htsm.smLeaving("S_SELECT_FROM",[Clean]);
|
||||
htsm.smTransition("S_SELECT_FROM", "E_CLICK", "S_SELECT_TO", [ SaveFrom, SelectTo ]);
|
||||
htsm.smLeaving("S_SELECT_TO",[Clean]);
|
||||
htsm.smTransition("S_SELECT_TO", "E_CLICK", "S_ANIMATE", [ SaveTo, Animate ]);
|
||||
htsm.smTransition("S_SELECT_TO", "E_CANCEL", "S_SELECT_FROM", [ Cancel ]);
|
||||
htsm.smTransition("S_ANIMATE", "E_ANIMATED", "S_DONE", [ SendMove ]);
|
||||
htsm.smTransition(["S_SELECT_FROM","S_SELECT_TO","S_ANIMATE"], "E_END", "S_DONE", [ ]);
|
||||
htsm.smEntering("S_DONE",[Clean]);
|
||||
htsm.smTransition("S_DONE", "E_END", null, [ ]);
|
||||
}
|
||||
|
||||
View.Board.xdPlayedMove = function(xdv, aGame, aMove) {
|
||||
aGame.mOldBoard.taflAnimate(xdv,aGame,aMove,function() {
|
||||
aGame.MoveShown();
|
||||
});
|
||||
}
|
||||
|
||||
View.Board.taflAnimate = function(xdv,aGame,aMove,callback) {
|
||||
var $this=this;
|
||||
var animCount=0;
|
||||
|
||||
function EndAnim() {
|
||||
if(--animCount==0)
|
||||
callback();
|
||||
}
|
||||
var piece=this.pieces[this.board[aMove.f]];
|
||||
|
||||
var soundName=this.mWho==aGame.mOptions.attackers?"move1":"move3";
|
||||
if (aGame.mSkin=='thanksgiving')
|
||||
soundName=piece.t=='k'?"move3":"move1";
|
||||
aGame.PlaySound(soundName);
|
||||
|
||||
var coord=Coord(aMove.t);
|
||||
xdv.updateGadget("piece#"+piece.i,{
|
||||
base: {
|
||||
x: coord[0],
|
||||
y: coord[1],
|
||||
},
|
||||
},600,function() {
|
||||
if(aMove.c.length>0) {
|
||||
var soundName="death"+(Math.floor(Math.random()*3)+1);
|
||||
aGame.PlaySound(soundName);
|
||||
aMove.c.forEach(function(pos1) {
|
||||
animCount++;
|
||||
var piece1=$this.pieces[$this.board[pos1]];
|
||||
xdv.updateGadget("piece#"+piece1.i,{
|
||||
base: {
|
||||
},
|
||||
"2d": {
|
||||
opacity: 0,
|
||||
},
|
||||
"3d": {
|
||||
z: -1000,
|
||||
}
|
||||
},600,EndAnim);
|
||||
});
|
||||
} else
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
38
src/games/tafl/tafl.css
Normal file
|
@ -0,0 +1,38 @@
|
|||
.cell {
|
||||
}
|
||||
|
||||
.cell-black {
|
||||
background-color: rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.cell-white {
|
||||
background-color: rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
.cell-exclude {
|
||||
background-color: rgba(0,0,0,.5);
|
||||
}
|
||||
|
||||
.cell-home {
|
||||
background-color: rgba(255,255,255,.5);
|
||||
}
|
||||
|
||||
.cell.cell-select {
|
||||
background-image: url(res/images/selectcell2.png);
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.cell.cell-cancel {
|
||||
background-image: url(res/images/unselectcell.png);
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.notation {
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.clicker {
|
||||
}
|
||||
|
||||
|
BIN
src/games/tafl/thumb-alea-evangelii.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
src/games/tafl/thumb-tafl-ardri.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
src/games/tafl/thumb-tafl-brandubh.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
src/games/tafl/thumb-tafl-hnefatafl.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
src/games/tafl/thumb-tafl-tablut.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
src/games/tafl/thumb-tawlbwrdd.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
src/games/tafl/thumbnail-tg.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
src/games/tafl/thumbnail.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
src/games/tafl/thumbnail9x9.png
Normal file
After Width: | Height: | Size: 20 KiB |