Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Добавлены примеры и команды перевода
- Loading branch information
ComdivByZero
authored and
ComdivByZero
committed
Jan 4, 2022
1 parent
ab67387
commit 54ec38f
Showing
6 changed files
with
184 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<!DOCTYPE html> | ||
<html lang='en'> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
|
||
<title>Vostok translator</title> | ||
|
||
<link rel='stylesheet' type='text/css' href='vostokbox.css'/> | ||
<script src='https://ajaxorg.github.io/ace-builds/src-min-noconflict/ace.js'></script> | ||
<script src='vostokbox.js'></script> | ||
</head> | ||
|
||
<body> | ||
|
||
<div style='width:1200px'> | ||
<div id='vostokbox-editor'>MODULE Queens; IMPORT Out; | ||
VAR | ||
solutionsCount, ln: INTEGER; | ||
x: ARRAY 8 OF INTEGER; | ||
a: ARRAY 8 OF BOOLEAN; | ||
b, c: ARRAY 15 OF BOOLEAN; | ||
|
||
PROCEDURE Write; VAR i: INTEGER; | ||
BEGIN | ||
FOR i := 0 TO LEN(x) - 1 DO Out.Int(x[i], 2) END; | ||
INC(ln); IF ln = 4 THEN Out.Ln; ln := 0 ELSE Out.String(" ") END | ||
END Write; | ||
|
||
PROCEDURE Init; VAR i: INTEGER; | ||
BEGIN | ||
FOR i := 0 TO LEN(a) - 1 DO a[i] := TRUE; x[i] := -1 END; | ||
FOR i := 0 TO LEN(b) - 1 DO b[i] := TRUE; c[i] := TRUE END; | ||
solutionsCount := 0; ln := 0 | ||
END Init; | ||
|
||
PROCEDURE Try(i: INTEGER); | ||
VAR j: INTEGER; | ||
BEGIN | ||
IF i < LEN(x) THEN | ||
FOR j := 0 TO LEN(x) - 1 DO | ||
IF a[j] & b[i + j] & c[i - j + 7] THEN | ||
x[i] := j; a[j] := FALSE; b[i + j] := FALSE; c[i - j + 7] := FALSE; | ||
Try(i + 1); | ||
x[i] := -1; a[j] := TRUE; b[i + j] := TRUE; c[i - j + 7] := TRUE | ||
END | ||
END | ||
ELSE | ||
Write; | ||
INC(solutionsCount) | ||
END | ||
END Try; | ||
|
||
PROCEDURE All*; | ||
BEGIN | ||
Init; | ||
Try(0); | ||
Out.String("Count of solutions: "); Out.Int(solutionsCount, 0); Out.Ln | ||
END All; | ||
|
||
END Queens.</div> | ||
|
||
<div id='vostokbox-log'></div> | ||
|
||
</div> | ||
|
||
<div id='vostokbox-runners'></div> | ||
|
||
<script> | ||
var box; | ||
|
||
box = VostokBox.createByDefaultIdentifiers(document, ace); | ||
VostokBox.addRootRunner(box, 'Queens.All'); | ||
VostokBox.addRunner(box, ':INFO'); | ||
VostokBox.addRunner(box, ':INFO log'); | ||
VostokBox.addRunner(box, ':LIST'); | ||
VostokBox.addRunner(box, ':TO-C'); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!DOCTYPE html> | ||
<html lang='en'> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
|
||
<title>Vostok translator</title> | ||
|
||
<link rel='stylesheet' type='text/css' href='vostokbox.css'/> | ||
<script src='https://ajaxorg.github.io/ace-builds/src-min-noconflict/ace.js'></script> | ||
<script src='vostokbox.js'></script> | ||
</head> | ||
|
||
<body> | ||
|
||
<div style='width:1200px'> | ||
<div id='vostokbox-editor'>MODULE InsertSort; IMPORT Out; | ||
|
||
PROCEDURE Write(a: ARRAY OF INTEGER); VAR i: INTEGER; | ||
BEGIN | ||
FOR i := 0 TO LEN(a) - 1 DO Out.Int(a[i], 0); Out.String(" ") END; Out.Ln | ||
END Write; | ||
|
||
PROCEDURE Sort*(VAR arr: ARRAY OF INTEGER); | ||
VAR i, j, a: INTEGER; | ||
BEGIN | ||
FOR i := 1 TO LEN(arr) - 1 DO | ||
a := arr[i]; | ||
j := i - 1; | ||
WHILE (j >= 0) & (a < arr[j]) DO | ||
arr[j + 1] := arr[j]; | ||
DEC(j) | ||
END; | ||
arr[j + 1] := a | ||
END | ||
END Sort; | ||
|
||
PROCEDURE Go*; | ||
VAR i: INTEGER; | ||
a: ARRAY 17 OF INTEGER; | ||
BEGIN | ||
FOR i := 0 TO LEN(a) - 1 DO a[i] := LEN(a) - i END; | ||
Write(a); | ||
Sort(a); | ||
Write(a) | ||
END Go; | ||
|
||
END InsertSort.</div> | ||
|
||
<div id='vostokbox-log'></div> | ||
|
||
</div> | ||
|
||
<div id='vostokbox-runners'></div> | ||
|
||
<script> | ||
var box; | ||
|
||
box = VostokBox.createByDefaultIdentifiers(document, ace); | ||
VostokBox.addRootRunner(box, 'InsertSort.Go'); | ||
VostokBox.addRunner(box, ':TO-C'); | ||
VostokBox.addRunner(box, ':TO-JAVA'); | ||
VostokBox.addRunner(box, ':TO-JS'); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters