2017 © Pedro Peláez
 

library logeek

Lego Mindstorms NXT-like robot programming engine in PHP

image

thunderer/logeek

Lego Mindstorms NXT-like robot programming engine in PHP

  • Monday, July 9, 2018
  • by Thunderer
  • Repository
  • 2 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Logeek

Build Status SensioLabsInsight License Latest Stable Version Dependency Status Scrutinizer Code Quality Code Coverage Code Climate, (*1)

Introduction

Logeek is a PHP engine for learning basic programming by simulating movement of element through a board. It's concepts are similar to LEGO Mindstorms or Android and iPhone games like Robot School., (*2)

Requirements

Only PHP 5.3 (namespaces)., (*3)

Installation

This library is available on Packagist under alias thunderer/logeek., (*4)

Usage

// first create Board object with desired dimensions
$board = new Thunder\Logeek\Board(5, 5);
// then add field types and actions allowed on this board
$board->addFieldTypes(array('ground' => '.'));
$board->addActions(array(new MoveAction()));
// load board using field aliases
$board->loadFromString('...');
// add actors and exits
$board->addExit('exit', 2, 0);
$board->addActor('robot', 0, 0, 'right');
// add program for your actor, function "main" will be run
$compiler = new Compiler();
$functions = $compiler->compile($board, '
function main
  move 2
    ');
// run the simulation (print board size before and after)
echo $board->renderBoard();
$board->runActor('robot');
echo $board->renderBoard();
// check if everything is correct
assert(true === $board->isActorAtExit('robot', 'exit'));

Program syntax is a simple Python-like programming language with significant white-space (indentation of 2 spaces). Number as the first token in line means repeating that line that number of times. Currently implemented actions are as follows:, (*5)

  • Basic:, (*6)

    • rotate left|right
    • move length|variable
    • pick up|down
    • open
  • Loops:, (*7)

    • for iterations
    • while variable is|not value
  • Conditions:, (*8)

    • if variable is|not value
  • Structure:, (*9)

    • function name
  • Sensors:, (*10)

    • sensor-type variable
    • sensor-distance variable
    • sensor-proximity variable

Sample simulations are implemented in tests/LogeekTest.php, it's easy to look, change and experiment with them., (*11)

License

See LICENSE file in the root of this repository., (*12)

The Versions

09/07 2018

dev-master

9999999-dev

Lego Mindstorms NXT-like robot programming engine in PHP

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Tomasz Kowalczyk

09/07 2018

v0.2.0

0.2.0.0

Lego Mindstorms NXT-like robot programming engine in PHP

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Tomasz Kowalczyk

08/03 2015

v0.1.0

0.1.0.0

Lego Mindstorms NXT-like robot programming engine in PHP

  Sources   Download

MIT

The Requires

  • php >5.3.0

 

The Development Requires

by Tomasz Kowalczyk