PacManWrapper.emam 1.34 KB
Newer Older
Bernhard Rumpe's avatar
BR-sy    
Bernhard Rumpe committed
1
/* (c) https://github.com/MontiCore/monticore */
Jean-Marc Ronck's avatar
Jean-Marc Ronck committed
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
39
40
41
42
43
package de.rwth.pacman;
import de.rwth.pacman.heithoff2.Controller;
import de.rwth.pacman.structs.Ghost;

// UP    = 0
// DOWN  = 1
// LEFT  = 2
// RIGHT = 3

component PacManWrapper {
    ports 
        in Z(-1m: 19m) ghostX[4],
        in Z(0m: 21m) ghostY[4],
        in Z(0 : 1 : 3) ghostDirection[4],
        in B ghostEatable[4],
        in B ghostEaten[4],
        in Z(-1m: 19m) pacManX,
        in Z(0m: 21m) pacManY,
        in B pacManEaten,
        in Z(0:oo) pacManLives,
        in Z(0:oo) pacManScore,
        in Z^{22,19} map,
        
        out Z(0 : 1 : 3) newPacManDirection;
        
    //Replace this with your own custom controller
    instance Controller controller;
    
    connect ghostX[:] -> controller.ghostX[:];
    connect ghostY[:] -> controller.ghostY[:];
    connect ghostDirection[:] -> controller.ghostDirection[:];
    connect ghostEatable[:] -> controller.ghostEatable[:];
    connect ghostEaten[:] -> controller.ghostEaten[:];
    connect pacManX -> controller.pacManX;
    connect pacManY -> controller.pacManY;
    connect pacManEaten -> controller.pacManEaten;
    connect pacManLives -> controller.pacManLives;
    connect pacManScore -> controller.pacManScore;
    connect map -> controller.map;
    
    connect controller.newPacManDirection -> newPacManDirection;
    
Bernhard Rumpe's avatar
BR-sy    
Bernhard Rumpe committed
44
}