-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProgramHandler.h
38 lines (32 loc) 路 1.14 KB
/
ProgramHandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef PROGRAMHANDLER_H
#define PROGRAMHANDLER_H
#include "ProgramBox.h"
#include "Robot.h"
#include "Grid.h"
class ProgramHandler
{
private:
// Program boxes containing the actions
ProgramBox* m_program_main;
ProgramBox* m_program_p1;
ProgramBox* m_program_p2;
Robot* m_robot;
Grid* m_grid;
// Attribute used to reset the jump of the robot if it went forward
// (the robots lands only when it goes forward)
bool m_robot_jumped_before;
// Used to move the robot forward (called in runProgram)
int moveForward(int result);
// RESULT ->
// -4 = ALL CELLS ARE NOT TURNED ON
// -3 = FAILED (cell way too high)
// -2 = FAILED (had to jump)
// -1 = FAILED (out of the grid)
// 0 = IT'S FINE FOR THE MOMENT (MAIN)
// 1 = IT'S FINE FOR THE MOMENT (PROGRAM 1)
// 2 = IT'S FINE FOR THE MOMENT (PROGRAM 2)
public:
ProgramHandler(ProgramBox *program_main, ProgramBox *program_p1, ProgramBox *program_p2, Robot *robot, Grid* grid);
int runProgram(ProgramBox* program, const unsigned int &index, int result, Theme* defaultTheme, Theme* currentActionTheme);
};
#endif // PROGRAMHANDLER_H