summaryrefslogtreecommitdiff
path: root/src/moves.ads
blob: ebf2bb1ba943c3625b41bc1898b7880dc07d97af (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62


private with

    Ada.Containers.Vectors;


package Moves is


    type Move is record
        Delta_X, Delta_Y : Integer;
        Push : Boolean;
    end record;


    Null_Move : constant Move;




    type Path is tagged private;


    Empty_Path : constant Path;


    procedure Add
           (This : in out Path;
            Item : in     Move);


    procedure Add
           (This : in out Path;
            List : in     Path);


    function Latest
           (This : in Path)
        return Move;


    procedure Drop_Latest
           (This : in out Path);


private


    package Move_Vectors is new Ada.Containers.Vectors
        (Index_Type => Positive, Element_Type => Move);


    type Path is new Move_Vectors.Vector with null record;


    Null_Move : constant Move := (Delta_X => 0, Delta_Y => 0, Push => False);
    Empty_Path : constant Path := (Move_Vectors.Empty_Vector with null record);


end Moves;