Boardgames Example - Demo

We consider to draw a boardgame with 4x5 fields, in black and white color. The game consists of two pawns, where each pawn can be moved only downwards. The following DSL realizes this game:

board = {
    _: tile('white'),
    b: tile('black'),
    boardlayout:
        [ "_ b _ b _",
          "b _ b _ b",
          "_ b _ b _",
          "b _ b _ b" ]
}
	
pawns = {
    _: nopawn(),
    r: pawn('runner'),
    pawnsetup: 
        [ "_ r _ r _" ],
}

moves = {
    r1 : function(x,y) { if(isFree(x,y+1)) move(x,y+1) }
}

As we see in this code, the layout is defined by using a matrix element. In "_ b _ b _" we see how each line of the board is drawn with black and white tiles. Regarding the behavior of the pawns, we define the available move options with the expression isFree(x,y+1)) move(x,y+1). The first part of this expression is the condition, and if this conditions is true, then the second part defines the available movement. As we see, only vertical movements are allowed with y+1

Try the Game

As configured above, this game consists of 4x5 tiles and two pawns that can be moved only one field horizontally downwards. See for yourself how the movements are presented.



Homepage // Motivation // Our Services // Examples // Design Tools // Contact
© Copyright 2011, Sebastian Günther & Thomas Cleenewerck, Software Languages Lab, All rights reserved