Some very old uncommitted changes from 2013-10-27T16:09

This commit is contained in:
Suzanne Soy 2013-10-27 16:09:00 +01:00
parent 33e773b5ea
commit 8fa22c87a9

20
jeu.js
View File

@ -150,6 +150,7 @@ var Value = {
}, },
}; };
// Test
(function() { (function() {
var maybeCellType = Type.Maybe(Type.Int()); var maybeCellType = Type.Maybe(Type.Int());
var maybeCellPattern = Pattern.Maybe(Pattern.AnyInt()); var maybeCellPattern = Pattern.Maybe(Pattern.AnyInt());
@ -167,13 +168,14 @@ var Value = {
// Type system: Types, Pattern matching and Values // Type system: Types, Pattern matching and Values
// Grid cells with {floor: new Floor(), actor: new Actor()} // Grid cells with {floor: new Floor(), actor: new Actor()}
// where Floor has 4 "push" input/output directions, 4 input directions and 4 output directions. // where Floor has 4 "push" input/output directions, 4 input directions and 4 output directions.
//
// TODO : // TODO :
// Type system: // Type system:
// creating patterns from types, // creating patterns from types,
// verifying if a value is of the given type, // verifying if a value is of the given type,
// verifying if a pattern is matches against values of the given type. // verifying if a pattern is matches against values of the given type.
// Type system: // 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. // Display types, values and patterns.
// Grid pattern matching: // Grid pattern matching:
// using relative up/right/down/left grid positions, and absolute coordinates // using relative up/right/down/left grid positions, and absolute coordinates
@ -189,6 +191,11 @@ GameType.Direction = Type.Enum([
'right', 'right',
]); ]);
GameType.Position = Type.Struct({
x: Type.Int(),
y: Type.Int(),
});
GameType.FloorTile = Type.Enum([ GameType.FloorTile = Type.Enum([
'floor', 'floor',
'grass', 'grass',
@ -214,12 +221,21 @@ GameType.ActorTile = Type.Enum([
'block', 'block',
]); ]);
GameType.Cell = Type.Struct({ GameType.Cell = Type.Struct({
floor: GameType.Floor, floor: GameType.Floor,
trigger: Type.Maybe(GameType.Trigger), trigger: Type.Maybe(GameType.Trigger),
actor: Type.Maybe(GameType.Actor), 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) { function Position(x, y) {
this.x = x; this.x = x;
this.y = y; this.y = y;