HP Prime for All
English
Русский
Name | Game 15 |
Description | Game 15 |
Author | Vlad A.B. (Vlad_AB) |
Source code formatted by website engine
ICON resource lines were stripped.
BEGIN
U := TICKS;
S := 0;
RECT_P();
RECT_P(0, 0, 319, 239, RGB(0, 0, 128), RGB(0, 0, 128));
RECT_P(2, 2, 236, 236, RGB(0, 0, 128), RGB(0, 0, 128));
RECT_P(238, 2, 317, 118, RGB(0, 0, 255), RGB(125, 125, 125));
RECT_P(238, 120, 317, 236, RGB(0, 0, 255), RGB(125, 125, 125));
TEXTOUT_P("ХОДОВ:", G0, 243, 4, 6, RGB(0, 0, 0));
TEXTOUT_P("ВРЕМЯ:", G0, 243, 122, 6, RGB(0, 0, 0));
REPEAT
L0 := randperm(15);
UNTIL signature(L0) == 1;
M0 := list2mat(L0, 4);
M9 := transpose([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 0]]);
FOR J FROM 1 TO 4 DO
FOR I FROM 1 TO 4 DO
IF M0(I, J) ≠ 0 THEN
RECT_P(4+58 * (I-1), 4+58 * (J-1), 60+58 * (I-1), 60+58 * (J-1), #000000h, RGB(95, 95, 95));
RECT_P(14+58 * (I-1), 14+58 * (J-1), 50+58 * (I-1), 50+58 * (J-1), RGB(125, 125, 125), RGB(125, 125, 125));
TEXTOUT_P(M0(I, J), G0, 27-7*IP(LOG(M0(I, J))) + 58 * (I-1), 17+58 * (J-1), 7, RGB(0, 0, 0));
END;
END;
END;
A := 4;
B := 4;
REPEAT
REPEAT
L0 := MOUSE();
UNTIL STRING(L0) ≠ STRING({{}, {}});
REPEAT
UNTIL STRING(MOUSE()) == STRING({{}, {}});
L0(1, 1)▶X;
L0(1, 2)▶Y;
IF X ≥ 4 AND X ≤ 234 AND Y ≥ 4 AND Y ≤ 234 THEN
I := IP((X-4) / 58) + 1;
J := IP((Y-4) / 58) + 1;
IF (I == A AND ABS(J-B) == 1) OR (J == B AND ABS(I-A) == 1) THEN
S := S+1;
TEXTOUT_P(" ", G0, 243, 34, 6, RGB(125, 125, 125), 100, RGB(125, 125, 125));
TEXTOUT_P(S, G0, 243, 34, 6, RGB(0, 0, 0));
SUBGROB_P(G0, 4+58 * (A-1), 4+58 * (B-1), 61+58 * (A-1), 61+58 * (B-1), G1);
BLIT_P(G0, 4+58 * (A-1), 4+58 * (B-1), 61+58 * (A-1), 61+58 * (B-1), G0, 4+58 * (I-1), 4+58 * (J-1), 61+58 * (I-1), 61+5…
BLIT_P(G0, 4+58 * (I-1), 4+58 * (J-1), 61+58 * (I-1), 61+58 * (J-1), G1);
M0(A, B) := M0(I, J);
M0(I, J) := 0;
A := I;
B := J;
END;
END;
UNTIL M0 == M9;
V := TICKS;
TEXTOUT_P(IP((V-U) / 1000), G0, 243, 152, 6, RGB(0, 0, 0));
TEXTOUT_P("РЕШЕНО !", G0, 110, 110, 7, RGB(255, 255, 0));
WAIT(5);
END;