##### Personal tools
You are here: Home Assignment 1
« September 2020 »
September
SuMoTuWeThFrSa
12345
6789101112
13141516171819
20212223242526
27282930

# Assignment 1

## Submission

Please submit an archive that contains all source and documentation files in a flat directory structure for each exercise (that is, place all files of a given exercise in one directory); Upload the archive to moodle, in the relevant submission box. Make sure to include in the archive a file where you state your names, IDs and explain in detail how to run the program.

You are free to use any programming language for this exercise.

## Exercise 1.1

### General

Name the archive either `oskar.zip` or `oskar.tar.gz`.
Name the basename of the program file `oskar`.
If you develop in C++ use a single source file called `oskar.cpp`.
If you develop in Python name the executable `oskar.py`.
If you develop in a different language, follow the same logic...

### Input

The program should accept 7 arguments on the command line:

• The source location of the robot, followed by the destination location of the robot, followed by the name of file that contains the description of the obstacle.
• Each location is a vector of three integral values specifying the x, y, and z coordinates of the robot center.
• A valid input file starts with the x, y, and z dimensions (in that order) of the puzzle followed by three matrices representing the xy-, yz-, and zx-faces; 0 represents a free location and 1 represents a forbidden location.
• The entry in row i>=0 and column j>=0 in the xy-matrix represents the value for x=j and y=i. The same holds for the two other matrices.
• The dimensions of the standard Oskar puzzle are 11, 11, 11. One pair of source and destination locations is (3, 7, 7) and (5, 1, 1), respectively. For a puzzle of dimensions 11,11,11 a location is defined by three integer values v_1, v_2, v_3, where  0<=v_k<=10  .
• You can obtain the file that contains the three (11x11) matrices here.
`sx sy sz dx dy dz filename`

### Output

The program should export the result to the standard output. The output format must be identical to the format of the input file (`solution.txt`) of the verifier (see below). It consists of three lines.
The first and second lines contain the start and end positions, respectively. Each position consists of three integral values separated by spaces.
The third line contains a sequence of commands separated by spaces. Applying these commands to the robot should move it from the source location to the destination location without passing through forbidden locations. A command is encoded as follows:

0—move one unit along the x-axis in the positive direction
1—move one unit along the x-axis in the negative direction
2—move one unit along the y-axis in the positive direction
3—move one unit along the y-axis in the negative direction
4—move one unit along the z-axis in the positive direction
5—move one unit along the z-axis in the negative direction

### Oskar verifier

The program `oskarVerifier` verifies the solution for Oskar's cube.
It accepts one argument on the command line, which is the name of a file that contains a sequence of commands.
By default, file name of the input file is `solution.txt`, so, the following calls are equivalent:

```oskarVerifier

oskarVerifier solution.txt```

The format of the input file follows:
1st line—start position (e.g., 3 7 7)
2nd line—end position (e.g., 5 1 1)
3rd line—command sequence( e.g., 4 4 1 1)

The program outputs `SUCCESS`, if the sequence of commands is a valid solution. Otherwise it outputs `FAILURE(<NUM>)`, where the number <NUM> in parenthesis represents the number of successful steps that were performed before collision.

### Oskar Simulator

This is for the adventurous among you and is absolutely optional.
Below you can find links to 3 VRML files that can be used to run a 3D graphics simulation of the motion plan.

The last one is the entry point. It's a short file that contains the start position, end position, and sequence. You can edit the numbers within.

The files are in standard VRML format and use JavaScript, so you need a VRML viewer that supports JavaScript nodes.

The SGAL open source toolkit, supported only on Linux, for example, does the job.

Clone the repository of the sources (see command line below) and follow the instructions in the INSTALL file in the root directory.

`git clone git@bitbucket.org:efifogel/sgal.git`

Building the toolkit results with a few libraries and an executable called player.

Once built, you can run the command below to start the simulation

`player oskarSim.wrl`