commit 8fa22c87a9b25741199758b0ff59ae2b51f39d5e
parent 33e773b5eaa001ea6a85b17877df2a2e10d69f34
Author: Suzanne Soy <ligo@suzanne.soy>
Date: Sun, 27 Oct 2013 16:09:00 +0100
Some very old uncommitted changes from 2013-10-27T16:09
Diffstat:
| M | jeu.js | | | 20 | ++++++++++++++++++-- |
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/jeu.js b/jeu.js
@@ -150,6 +150,7 @@ var Value = {
},
};
+// Test
(function() {
var maybeCellType = Type.Maybe(Type.Int());
var maybeCellPattern = Pattern.Maybe(Pattern.AnyInt());
@@ -167,13 +168,14 @@ var Value = {
// Type system: Types, Pattern matching and Values
// Grid cells with {floor: new Floor(), actor: new Actor()}
// where Floor has 4 "push" input/output directions, 4 input directions and 4 output directions.
+//
// TODO :
// Type system:
// creating patterns from types,
// verifying if a value is of the given type,
// verifying if a pattern is matches against values of the given type.
// Type system:
-// Maybe, Either and OrElse have slightly different meanings.
+// Maybe, Either and OrElse have slightly different meanings in types/patterns/values.
// Display types, values and patterns.
// Grid pattern matching:
// using relative up/right/down/left grid positions, and absolute coordinates
@@ -189,6 +191,11 @@ GameType.Direction = Type.Enum([
'right',
]);
+GameType.Position = Type.Struct({
+ x: Type.Int(),
+ y: Type.Int(),
+});
+
GameType.FloorTile = Type.Enum([
'floor',
'grass',
@@ -214,12 +221,21 @@ GameType.ActorTile = Type.Enum([
'block',
]);
-GameType.Cell = Type.Struct({
+GameType.Cell = Type.Struct({
floor: GameType.Floor,
trigger: Type.Maybe(GameType.Trigger),
actor: Type.Maybe(GameType.Actor),
});
+GamePattern = {};
+
+GamePattern.AnchoredCell = function(cellPattern, positionPattern) {
+};
+
+GamePattern.Subgrid = function(subgrid) { // subgrid = Array(Array(Either(GamePattern.Cell, GamePattern.AnchoredCell)))
+
+};
+
function Position(x, y) {
this.x = x;
this.y = y;