A long-lived project that still receives updates
Gobstones Runner for Mumuki
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Build Status Code Climate Test Coverage

Install the server

Clone the project

git clone https://github.com/mumuki/mumuki-gobstones-runner
cd mumuki-gobstones-runner

Install global dependencies

rbenv install 2.3.1
rbenv rehash
gem install bundler

Install local dependencies

./devinit

Run tests

bundle exec rake

Run the server

If you want to start the server quickly in developer environment, you can just do the following:

./devstart

This will install your dependencies and boot the server.

Deploy docker image

cd worker/
# docker login
docker rmi mumuki/mumuki-gobstones-worker
docker build -t mumuki/mumuki-gobstones-worker .
docker push mumuki/mumuki-gobstones-worker

Test syntax

The syntax of a gobstones test is the following:

OPTIONS
examples: [EXAMPLE]

Where:

  • OPTIONS can be zero or more of these:

    • show_initial_board. Whether to show initial board. Default: true
    • show_final_board. Whether to show final board. Default: true
    • check_head_position. Whether the final head position is checked in the test. Default: false
    • expect_endless_while. Whether the test contains an infinite loop. Default: false.
    • subject. Function or procedure being evaluated. Default: nil.
  • The EXAMPLE array is required and needs at least one EXAMPLE. The EXAMPLE has the following structure:

    TITLE
    ARGUMENTS
    INITIAL_BOARD
    FINAL_BOARD
    ERROR

    Where:

    • TITLE is optional and represents the title that will be shown for that example. For example:
    title: 'A title'
    • ARGUMENTS array is optional. It represents the arguments for the given subject. For example:
    arguments: 
     - Sur
     - Verde
    • INITIAL_BOARD is required unless an ERROR is provided and has the following structure:

      GBB/1.0
      SIZE
      [CELL]
      HEAD_POSITION

      Where:

      • SIZE is required and receives width and height as arguments. For example:
        size 5 1

      This will result in a board with 5 cells wide and 1 cell high

      • CELL array is optional. Each CELL takes two required arguments which represents the horizontal and vertical coordinates and an array of balls that will be located in that cell. For example:

        cell 0 1 Verde Rojo Negro

        This will result in a green, red and black ball placed in (0,1).

      • HEAD_POSITION is required and represents the position of the head in the board. It takes two required arguments which represents the horizontal and vertical coordinates.

        head 3 2

        In this case the head will start at (3,2)

    • FINAL_BOARD has the same structure as the INITIAL_BOARD with the exception that HEAD_POSITION is required only when check_head_position option is set to true. (In fact it isn't required but the test will always fail if it isn't provided)

    • ERROR isn't required. It represents an expected error, so the test will pass only if the given error occurs. Only one ERROR can be provided in a test. When providing an ERROR, FINAL_BOARD isn't required (or needed). INITIAL_BOARD is required only on those errors that need to draw the board for being executed (no_stones and out_of_board).

      Existing errors:

      • no_stones: This error occurs when a ball is tried to be removed but there were no balls in that cell.
      • out_of_board: This error occurs when a move is made that falls out of the board.
      • boom_called: This error occurs when the BOOM statement is called.
      • wrong_argument_type: This error occurs when a function is called with the incorrect type of argument. For example: Mover(Rojo)
      • unassigned_variable: This error occurs when a variable is used without previous declaration.

Kids tests considerations

Common scenario

Generally, in kids, we'll only be checking if the final board matches the initial board. boom operations are supported and used.

Unsupported operations

Currently the runner doesn't support a subject when the solution is sent in xml format

Operations that doesn't make sense

Because of the layout and the pedagogic considerations, there are certain operations supported by the runner that doesn't make sense to use in kids mode:

  • show_initial_board and show_final_board: Because of kids layout, the boards are always being displayed.
  • check_head_position: For the kids this may be a bit difficult to understand and there is no pedagogic benefit in using it.
  • title for boards: The title is set in laboratory, so a custom title won't be display initially. It'll only appear when the success pop-up appears.

Interactive programs

In order to use interactive programs there are three requirements:

  1. Set the option interactive to true in the test.
  2. Provide a default code that has an interactive program in it.
  3. Provide at least one expectation. The syntax for a listener name is the following:

onK_Pressed, where _ can be any letter, Up, Down, Right, Left (arrows) or Space.

Also, it is desirable to provide a gs-keyboard-config.