Here you can load files, from one of the examples listed or from a file on your device. You can also download the current game to a file on your device.
Navigate to the next tabs to read the instructions for how to play, to view and edit the game rules, and to enter your strategy.
Load game
Upload game from file
Download current game
General gameplay
This game is played by writing a logic program that expresses your strategy. You are the player. The rules of the game are also expressed by a logic program. For example, what is the effect of moves? What do opponents (if any) do? When is the game won or lost?
In each level, the player controls some elements, and nature controls the rest. The game is played in discrete time steps. At each time step, the player performs some action(s). Based on these actions, nature determines the next state of the game.
Not everything in the game may be observable to the player. The player can keep (and update) some things in their memory as the game progresses.
The various elements and features of the game are explained in detail below.
How are levels generated?
The generation of levels is expressed by a logic program (labeled level generation). An answer set for this program encodes the level using atoms with predicate names at, setting, and decorate. Atoms over the predicate at specify the (initial) state of the world in the level. Atoms over the predicate setting specify features of the level that remain fixed over the course of the game. Atoms over the predicate decorate specify how the level is visualized.
The level generation program may contain substrings of the form RANDINT(l,u), where l and u are integers. In the preprocessing of the program, these are replaced by a random integer between (and including) l and u. This gives an easy way to include randomness in the level generation.
The program labeled auxiliary program is added to the level generation program (as well as to the other programs). The aim of this auxiliary program is to define helping predicates that can be used in multiple parts of the game.
For example, the following program specifies a game that is played on a 3x3 grid, with initial locations for an element player and an element flag, and encodes some information about how to visualize the game.
% The game is played on a 3x3 grid setting(grid_width(3)). setting(grid_height(3)). % Time bound: 4 steps setting(time_bound(4)). % The player is placed in the top-left cell at(1,1,player). % The flag is placed randomly in the bottom row at(3,RANDINT(1,3),flag). % Visualization instructions decorate(game_type,grid). decorate(label,flag,font_f024). decorate(label,player,font_f007).
What can the player observe?
The logic program labeled visibility encodes what parts of the game are visible (or observable) to the player at each time step. For this, the predicate name observe is used. To this program are added the current state of the game (in the form of atoms over at), and the level settings (in the form of atoms over setting). An answer set of the resulting program, restricted to atoms over the predicate observe, constitutes what is observable to the player.
For example, the following visibility program captures that every true atom at(R,C,O) is observable.
% Everything is observable observe(at(R,C,O)) :- at(R,C,O).
How does the game progress?
The logic program labeled nature's moves expresses how the game progresses from one state to the next. To this program are added the current state of the game (in the form of atoms over at), the move(s) of the player (in the form of atoms over do), and the level settings (in the form of atoms over setting). An answer set of the resulting program, restricted to atoms over the predicate next, constitutes the next state of the game, where these atoms are translated to use the predicate at instead of next.
This program may contain substrings of the form RANDINT(l,u), where l and u are integers. In the preprocessing of the program, these are replaced by a random integer between (and including) l and u. This gives an easy way to include randomness in the level generation.
If the combined program has no answer sets, the state of the game does not change.
For example, the following program expresses that the flag moves to a randomly selected location that is in the same column as where it was in the previous state.
% The flag moves randomly inside its column next(RANDINT(1,3),C,flag) :- at(R,C,flag).
When is a game won or lost?
At each time step, the logic program labeled winning conditions determines whether the player wins or loses the game, or whether it continues. To this program are added the current state of the game (in the form of atoms over at), the level settings (in the form of atoms over setting), and an atom current_time(t), where t is replaced by the integer value specifying the number of time steps that have passed. An answer set of the resulting program is taken. If this answer set contains any atoms over win, the player wins the game. Otherwise, if this answer set contains any atoms over lose, the player loses. Otherwise, the game continues.
For example, the following program expresses that the player wins if it reaches the flag, and that it loses if time runs out.
% Goal: reach the flag win :- at(R,C,player), at(R,C,flag). % You lose if time runs out.. lose(timeout) :- current_time(T), setting(time_bound(S)), T >= S.
How to instruct the player?
At each time step, the logic program labeled player strategy specifies what move(s) the player performs at that time step, and how the player's memory is updated. To this program are added the current state of the game (in the form of atoms over at), the level settings (in the form of atoms over setting), and the player's memory (in the form of atoms over memory). An answer set A of the resulting program is taken. This answer set restricted to atoms over do constitutes the moves that the player performs. This answer set restricted to atoms over remember and forget specifies how the player's memory changes.
The player's memory in the next time step consists of (i) all atoms memory(M) such that forget(M) does not occur in A, and (ii) all atoms memory(M) such that remember(M) occurs in A.
The player strategy program may contain substrings of the form RANDINT(l,u), where l and u are integers. In the preprocessing of the program, these are replaced by a random integer between (and including) l and u. This gives an easy way to include randomness in the level generation.
For example, the following program expresses that the player performs the action wait, and that the memory counter counter(T) is increased by one.
% Wait do(wait). % Increase counter in memory forget(counter(T)) :- memory(counter(T)). remember(counter(T+1)) :- memory(counter(T)).
Creating your own games
You can either load and play an existing game. Loading games can be done in the Control tab. Or you can design your own game. In order to do so, specify the four respective programs under the Game rules tab.
Note: in order to edit the auxiliary, level generation and visibility programs, you need to unlock these for editing. This will remove the level that is currently in memory, to ensure that the level in memory is based on the auxiliary, level generation and visibility programs.
How is the game visualized?
Currently, only games played on a rectangular grid can be visualized. In order for this to work, the level settings must include facts setting(grid_width(w)) and setting(grid_height(h)) for some positive integers w and h.
Items on the grid may be visualized with an icon in the Font Awesome font as follows. To depict an item named obj in the logic programs by an icon with unicode representation fXXX, add the following fact to the level generation program: decorate(label,obj,font_fXXX).
For example, the following line expresses that the item named bug is depicted with a bug icon.
decorate(label,bug,font_f188).
Auxiliary
This is an auxiliary program that is added to all programs.
Level generation
This program expresses how levels are generated.
Visibility
This program expresses what the player can observe.
Nature's moves
This program expresses nature's moves—i.e., how the state of the board changes as a result of the player's moves.
Winning conditions
This program expresses when the game is won or lost.
Player strategy
This program computes the player's move(s).
Level settings
Level state
Game output
Below you will find, for each time step, what facts were fed into the player program, based on (i) the state of the game that is observable to the player, and (ii) the player's memory.