-
Notifications
You must be signed in to change notification settings - Fork 0
/
Expressor.lpr
58 lines (52 loc) · 1.08 KB
/
Expressor.lpr
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
program Expressor;
uses
sysutils;
const
_Up = 1; // (bit 0)
_Right = 2; // (bit 1)
_Down = 4; // (bit 2)
_Left = 8; // (bit 3)
var
up, down, left, right : Boolean;
out_up,out_down,out_left,out_right : Boolean;
i,X : integer;
ZZ : Int64;
begin
ZZ := 00;
for i := 15 downto 0 do
begin
up := (i AND _Up) <> 0;
right := (i AND _right) <> 0;
down := (i AND _down) <> 0;
left := (i AND _left) <> 0;
// User stuff goes here
(*
out_up := right;
out_down := right;
if Up AND (Not Right) then
out_left := NOT Left
else
out_left := left;
out_right := right;
*)
(*
out_up := false;
out_down := false;
out_left := not left;
out_right := false;
*)
out_up := false;
out_down := left;
out_left := up;
out_right := right;
// back to normal stuff here
x := 0;
if out_up then inc(x,_up);
if out_down then inc(x,_down);
if out_left then inc(x,_left);
if out_right then inc(x,_right);
ZZ := (ZZ SHL 4) OR X;
end;
WriteLn('Result = ',IntToHex(ZZ,16));
ReadLn;
end.