-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·130 lines (123 loc) · 5.22 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!DOCTYPE html>
<html lang="de">
<head>
<!--
- This file is part of La Game.
- Copyright 2009 Shahriar Heidrich and Jannik Schürg
-
- La Game is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- La Game is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with La Game. If not, see <http://www.gnu.org/licenses/>.
-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="resources/style.css" type="text/css">
<script type="text/javascript" src="src/lagame.tools.js"></script>
<script type="text/javascript" src="src/lagame.math.js"></script>
<script type="text/javascript" src="src/lagame.lpiece.js"></script>
<script type="text/javascript" src="src/lagame.npiece.js"></script>
<script type="text/javascript" src="src/lagame.field.js"></script>
<script type="text/javascript" src="src/lagame.gui.js"></script>
<script type="text/javascript" src="src/lagame.player.js"></script>
<script type="text/javascript" src="src/lagame.ai-player.js"></script>
<script type="text/javascript" src="src/lagame.logic.js"></script>
<script type="text/javascript">
currentGame = null;
function newGame() {
if (currentGame) {
currentGame.gui.canvas = document.createElement("canvas");
currentGame.stopGame();
}
updateGameMode();
var playerLabel = document.getElementById('currentPlayer');
var moveStats = document.getElementById('moveStats');
var nextPlayer = document.getElementById('nextPlayer');
var canvas = document.getElementById('laGameCanvas');
var gui = new LaGameGUI(canvas, playerLabel, nextPlayer, moveStats);
var logic = new LaGameLogic(gui, playerInput[0], playerInput[1]);
currentGame = logic;
gui.setPlayerLabel('Spieler 1 beginnt', 0);
gui.updateMoveStat();
gui.setCanFinishTurn(false);
document.getElementById('nextPlayer').onclick = function() {
logic.finishTurn();
}
logic.initializeGame();
}
function updateGameMode() {
var mode = document.getElementById('versusMode').value;
switch (mode) {
case "0": playerInput = [LaGamePlayer, LaGamePlayer]; break;
case "1": playerInput = [LaGamePlayer, LaGameAiPlayer]; break;
case "2": playerInput = [LaGameAiPlayer, LaGameAiPlayer]; break;
}
}
window.onload = function() {
playerInput = [LaGamePlayer, LaGamePlayer];
var newGameCheck = function() {
if (window.confirm('Wirklich das Spiel neustarten?'))
newGame();
};
document.getElementById('newGame').addEventListener('click', newGameCheck, false);
document.getElementById('versusMode').addEventListener('change', function() {
updateGameMode();
newGameCheck();
}, false);
newGame();
}
</script>
<title>La Game</title>
</head>
<body>
<h1>La Game</h1>
<!--[if IE]>
<p id="ieComment">
Du benutzt einen nicht unterstützten, alten und unrespektierten Browser.<br>
Versuche den <a href="http://www.mozilla-europe.org/de/firefox/">Firefox Browser</a>
oder etwas anderes, vergleichbar qualitativ Hochwertiges.
</p>
<![endif]-->
<p>
Das <a href="http://www.edwdebono.com/debono/lgame.htm">L-Spiel</a>
von <a href="http://www.edwdebono.com/">Edward de Bono</a> in JavaScript/Canvas.
</p>
<canvas width="400" height="400" id="laGameCanvas"></canvas>
<fieldset>
<legend>Spiel</legend>
<select name="versusMode" id="versusMode">
<option value="0">Mensch gegen Mensch</option>
<option value="1" selected>Mensch gegen Maschine</option>
<option value="2">Maschine gegen Maschine</option>
</select>
<input type="button" name="newGame" value="Neues Spiel" id="newGame">
<input type="button" name="nextPlayer" value="Nächster Spieler" id="nextPlayer">
<p id="gameInfo">
<strong id="currentPlayer">Spieler 1 beginnt</strong>. Wähle die Steine per
<code>Klick</code> aus. N-Steine kannst du wieder per Klick setzen und L-Steine
mit der Maus an der gewünschten Stelle ziehen. Solltest du dich
„verzogen“ haben, lass die Maus außerhalb deiner neuen Position los.
Wenn du den falschen N-Stein ausgesucht hast,
kannst du deine Auswahl mit <code>ESC</code> ändern.
</p>
<p>
<code id="moveStats">Das Spiel hatte bis jetzt <strong>0</strong> Züge</code>
</p>
</fieldset>
<p id="author">
Shahriar M. Heidrich und Jannik Schürg (2009)<br>
Quellcode auf <a href="http://github.com/jannschu/la_game">Github</a>
zu finden, <a href="http://www.gnu.org/licenses/gpl.html">GPL Lizenz</a>.
</p>
<p id="gplLogo">
<a href="http://www.fsf.org/"><img src="resources/gplv3logo.png" width="88" height="31"></a>
</p>
</body>
</html>