summaryrefslogtreecommitdiff
path: root/src/moves.ads
blob: 3e8684700e6e2e0679e049e18f2648cb8defb670 (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
63
64
65
66
67
68
69
70
71
72
73
74


private with

    Ada.Containers.Vectors;


package Moves is


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




    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);

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




    function Latest
           (This : in Path)
        return Move;

    procedure Drop_Latest
           (This : in out Path);




    function Length
           (This : in Path)
        return Natural;

    procedure Total_Delta
           (This   : in     Path;
            DX, DY :    out Integer);


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;


    Empty_Path : constant Path := (Move_Vectors.Empty_Vector with null record);


end Moves;