diff --git a/Lang/Ada/Sierpinski-triangle-Graphical b/Lang/Ada/Sierpinski-triangle-Graphical
new file mode 120000
index 0000000000..c5fb35984b
--- /dev/null
+++ b/Lang/Ada/Sierpinski-triangle-Graphical
@@ -0,0 +1 @@
+../../Task/Sierpinski-triangle-Graphical/Ada
\ No newline at end of file
diff --git a/Lang/AutoHotKey-V2/00-LANG.txt b/Lang/AutoHotKey-V2/00-LANG.txt
new file mode 100644
index 0000000000..a333f928af
--- /dev/null
+++ b/Lang/AutoHotKey-V2/00-LANG.txt
@@ -0,0 +1 @@
+{{stub}}{{language|AutoHotKey V2}}
\ No newline at end of file
diff --git a/Lang/AutoHotKey-V2/00-META.yaml b/Lang/AutoHotKey-V2/00-META.yaml
new file mode 100644
index 0000000000..316ebe0ccb
--- /dev/null
+++ b/Lang/AutoHotKey-V2/00-META.yaml
@@ -0,0 +1,2 @@
+---
+from: http://rosettacode.org/wiki/Category:AutoHotKey_V2
diff --git a/Lang/AutoHotKey-V2/Hello-world-Graphical b/Lang/AutoHotKey-V2/Hello-world-Graphical
new file mode 120000
index 0000000000..89783bc714
--- /dev/null
+++ b/Lang/AutoHotKey-V2/Hello-world-Graphical
@@ -0,0 +1 @@
+../../Task/Hello-world-Graphical/AutoHotKey-V2
\ No newline at end of file
diff --git a/Lang/Autohotkey-V2/00-LANG.txt b/Lang/Autohotkey-V2/00-LANG.txt
deleted file mode 100644
index b3e33b65ab..0000000000
--- a/Lang/Autohotkey-V2/00-LANG.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-{{stub}}AutoHotkey V2 is an [[open source]] programming language for Microsoft [[Windows]].
-
-AutoHotkey v2 is a major update to the AutoHotkey language, which includes numerous new features and improvements.
-
-== Citations ==
-
-* [https://www.autohotkey.com/docs/v2/ Documentation]
-* [http://autohotkey.com/download Downloads]
-* [http://autohotkey.com/docs/scripts/ Script Showcase]
-* [http://autohotkey.com/boards/ New Community forum]
-* [http://www.autohotkey.com/forum/ Archived Community forum]
-* [http://ahkscript.org/foundation AutoHotkey Foundation LLC]
-* [[wp:AutoHotkey|AutoHotkey on Wikipedia]]
-* #ahk on [http://webchat.freenode.net/?channels=%23ahk Freenode Web interface]
-* [[:Category:AutoHotkey_Originated]]
-{{language|Ayrch}}
\ No newline at end of file
diff --git a/Lang/Autohotkey-V2/00-META.yaml b/Lang/Autohotkey-V2/00-META.yaml
deleted file mode 100644
index 651d1bc21b..0000000000
--- a/Lang/Autohotkey-V2/00-META.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-from: http://rosettacode.org/wiki/Category:Autohotkey_V2
diff --git a/Lang/Autohotkey-V2/Hello-world-Graphical b/Lang/Autohotkey-V2/Hello-world-Graphical
deleted file mode 120000
index 0375a8eeb7..0000000000
--- a/Lang/Autohotkey-V2/Hello-world-Graphical
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Hello-world-Graphical/Autohotkey-V2
\ No newline at end of file
diff --git a/Lang/C++/Functional-coverage-tree b/Lang/C++/Functional-coverage-tree
new file mode 120000
index 0000000000..06e1a4bfaf
--- /dev/null
+++ b/Lang/C++/Functional-coverage-tree
@@ -0,0 +1 @@
+../../Task/Functional-coverage-tree/C++
\ No newline at end of file
diff --git a/Lang/C++/Ukkonen-s-suffix-tree-construction b/Lang/C++/Ukkonen-s-suffix-tree-construction
new file mode 120000
index 0000000000..3dffa49793
--- /dev/null
+++ b/Lang/C++/Ukkonen-s-suffix-tree-construction
@@ -0,0 +1 @@
+../../Task/Ukkonen-s-suffix-tree-construction/C++
\ No newline at end of file
diff --git a/Lang/Common-Lisp/Substitution-cipher b/Lang/Common-Lisp/Substitution-cipher
new file mode 120000
index 0000000000..332d90e9f0
--- /dev/null
+++ b/Lang/Common-Lisp/Substitution-cipher
@@ -0,0 +1 @@
+../../Task/Substitution-cipher/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Free-Pascal-Lazarus/Brilliant-numbers b/Lang/Free-Pascal-Lazarus/Brilliant-numbers
new file mode 120000
index 0000000000..07a95dbd77
--- /dev/null
+++ b/Lang/Free-Pascal-Lazarus/Brilliant-numbers
@@ -0,0 +1 @@
+../../Task/Brilliant-numbers/Free-Pascal-Lazarus
\ No newline at end of file
diff --git a/Lang/FreeBASIC/Metallic-ratios b/Lang/FreeBASIC/Metallic-ratios
new file mode 120000
index 0000000000..46551c0b17
--- /dev/null
+++ b/Lang/FreeBASIC/Metallic-ratios
@@ -0,0 +1 @@
+../../Task/Metallic-ratios/FreeBASIC
\ No newline at end of file
diff --git a/Lang/FreeBASIC/Percolation-Mean-cluster-density b/Lang/FreeBASIC/Percolation-Mean-cluster-density
new file mode 120000
index 0000000000..6d9dff89ca
--- /dev/null
+++ b/Lang/FreeBASIC/Percolation-Mean-cluster-density
@@ -0,0 +1 @@
+../../Task/Percolation-Mean-cluster-density/FreeBASIC
\ No newline at end of file
diff --git a/Lang/FreeBASIC/Web-scraping b/Lang/FreeBASIC/Web-scraping
new file mode 120000
index 0000000000..ef3ee370f4
--- /dev/null
+++ b/Lang/FreeBASIC/Web-scraping
@@ -0,0 +1 @@
+../../Task/Web-scraping/FreeBASIC
\ No newline at end of file
diff --git a/Lang/FutureBasic/ADFGVX-cipher b/Lang/FutureBasic/ADFGVX-cipher
new file mode 120000
index 0000000000..e5f0c8a31e
--- /dev/null
+++ b/Lang/FutureBasic/ADFGVX-cipher
@@ -0,0 +1 @@
+../../Task/ADFGVX-cipher/FutureBasic
\ No newline at end of file
diff --git a/Lang/FutureBasic/Damm-algorithm b/Lang/FutureBasic/Damm-algorithm
new file mode 120000
index 0000000000..1a53ae4466
--- /dev/null
+++ b/Lang/FutureBasic/Damm-algorithm
@@ -0,0 +1 @@
+../../Task/Damm-algorithm/FutureBasic
\ No newline at end of file
diff --git a/Lang/FutureBasic/Magic-constant b/Lang/FutureBasic/Magic-constant
new file mode 120000
index 0000000000..1b88b55f67
--- /dev/null
+++ b/Lang/FutureBasic/Magic-constant
@@ -0,0 +1 @@
+../../Task/Magic-constant/FutureBasic
\ No newline at end of file
diff --git a/Lang/Haskell/Mouse-position b/Lang/Haskell/Mouse-position
new file mode 120000
index 0000000000..842d59376f
--- /dev/null
+++ b/Lang/Haskell/Mouse-position
@@ -0,0 +1 @@
+../../Task/Mouse-position/Haskell
\ No newline at end of file
diff --git a/Lang/M2000-Interpreter/Averages-Root-mean-square b/Lang/M2000-Interpreter/Averages-Root-mean-square
new file mode 120000
index 0000000000..226fa9019d
--- /dev/null
+++ b/Lang/M2000-Interpreter/Averages-Root-mean-square
@@ -0,0 +1 @@
+../../Task/Averages-Root-mean-square/M2000-Interpreter
\ No newline at end of file
diff --git a/Lang/M2000-Interpreter/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols b/Lang/M2000-Interpreter/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols
new file mode 120000
index 0000000000..85569db69f
--- /dev/null
+++ b/Lang/M2000-Interpreter/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols
@@ -0,0 +1 @@
+../../Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/M2000-Interpreter
\ No newline at end of file
diff --git a/Lang/PascalABC.NET/Fivenum b/Lang/PascalABC.NET/Fivenum
new file mode 120000
index 0000000000..ef9246e91a
--- /dev/null
+++ b/Lang/PascalABC.NET/Fivenum
@@ -0,0 +1 @@
+../../Task/Fivenum/PascalABC.NET
\ No newline at end of file
diff --git a/Lang/PascalABC.NET/Fork b/Lang/PascalABC.NET/Fork
new file mode 120000
index 0000000000..21f23b18c9
--- /dev/null
+++ b/Lang/PascalABC.NET/Fork
@@ -0,0 +1 @@
+../../Task/Fork/PascalABC.NET
\ No newline at end of file
diff --git a/Lang/PascalABC.NET/Gamma-function b/Lang/PascalABC.NET/Gamma-function
new file mode 120000
index 0000000000..d0d1bc1bed
--- /dev/null
+++ b/Lang/PascalABC.NET/Gamma-function
@@ -0,0 +1 @@
+../../Task/Gamma-function/PascalABC.NET
\ No newline at end of file
diff --git a/Lang/Plain-English/00-LANG.txt b/Lang/Plain-English/00-LANG.txt
index d3044419f6..879e8b69bc 100644
--- a/Lang/Plain-English/00-LANG.txt
+++ b/Lang/Plain-English/00-LANG.txt
@@ -31,7 +31,12 @@ It is both.
There is NO complete source code in another language; the system was bootstrapped in a Pascal-like language (which is no longer available) and was later re-written entirely in Plain English.
It is "Machine Code" Low Level: The bootstrap is very basic, only able to copy itself and add raw machine code in Intel hex format, make calls to the operating system, e.g.
-Call "kernel32.dll" "SetFilePointer" with the file and 0 and 0 and 2 [file_end] returning a result number.
+Call "kernel32.dll" "SetFilePointer" with
+ the file [hFile]
+ and 0 [lDistanceToMove]
+ and 0 [lpDistanceToMoveHigh]
+ and 2 [file_end / dwMoveMethod]
+ returning a result number.
and call other DLLs e.g.
diff --git a/Lang/Ring/Brilliant-numbers b/Lang/Ring/Brilliant-numbers
new file mode 120000
index 0000000000..4e2621cdb9
--- /dev/null
+++ b/Lang/Ring/Brilliant-numbers
@@ -0,0 +1 @@
+../../Task/Brilliant-numbers/Ring
\ No newline at end of file
diff --git a/Lang/Ring/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k b/Lang/Ring/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k
new file mode 120000
index 0000000000..cd105cb2cf
--- /dev/null
+++ b/Lang/Ring/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k
@@ -0,0 +1 @@
+../../Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/Ring
\ No newline at end of file
diff --git a/Lang/Ring/Selectively-replace-multiple-instances-of-a-character-within-a-string b/Lang/Ring/Selectively-replace-multiple-instances-of-a-character-within-a-string
new file mode 120000
index 0000000000..238083a2d3
--- /dev/null
+++ b/Lang/Ring/Selectively-replace-multiple-instances-of-a-character-within-a-string
@@ -0,0 +1 @@
+../../Task/Selectively-replace-multiple-instances-of-a-character-within-a-string/Ring
\ No newline at end of file
diff --git a/Lang/S-BASIC/Real-constants-and-functions b/Lang/S-BASIC/Real-constants-and-functions
new file mode 120000
index 0000000000..dd7abd08ca
--- /dev/null
+++ b/Lang/S-BASIC/Real-constants-and-functions
@@ -0,0 +1 @@
+../../Task/Real-constants-and-functions/S-BASIC
\ No newline at end of file
diff --git a/Lang/SmileBASIC/Execute-Brain- b/Lang/SmileBASIC/Execute-Brain-
new file mode 120000
index 0000000000..f5b6561ddd
--- /dev/null
+++ b/Lang/SmileBASIC/Execute-Brain-
@@ -0,0 +1 @@
+../../Task/Execute-Brain-/SmileBASIC
\ No newline at end of file
diff --git a/Lang/Tcl/Character-codes b/Lang/Tcl/Character-codes
deleted file mode 120000
index 3f7702eaa9..0000000000
--- a/Lang/Tcl/Character-codes
+++ /dev/null
@@ -1 +0,0 @@
-../../Task/Character-codes/Tcl
\ No newline at end of file
diff --git a/Task/100-doors/Plain-English/100-doors.plain b/Task/100-doors/Plain-English/100-doors.plain
index 809fe08e73..056c6f1ec1 100644
--- a/Task/100-doors/Plain-English/100-doors.plain
+++ b/Task/100-doors/Plain-English/100-doors.plain
@@ -1,52 +1,54 @@
To create some doors given a count:
-Loop.
-If a counter is past the count, exit.
-Allocate memory for a door.
-Clear the door's flag.
-Append the door to the doors.
-Repeat.
+ Loop.
+ If a counter is past the count, exit.
+ Allocate memory for a door.
+ Clear the door's flag.
+ Append the door to the doors.
+ Repeat.
A flag thing is a thing with a flag.
A door is a flag thing.
To go through some doors given a number and some passes:
-Put 0 into a counter.
-Loop.
-Add the number to the counter.
-If the counter is greater than the passes, exit.
-Pick a door from the doors given the number.
-Invert the door's flag.
-Repeat.
+ Put 0 into a counter.
+ Loop.
+ Add the number to the counter.
+ If the counter is greater than the passes, exit.
+ Pick a door from the doors given the number.
+ Invert the door's flag.
+ Repeat.
To output the states of some doors:
-Loop.
-Bump a counter.
-Get a door from the doors.
-If the door is nil, exit.
-If the door's flag is set, write "Door " then the counter then " is open" to the output; repeat.
-Write "Door " then the counter then " is closed" to the output.
-Repeat.
+ Loop.
+ Bump a counter.
+ Get a door from the doors.
+ If the door is nil, exit.
+ If the door's flag is set,
+ Write "Door " then the counter then " is open" to the output;
+ Repeat.
+ Write "Door " then the counter then " is closed" to the output.
+ Repeat.
To pass doors given a count and some passes:
-Create some doors given the count.
-Loop.
-If a counter is past the passes, break.
-Go through the doors given the counter and the passes.
-Repeat.
-Output the states of the doors.
-Destroy the doors.
+ Create some doors given the count.
+ Loop.
+ If a counter is past the passes, break.
+ Go through the doors given the counter and the passes.
+ Repeat.
+ Output the states of the doors.
+ Destroy the doors.
A pass is a number.
To pick a door from some doors given a number:
-Loop.
-If a counter is past the number, exit.
-Get the door from the doors.
-If the door is nil, exit.
-Repeat.
+ Loop.
+ If a counter is past the number, exit.
+ Get the door from the doors.
+ If the door is nil, exit.
+ Repeat.
To run:
-Start up.
-Pass doors given 100 and 100 passes.
-Wait for the escape key.
-Shut down.
+ Start up.
+ Pass doors given 100 and 100 passes.
+ Wait for the escape key.
+ Shut down.
diff --git a/Task/99-bottles-of-beer/Plain-English/99-bottles-of-beer.plain b/Task/99-bottles-of-beer/Plain-English/99-bottles-of-beer.plain
index 65fd694264..871d7a9918 100644
--- a/Task/99-bottles-of-beer/Plain-English/99-bottles-of-beer.plain
+++ b/Task/99-bottles-of-beer/Plain-English/99-bottles-of-beer.plain
@@ -1,26 +1,32 @@
To run:
-Start up.
-Sing 99 of bottles of beer on the wall.
-Wait for the escape key.
-Shut down.
+ Start up.
+ Sing 99 of bottles of beer on the wall.
+ Wait for the escape key.
+ Shut down.
To sing a number of bottles of beer on the wall:
-Put the number into a counter.
-Loop.
-Write the first line given the counter.
-Write the second line given the counter.
-Write "Take one down, pass it around" to the console.
-Subtract 1 from the counter.
-Write the first line given the counter.
-If the counter is 0, break.
-Write "" on the console.
-Repeat.
+ Put the number into a counter.
+ Loop.
+ Write the first line given the counter.
+ Write the second line given the counter.
+ Write "Take one down, pass it around" to the console.
+ Subtract 1 from the counter.
+ Write the first line given the counter.
+ If the counter is 0, break.
+ Write "" on the console.
+ Repeat.
To write the first line given a counter:
-If the counter is 0, write "No more bottles of beer on the wall" to the console; exit.
-If the counter is 1, write "1 bottle of beer on the wall" to the console; exit.
-Write the counter then " bottles of beer on the wall" to the console.
+ If the counter is 0,
+ Write "No more bottles of beer on the wall" to the console;
+ Exit.
+ If the counter is 1,
+ Write "1 bottle of beer on the wall" to the console;
+ Exit.
+ Write the counter then " bottles of beer on the wall" to the console.
To write the second line given a counter:
-If the counter is 1, write "1 bottle of beer" to the console; exit.
-Write the counter then " bottles of beer" to the console.
+ If the counter is 1,
+ Write "1 bottle of beer" to the console;
+ Exit.
+ Write the counter then " bottles of beer" to the console.
diff --git a/Task/A+B/Plain-English/a+b.plain b/Task/A+B/Plain-English/a+b.plain
index 92c92ca2e1..01ffffe01a 100644
--- a/Task/A+B/Plain-English/a+b.plain
+++ b/Task/A+B/Plain-English/a+b.plain
@@ -1,17 +1,21 @@
To run:
-Start up.
-Read a number from the console.
-Read another number from the console.
-Output the sum of the number and the other number.
-Wait for the escape key.
-Shut down.
+ Start up.
+ Read a number from the console.
+ Read another number from the console.
+ Output the sum of the number and the other number.
+ Wait for the escape key.
+ Shut down.
To output the sum of a number and another number:
-If the number is not valid, write "Invalid input" to the console; exit.
-If the other number is not valid, write "Invalid input" to the console; exit.
-Write the number plus the other number then " is the sum." to the console.
+ If the number is not valid,
+ Write "Invalid input" to the console;
+ Exit.
+ If the other number is not valid,
+ Write "Invalid input" to the console;
+ Exit.
+ Write the number plus the other number then " is the sum." to the console.
To decide if a number is valid:
-If the number is not greater than or equal to -1000, say no.
-If the number is not less than or equal to 1000, say no.
-Say yes.
+ If the number is not greater than or equal to -1000, say no.
+ If the number is not less than or equal to 1000, say no.
+ Say yes.
diff --git a/Task/ADFGVX-cipher/FutureBasic/adfgvx-cipher.basic b/Task/ADFGVX-cipher/FutureBasic/adfgvx-cipher.basic
new file mode 100644
index 0000000000..3cbb6a7960
--- /dev/null
+++ b/Task/ADFGVX-cipher/FutureBasic/adfgvx-cipher.basic
@@ -0,0 +1,208 @@
+/*
+ADFGVX cipher
+https://rosettacode.org/wiki/ADFGVX_cipher
+
+Requires file, unixdict.txt to be on the desktop
+https://github.com/quinnj/Rosetta-Julia/blob/master/unixdict.txt
+
+*/
+
+begin globals
+
+ str255 ADFGVX
+ ADFGVX = "ADFGVX"
+ str255 ALPHABET
+ ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+
+end globals
+
+local fn InitialisePolybiusSquare As str255
+ short i, j
+
+ str255 letters(36)
+ For i = 0 To 35
+ letters(i) = Mid$(ALPHABET, i + 1, 1)
+ Next
+
+ For i = 0 To 35
+ j = Int(rnd (36))
+ Swap letters(i), letters(j)
+ Next
+
+ short row, column
+ str255 result
+ result = ""
+ For row = 0 To 5
+ For column = 0 To 5
+ result = result + letters(6 * row + column)
+ Next
+ Next
+
+End fn = result
+
+local fn CreateKey(size As short) As str255
+ If size < 7 Or size > 12
+ Print "Key should contain between 7 and 12 letters, both inclusive."
+ Exit fn
+ End If
+
+ short i, j
+ str255 TheWord, candidates(1000)
+ short ff = 1 // file number
+
+ short CandidatesCounter = 1
+
+ CFUrlRef ParentDirectory = fn FileManagerURLForDirectory( NSDesktopDirectory, NSUserDomainMask )
+ CFUrlRef UnixDictURL = fn URLByAppendingPathComponent( ParentDirectory, @"unixdict.txt" )
+
+
+ Open "I",ff, UnixDictURL
+ While Eof(ff) = 0
+ Line Input #ff, TheWord
+
+ str255 uniqueWord
+ uniqueWord = ""
+ For i = 1 To Len$(TheWord)
+ If Instr$(1,uniqueWord, Mid$(TheWord, i, 1)) = 0
+ uniqueWord = uniqueWord + Mid$(TheWord, i, 1)
+ End If
+ Next
+
+ If Len$(TheWord) = size && Len$(TheWord) = Len$(uniqueWord)
+ TheWord = Ucase$(TheWord)
+
+ bool isAlphanum = _true
+ For i = 1 To Len$(TheWord)
+ If (Mid$(TheWord, i, 1) < "A" && Mid$(TheWord, i, 1) <= "Z") && (Mid$(TheWord, i, 1) < "0" && Mid$(TheWord, i, 1) <= "9")
+ isAlphanum = _false
+ Exit For
+ End If
+ Next
+
+
+ If isAlphanum
+ //Redim Preserve candidates(Ubound(candidates) + 1)
+ CandidatesCounter ++
+ candidates(CandidatesCounter) = TheWord
+ End If
+ End If
+ Wend
+ Close #ff
+
+
+
+ For i = 0 To CandidatesCounter
+ j = Int(Rnd (CandidatesCounter + 1))
+ Swap candidates(i), candidates(j)
+ Next
+
+End fn = candidates(0)
+
+local fn Encrypt(plainText As str255, polybius As str255, key As str255) As str255
+ short i, j, row, column
+ str255 code, ch, encrypted
+
+ code = ""
+ For i = 1 To Len$(plainText)
+ ch = Mid$(plainText, i, 1)
+ For row = 0 To 5
+ For column = 0 To 5
+ If Mid$(polybius, row * 6 + column + 1, 1) = ch
+ code = code + Mid$(ADFGVX, row + 1, 1)
+ code = code + Mid$(ADFGVX, column + 1, 1)
+ End If
+ Next
+ Next
+ Next
+
+ encrypted = ""
+ For i = 1 To Len$(key)
+ ch = Mid$(key, i, 1)
+ For j = Instr$(1,key, ch) - 1 To Len$(code) - 1 Step Len$(key)
+ encrypted = encrypted + Mid$(code, j + 1, 1)
+ Next
+ encrypted = encrypted + " "
+ Next
+
+
+End fn = encrypted
+
+local fn Decrypt(encryptedText As str255, polybius As str255, key As str255) As str255
+ short i, j, row, column, spaceCount, codeSize
+ str255 result, stream, TheWord, code, plainText
+ str255 blocks(200)
+ short BlocksCounter = 1
+ result = ""
+ i = 1
+ While i <= Len$(encryptedText)
+ If Mid$(encryptedText, i, 1) = " "
+ i += 1
+ Else
+ result += Mid$(encryptedText, i, 1)
+ i += 1
+ End If
+ Wend
+ spaceCount = Len$(encryptedText) - Len$(result)
+ codeSize = Len$(encryptedText) - spaceCount
+
+
+ stream = encryptedText
+ While Len$(stream) > 0
+ TheWord = Left$(stream, Instr$(1,stream, " ") - 1)
+ //Redim Preserve blocks(Ubound(blocks) + 1)
+ BlocksCounter ++
+ blocks(BlocksCounter) = TheWord
+ stream = Mid$(stream, Instr$(1,stream, " ") + 1)
+ Wend
+
+ code = ""
+ For i = 0 To codeSize - 1
+ BlocksCounter ++
+ For j = 0 To BlocksCounter
+ If Len$(code) < codeSize Then code = code + Mid$(blocks(j), i + 1, 1)
+ Next
+ Next
+
+ plainText = ""
+ For i = 1 To codeSize - 1 Step 2
+ row = Instr$(1,ADFGVX, Mid$(code, i, 1)) - 1
+ column = Instr$(1,ADFGVX, Mid$(code, i + 1, 1)) - 1
+ plainText = plainText + Mid$(polybius, row * 6 + column + 1, 1)
+ Next
+
+
+End fn = plainText
+
+str255 polybius
+polybius = fn InitialisePolybiusSquare
+Print "The 6 x 6 Polybius square:"
+Print " | A D F G V X"
+Print "--------------"
+short row
+For row = 0 To 5
+ Print Mid$(ADFGVX, row + 1, 1); "|";
+ short column
+ For column = 0 To 5
+ Print " "; Mid$(polybius, row * 6 + column + 1, 1);
+ Next
+ Print
+Next
+
+str255 key
+key = fn CreateKey(9)
+print
+Print "The key is "; key
+str255 plainText
+plainText = "ATTACKAT1200AM"// 20241105
+print
+Print "Plain text: "; plainText
+str255 encryptedText
+encryptedText = fn Encrypt(plainText, polybius, key)
+print
+Print "Encrypted: "; encryptedText
+str255 decryptedText
+decryptedText = fn Decrypt(encryptedText, polybius, key)
+print
+Print "Decrypted: "; decryptedText
+
+handleevents
diff --git a/Task/Anonymous-recursion/M2000-Interpreter/anonymous-recursion.m2000 b/Task/Anonymous-recursion/M2000-Interpreter/anonymous-recursion.m2000
index 136375bb73..474df780fa 100644
--- a/Task/Anonymous-recursion/M2000-Interpreter/anonymous-recursion.m2000
+++ b/Task/Anonymous-recursion/M2000-Interpreter/anonymous-recursion.m2000
@@ -1,4 +1,30 @@
-module Anonymus_lambda {
- Print lambda (x as long long)->{=If(x>1->lambda(x-1)+lambda(x-2), x)}(10)=55
+Module Anonymus_lambda (x, result){
+ global Err = lambda (x) ->{
+ if x=1 then Error "Negative input"
+ }
+ ' in one line - so Error have to call it through a global function
+ Print lambda (x as long long)->{=if(x<0->Err(1), lambda (x)->{=If(x>1->lambda(x-1)+lambda(x-2), x)}(x))}(x)=result
}
-Anonymus_Lambda
+Anonymus_Lambda 10, 55
+Anonymus_Lambda 7, 13
+Try Ok {
+ Anonymus_Lambda -7, 13 ' return false, and also we have error
+ ' so here we exit from block - no printing "nothing"
+ Print "nothing"
+}
+If error or not ok then Report Error$
+Module Anonymus_lambda (x, result){
+ ' Using multiple lines for the Lambda - so Error can be used here
+ Print lambda (x as long long)->{
+ if x<0 then Error "Negative input"
+ =lambda (x)->{=If(x>1->lambda(x-1)+lambda(x-2), x)}(x)
+ }(x)=result
+}
+Anonymus_Lambda 10, 55
+Anonymus_Lambda 7, 13
+Try Ok {
+ Anonymus_Lambda -7, 13 ' nothing return we have error
+ ' so here we exit from block - no printing "nothing"
+ Print "nothing"
+}
+If error or not ok then Report Error$
diff --git a/Task/Averages-Root-mean-square/M2000-Interpreter/averages-root-mean-square.m2000 b/Task/Averages-Root-mean-square/M2000-Interpreter/averages-root-mean-square.m2000
new file mode 100644
index 0000000000..34c8374f45
--- /dev/null
+++ b/Task/Averages-Root-mean-square/M2000-Interpreter/averages-root-mean-square.m2000
@@ -0,0 +1,16 @@
+Module TestThis {
+ Locale 1033 ' this choose dot for decimals
+ feed=lambda m=1->{=m:m++}
+ fold1=lambda (a, s)->{push a*a+s}
+
+ feed1=feed
+ Dim Vector1(1 To 10) As Single< Uint64|i> 13
+ wheelprimes: array[0..15] of byte;
+ wheelSize, wpno, pr, pw, i, k: longword;
+ begin
+ pr := 1;
+ primes[1] := 1;
+ WheelSize := 1;
+ wpno := 0;
+ repeat
+ Inc(pr);
+ pw := pr;
+ if pw > wheelsize then
+ Dec(pw, wheelsize);
+ if Primes[pw]<>0 then
+ begin
+ k := WheelSize + 1;
+ for i := 1 to pr - 1 do
+ begin
+ Inc(k, WheelSize);
+ if k < High(primes) then
+ move(primes[1], primes[k - WheelSize], WheelSize)
+ else
+ begin
+ move(primes[1], primes[k - WheelSize], High(primes) - WheelSize * i);
+ break;
+ end;
+ end;
+ Dec(k);
+ if k > High(primes) then
+ k := High(primes);
+ wheelPrimes[wpno] := pr;
+ primes[pr] := 0;
+
+ i := sqr(pr);
+ while i <= k do
+ begin
+ primes[i] := 0;
+ Inc(i, pr);
+ end;
+
+ Inc(wpno);
+ WheelSize := k;
+ end;
+ until WheelSize >= High(primes);
+ while wpno > 0 do
+ begin
+ Dec(wpno);
+ primes[wheelPrimes[wpno]] := 1;
+ end;
+ Result := pr;
+ end;
+
+ procedure Sieve(var primes: tPrimeDelta);
+ var
+ pPrime: pUint8;
+ sieveprime, delFact: longword;
+ begin
+ sieveprime := BuildWheel(primes);
+ pPrime := @primes[0];
+ repeat
+ repeat
+ Inc(sieveprime);
+ until pPrime[sieveprime]<>0;
+ delFact := High(primes) div sieveprime;
+ if delFact < sieveprime then
+ BREAK;
+ inc(delFact);
+ repeat
+ repeat
+ Dec(delFact);
+ until pPrime[delFact]<>0;
+ pPrime[sieveprime * delFact] := 0;
+ until delFact < sieveprime;
+ until False;
+ primes[1] := 0;
+ end;
+
+ procedure GetPrimeDelta(var prD:tPrimeDelta;size: int32);
+ var
+ pPD : pUint8;
+ idx,LastP,p : Uint32;
+ Begin
+ setlength(prD, 0);
+ setlength(prD, size + 1);
+ Sieve(prD);
+ pPD := @prD[0];
+ idx := 0;
+ LastP := 0;
+ p := 0;
+ repeat
+ if pPD[p] <> 0 then
+ begin
+ pPD[idx] := p-LastP;
+ LastP := p;
+ inc(idx);
+ end;
+ inc(p);
+ until p> Size;
+ Setlength(prD,idx);
+ end;
+
+ function Cnt_First_DgtCnt(pPD:pUint8;lmt:UInt64;dgtCnt: Int32):nativeUint;
+ //counting products of prime factors smaller than limit
+ var
+ pLo,pHi,iLo,iHi : UInt64;
+ begin
+ with BrilliantPos[dgtCnt] do
+ begin
+ pLo := pMin;
+ iLO := MinIdx;
+ pHi := pMid;
+ iHi := MidIdx;
+ end;
+ result := iHi-iLo+1;
+ repeat
+ iLo+=1;
+ pLO := pLo+pPD[iLo];
+ if pLo = pHi then
+ begin
+ if sqr(pLo) < Lmt then
+ pLO := pLo+pPD[iLo+1];
+ OddPowP := pLo;
+ EXIT(result+1);
+ end;
+ while (pHi >= pLo) AND (pHi*pLo > lmt) do
+ begin
+ pHi := pHi-pPD[iHi];
+ iHi-=1;
+ end;
+ result += iHi-iLo+1;
+ until (pHi < pLo);
+ OddPowP := pLo;
+ end;
+
+ procedure GetLimitPos(pPD:pUint8;MaxPrIdx:NativeUint);
+ var
+ lmt, p,pmin,idx1,dgtCnt : nativeuint;
+ DeltaMax,DeltaMin,TotCnt: Uint64;
+ begin
+ lmt := 10;
+ p := 0;
+ idx1 := 0;
+ dgtCnt := 0;
+ TotCnt := 0;
+ p += pPD[idx1];
+ repeat
+ BrilliantPos[dgtCnt].pMin:= p;
+ BrilliantPos[dgtCnt].MinIdx := idx1;
+ write('10^',2*dgtCnt+1:2,':',p:10);
+ pMin := p;
+ while (pMin*p < lmt) and (idx1 < MaxPrIdx) do
+ begin
+ idx1 += 1;
+ p += pPD[idx1];
+ end;
+ pMin := p-pPD[idx1];
+ BrilliantPos[dgtCnt].pMid := pMin;
+ BrilliantPos[dgtCnt].MidIdx := idx1-1;
+ DeltaMin := Cnt_First_DgtCnt(pPD,lmt,dgtCnt);
+ writeln(DeltaMin:20,TotCnt+DeltaMin:20);
+ lmt *=10;
+ while (p*p <= lmt) AND (idx1 < MaxPrIdx) do
+ begin
+ idx1 += 1;
+ p += pPD[idx1];
+ end;
+ pMin := p-pPD[idx1];
+ BrilliantPos[dgtCnt].pMax := pMin;
+ BrilliantPos[dgtCnt].MaxIdx := idx1-1;
+
+ //for both decimals just summation formula
+ deltaMax := idx1-BrilliantPos[dgtCnt].MinIdx;
+ deltaMax := (deltaMax*(deltaMax+1) DIV 2);
+ TotCnt += deltaMax;
+ write('10^',2*dgtCnt+2:2,':',OddPowP:10);
+ writeln(DeltaMax-DeltaMin:20,TotCnt:20);
+ dgtCnt += 1;
+ lmt*=10;
+ until (idx1 >= MaxPrIdx) or(lmt>sqr(MaxRoot));
+ writeln(p:16);
+ end;
+
+var
+ primeDelta :TprimeDelta;
+ T : INt64;
+ pPD : pUint8;
+begin
+ T := GetTickCount64;
+ GetPrimeDelta(primeDelta,MaxRoot);
+ Writeln('Sieving in ',GetTickCount64-T,' ms');
+ T := GetTickCount64;
+ pPD := @primeDelta[0];
+// 10^ 1: 2 3 3
+ writeln('Limit first prime deltaCount Total Count');
+ GetLimitPos(pPD,High(primeDelta));
+ Writeln('Counting in ',GetTickCount64-T,' ms');
+ {$IFDEF WINDOWS}
+ readln;
+ {$ENDIF}
+end.
diff --git a/Task/Brilliant-numbers/Ring/brilliant-numbers.ring b/Task/Brilliant-numbers/Ring/brilliant-numbers.ring
new file mode 100644
index 0000000000..c0cfd8d11c
--- /dev/null
+++ b/Task/Brilliant-numbers/Ring/brilliant-numbers.ring
@@ -0,0 +1,126 @@
+load "stdlib.ring"
+
+n = 0
+num = 0
+flag = 0
+Result = []
+while true
+ n = n + 1
+ deco = []
+ prime = n
+ decomp1(deco,prime)
+ decomp2()
+ decomp3()
+ if flag = 1
+ add(Result,prime)
+ if num = 100
+ exit
+ ok
+ ok
+end
+
+for n = 1 to len(Result)
+ if len(string(Result[n])) = 1
+ see " " + Result[n]
+ ok
+ if len(string(Result[n])) = 2
+ see " " + Result[n]
+ ok
+ if len(string(Result[n])) = 3
+ see " " + Result[n]
+ ok
+ if len(string(Result[n])) = 4
+ see " " + Result[n]
+ ok
+ if n%10 = 0
+ see nl
+ ok
+next
+
+n = 0
+num = 0
+flag = 0
+Sem = List(6)
+for s = 1 to len(Sem)
+ Sem[s] = 1
+next
+Latin = []
+Result = []
+while true
+ n = n + 1
+ deco = []
+ prime = n
+ decomp1(deco,prime)
+ decomp2()
+ decomp3()
+ if flag = 1
+ add(Result,prime)
+ if prime > pow(10,6)
+ for p = 1 to len(Result)
+ if Result[p] > pow(10,1) and Sem[1] = 1
+ see "" + Result[p] + " is a brilliant number: " + p + nl
+ Sem[1] = 0
+ ok
+
+ if Result[p] > pow(10,2) and Sem[2] = 1
+ see "" + Result[p] + " is a brilliant number: " + p + nl
+ Sem[2] = 0
+ ok
+
+ if Result[p] > pow(10,3) and Sem[3] = 1
+ see "" + Result[p] + " is a brilliant number: " + p + nl
+ Sem[3] = 0
+ ok
+
+ if Result[p] > pow(10,4) and Sem[4] = 1
+ see "" + Result[p] + " is a brilliant number: " + p + nl
+ Sem[4] = 0
+ ok
+
+ if Result[p] > pow(10,5) and Sem[5] = 1
+ see "" + Result[p] + " is a brilliant number: " + p + nl
+ Sem[5] = 0
+ ok
+ if Result[p] > pow(10,6) and Sem[6] = 1
+ see "" + Result[p] + " is a brilliant number: " + p + nl
+ Sem[6] = 0
+ ok
+ next
+ ok
+ ok
+end
+
+func decomp1(deco,nr)
+x = ""
+for i = 1 to nr
+ if isPrime(i) and nr % i = 0
+ add(deco,i)
+ ok
+next
+
+func decomp2()
+while true
+ pro = 1
+ for n = 1 to len(deco)
+ pro = pro * deco[n]
+ next
+ if pro != prime
+ temp = prime/pro
+ decomp1(deco,temp)
+ else
+ exit
+ ok
+end
+
+func decomp3()
+ deco = sort(deco)
+ if len(deco) = 2 and prime = deco[1] * deco[2] and
+ len(string(deco[1])) = len(string(deco[2]))
+ num = num + 1
+ flag = 1
+ else
+ flag = 0
+ ok
+ if flag = 1
+ return num
+ ok
diff --git a/Task/Character-codes/Tcl/character-codes.tcl b/Task/Character-codes/Tcl/character-codes.tcl
deleted file mode 100644
index 949c5ff094..0000000000
--- a/Task/Character-codes/Tcl/character-codes.tcl
+++ /dev/null
@@ -1,6 +0,0 @@
-# ASCII
-puts [scan "a" %c] ;# ==> 97
-puts [format %c 97] ;# ==> a
-# Unicode is the same
-puts [scan "π" %c] ;# ==> 960
-puts [format %c 960] ;# ==> π
diff --git a/Task/Chinese-zodiac/APL/chinese-zodiac.apl b/Task/Chinese-zodiac/APL/chinese-zodiac.apl
index dee5c185b8..4887250e1c 100644
--- a/Task/Chinese-zodiac/APL/chinese-zodiac.apl
+++ b/Task/Chinese-zodiac/APL/chinese-zodiac.apl
@@ -1,14 +1,14 @@
-hanzi ← '甲' '乙' '丙' '丁' '戊' '己' '庚' '辛' '壬' '癸' '子' '丑' '寅' '卯' '辰' '巳' '午' '未' '申' '酉' '戌' '亥'
-pinyin ← 'jiă' 'yĭ' 'bĭng' 'dīng' 'wù' 'jĭ' 'gēng' 'xīn' 'rén' 'gŭi' 'zĭ' 'chŏu' 'yín' 'măo' 'chén' 'sì' 'wŭ' 'wèi' 'shēn' 'yŏu' 'xū' 'hài'
-
-pinyinFor ← { pinyin /⍨ ⍵ ⍷ hanzi }
-
stems ← '甲' '乙' '丙' '丁' '戊' '己' '庚' '辛' '壬' '癸'
branches ← '子' '丑' '寅' '卯' '辰' '巳' '午' '未' '申' '酉' '戌' '亥'
animals ← 'Rat' 'Ox' 'Tiger' 'Rabbit' 'Dragon' 'Snake' 'Horse' 'Goat' 'Monkey' 'Rooster' 'Dog' 'Pig'
elements ← 'Wood' 'Fire' 'Earth' 'Metal' 'Water'
aspects ← 'yang' 'yin'
+hanzi ← stems, branches
+pinyin ← 'jiă' 'yĭ' 'bĭng' 'dīng' 'wù' 'jĭ' 'gēng' 'xīn' 'rén' 'gŭi', 'zĭ' 'chŏu' 'yín' 'măo' 'chén' 'sì' 'wŭ' 'wèi' 'shēn' 'yŏu' 'xū' 'hài'
+
+pinyinFor ← { pinyin /⍨ ⍵ ⍷ hanzi }
+
position ← { 1 + 60 | ⍵ - 4 }
item ← { ⍺ ⌷⍨ 1 + (≢⍺) | 1 -⍨ position ⍵ }
celestial ← { stems item ⍵ }
diff --git a/Task/Chinese-zodiac/M2000-Interpreter/chinese-zodiac.m2000 b/Task/Chinese-zodiac/M2000-Interpreter/chinese-zodiac.m2000
index a52a64aef0..00ccd0a271 100644
--- a/Task/Chinese-zodiac/M2000-Interpreter/chinese-zodiac.m2000
+++ b/Task/Chinese-zodiac/M2000-Interpreter/chinese-zodiac.m2000
@@ -1,13 +1,14 @@
module Chinese_zodiac {
yy= ("yang", "yin")
- elements = ("Wood", "Fire", "Earth", "Metal", "Water")
+ elements = ("Metal", "Water", "Wood", "Fire", "Earth")
animals = ("Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig")
- testThis = (1801, 1861, 1984, 2020, 2186, 76543)
+ testThis = (1801, 1861, 1966, 1984, 2017, 2020, 2186, 76543)
i=each(testThis)
+ long yr, y, e, a
while i
yr = array(i)
y = yr mod 2
- e = (yr - 4) mod 5
+ e = (yr div 2) mod 5
a = (yr - 4) mod 12
outstr = yr+" is the year of the "
outstr += elements#val$(e)+" " + animals#val$(a) + " (" + yy#val$(y) + ")."
diff --git a/Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/FreeBASIC/composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k.basic b/Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/FreeBASIC/composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k.basic
index eb9f94848b..342e8509d5 100644
--- a/Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/FreeBASIC/composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k.basic
+++ b/Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/FreeBASIC/composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k.basic
@@ -1,17 +1,11 @@
Function isSubstring(kStr As String, f As Integer) As Integer
- Dim As String fStr = Str(f)
- Dim As Integer fLen = Len(fStr)
- Dim As Integer result = 0
- Dim As Integer fEnd = Len(kStr) - fLen + 1
- For fPos As Integer = 1 To Len(kStr) - fLen + 1
- If Mid(kStr, fPos, fLen) = fStr Then
- result = -1
- Exit For
- End If
- Next fPos
- Return result
+ If InStr(kStr, Str(f)) > 0 Then
+ Return -1
+ End If
+ Return 0
End Function
+
Dim As Integer requiredNumbers = 20
Dim As Integer kCount = 0
For k As Integer = 11 To 99999999 Step 2
diff --git a/Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/Ring/composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k.ring b/Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/Ring/composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k.ring
new file mode 100644
index 0000000000..a78e079a1f
--- /dev/null
+++ b/Task/Composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k/Ring/composite-numbers-k-with-no-single-digit-factors-whose-factors-are-all-substrings-of-k.ring
@@ -0,0 +1,53 @@
+load "stdlib.ring"
+
+Result = []
+deco = []
+comList = []
+nEnd = 3500000
+
+for n = 1 to nEnd
+ nr = 0
+ for p = 1 to n
+ if n%p = 0
+ if isPrime(p) = true and p<10
+ exit
+ else
+ nr = nr + 1
+ ok
+ ok
+ next
+ if nr > 2
+ comStr = string(n)
+ add(comList,comStr)
+ ok
+next
+
+for n = 1 to len(comList)
+ num = 0
+ comStr = comList[n]
+ comNum = number(comStr)
+ comTemp = comStr
+ decomp(deco,comNum)
+ for y = 1 to len(deco)
+ ind = substr(comStr,deco[y])
+ if ind > 0
+ num = num + 1
+ ok
+ next
+ if num = len(deco)
+ add(Result,comTemp)
+ ok
+next
+
+see Result
+
+func decomp(deco,nr2)
+ deco = []
+ x = ""
+ for i = 1 to nr2
+ if isPrime(i) and nr2 % i = 0
+ x = string(i)
+ add(deco,x)
+ ok
+ next
+ return deco
diff --git a/Task/Damm-algorithm/FutureBasic/damm-algorithm.basic b/Task/Damm-algorithm/FutureBasic/damm-algorithm.basic
new file mode 100644
index 0000000000..36813c35d2
--- /dev/null
+++ b/Task/Damm-algorithm/FutureBasic/damm-algorithm.basic
@@ -0,0 +1,31 @@
+NSUInteger local fn Damm( string as CFStringRef )
+ mda(0,0) = {{0,3,1,7,5,9,8,6,4,2},
+ {7,0,9,2,1,5,4,8,6,3},{4,2,0,6,8,7,1,3,5,9},
+ {1,7,5,0,9,8,3,4,2,6},{6,1,2,3,0,4,5,9,7,8},
+ {3,6,7,4,2,0,9,5,8,1},{5,8,6,9,7,2,0,1,3,4},
+ {8,9,4,5,3,6,2,0,1,7},{9,4,3,8,6,1,7,2,0,5},
+ {2,5,8,1,4,3,6,7,9,0}}
+
+ NSUInteger i, colI, oldRowI = 0, newRowI
+ for i = 0 to len(string) - 1
+ colI = intval(string[i])
+ newRowI = mda(oldRowI,colI)
+ oldRowI = newRowI
+ next
+end fn = newRowI
+
+void local fn DoIt
+ CFArrayRef dta = @[@"5724",@"5727",@"112946",@"112949"]
+ for CFStringRef string in dta
+ print string;
+ if ( fn Damm( string ) == 0 )
+ print @" is valid"
+ else
+ print @" is invalid"
+ end if
+ next
+end fn
+
+fn DoIt
+
+HandleEvents
diff --git a/Task/Display-an-outline-as-a-nested-table/Java/display-an-outline-as-a-nested-table.java b/Task/Display-an-outline-as-a-nested-table/Java/display-an-outline-as-a-nested-table.java
index ab620f4f29..2c87fcfa01 100644
--- a/Task/Display-an-outline-as-a-nested-table/Java/display-an-outline-as-a-nested-table.java
+++ b/Task/Display-an-outline-as-a-nested-table/Java/display-an-outline-as-a-nested-table.java
@@ -268,8 +268,8 @@ public final class DisplayAnOutlineAsANestedTable {
private static int index = -1;
- private static final List colours = List.of( "#ffff66;", "#ffcc66;", "#ccffcc;", "#ccccff;",
- "#ffcccc;", "#00cccc;", "#cc9966;", "#ffccff;" );
+ private static final List colours = List.of(
+ "#ffff66;", "#ffcc66;", "#ccffcc;", "#ccccff;", "#ffcccc;", "#00cccc;", "#cc9966;", "#ffccff;" );
}
diff --git a/Task/Execute-Brain-/SmileBASIC/execute-brain--1.basic b/Task/Execute-Brain-/SmileBASIC/execute-brain--1.basic
new file mode 100644
index 0000000000..63dcbc5856
--- /dev/null
+++ b/Task/Execute-Brain-/SmileBASIC/execute-brain--1.basic
@@ -0,0 +1,50 @@
+CLEAR
+
+CODE$="++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--"
+CODE$=CODE$+"------.>>+.>++."
+
+INPUT$=""
+II=0 'INPUT INDEX
+
+PIM TAPE(30000)
+P=0
+
+FOR I=0 TO LEN(CODE$)-1
+
+C$=MID$(CODE$, I, 1)
+IF C$==">" THEN P=P+1
+IF C$=="<" THEN P=P-1
+IF C$=="+" THEN TAPE(P)=TAPE(P)+1
+IF C$=="-" THEN TAPE(P)=TAPE(P)-1
+IF C$=="." THEN PRINT CHR$(TAPE(P));
+IF C$=="," THEN @COMMA
+IF C$=="[" AND TAPE(P)==0 THEN @LBRACKET
+IF C$=="]" AND TAPE(P)!=0 THEN @RBRACKET
+GOTO @NEXT
+
+@COMMA
+TAPE(P)=ASC(MID$(INPUT$, II, 1))
+II=II+1
+GOTO @NEXT
+
+@LBRACKET
+NEST = 1
+@FINDR
+I=I+1
+C$=MID$(CODE$, I, 1)
+IF C$=="[" THEN NEST=NEST+1
+IF C$=="]" THEN NEST=NEST-1
+IF NEST THEN @FINDR
+GOTO @NEXT
+
+@RBRACKET
+NEST=1
+@FINDL
+I=I-1
+C$=MID$(CODE$, I, 1)
+IF C$=="[" THEN NEST=NEST-1
+IF C$=="]" THEN NEST=NEST+1
+IF NEST THEN @FINDL
+
+@NEXT
+NEXT
diff --git a/Task/Execute-Brain-/SmileBASIC/execute-brain--2.basic b/Task/Execute-Brain-/SmileBASIC/execute-brain--2.basic
new file mode 100644
index 0000000000..8669ca0fba
--- /dev/null
+++ b/Task/Execute-Brain-/SmileBASIC/execute-brain--2.basic
@@ -0,0 +1,45 @@
+DEF BRAINFUG CODE$, IN$
+ DIM TAPE[30000]
+ VAR PNT
+ 'not sure if len is eval'd each time oh well
+ FOR I=0 TO LEN(CODE$)-1
+ C$=CODE$[I]
+ IF C$==">" THEN
+ INC PNT
+ ELSEIF C$=="<" THEN
+ DEC PNT
+ ELSEIF C$=="+" THEN
+ INC TAPE[PNT]
+ ELSEIF C$=="-" THEN
+ DEC TAPE[PNT]
+ ELSEIF C$=="." THEN
+ PRINT CHR$(TAPE[PNT])
+ ELSEIF C$=="," THEN
+ TAPE[PNT] = ASC(SHIFT(IN$))
+ ELSEIF C$=="[" AND TAPE[PNT]==0 THEN
+ NEST = 1
+ WHILE NEST
+ INC I
+ IF CODE$[I]=="[" THEN
+ INC NEST
+ ELSEIF CODE$[I]=="]" THEN
+ DEC NEST
+ ENDIF
+ WEND
+ ELSEIF C$=="]" AND TAPE[PNT]!=0 THEN
+ NEST=1
+ WHILE NEST
+ DEC I
+ IF CODE$[I]=="]" THEN
+ INC NEST
+ ELSEIF CODE$[I]=="[" THEN
+ DEC NEST
+ ENDIF
+ WEND
+ ENDIF
+ NEXT
+ PRINT
+END
+
+CODE$="++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."
+BRAINFUG CODE$, ""
diff --git a/Task/Factors-of-a-Mersenne-number/M2000-Interpreter/factors-of-a-mersenne-number.m2000 b/Task/Factors-of-a-Mersenne-number/M2000-Interpreter/factors-of-a-mersenne-number.m2000
index d9f148a243..9387607154 100644
--- a/Task/Factors-of-a-Mersenne-number/M2000-Interpreter/factors-of-a-mersenne-number.m2000
+++ b/Task/Factors-of-a-Mersenne-number/M2000-Interpreter/factors-of-a-mersenne-number.m2000
@@ -1,28 +1,26 @@
+// 67 need a lot of time 45 minutes (2758716msec) where 71 need 3.1 second (3131msec)
Module Factors_of_a_Mersenne_number{
- Dim q(1 To 10)
- q(1)= 11, 23, 29, 37, 41, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 929
- For k = 1 To 10
+ Dim q()
+ // 67 need a lot of time 51 minutes (3082671msec) where 71 need 3.5 second (3505msec)
+ q()= (11, 23, 29, 37, 41, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 929)
+ profiler
+ long long j=0x8000_0000
+ long long r, p, i
+ long d, dd
+ For k = 0 To len(q())-1
If @isPrime(q(k)) Then
- long p, r, d, r=q(k)
- long long i
- d = 2*q(k)+1
- while r>0: r=sint(binary.add(r,r)): end while
- Do
- i=1
- p=r
- While p<>0
- i = i**2@ Mod d
- If p<0 Then i*=2
- If i>d Then i-=d
- p=sint(binary.add(p,p))
- End While
- If i=1 Then Exit
- d+=2*q(k)
+ r=q(k):dd =2*r:d=dd+1
+ while rd Then i-=d
+ Until p=0:If i=1 Then Exit Else d+=dd:i=1:p=r
Always
- Print "2^"; q(k); @(6); " - 1 = 0 (mod"; d; ")"
+ Print "2^"; q(k); @(6); " - 1 = 0 (mod "; d; ")"
Else
Print q(k); " is not prime"
End If
+ Print ceil(timecount):profiler
Next
Function isPrime(n As long)
diff --git a/Task/Fivenum/PascalABC.NET/fivenum.pas b/Task/Fivenum/PascalABC.NET/fivenum.pas
new file mode 100644
index 0000000000..a475432932
--- /dev/null
+++ b/Task/Fivenum/PascalABC.NET/fivenum.pas
@@ -0,0 +1,37 @@
+const
+ Lists: array of array of real =
+ ((15.0, 6.0, 42.0, 41.0, 7.0, 36.0, 49.0, 40.0, 39.0, 47.0, 43.0),
+ (36.0, 40.0, 7.0, 39.0, 41.0, 15.0),
+ (0.14082834, 0.09748790, 1.73131507, 0.87636009, -1.95059594,
+ 0.73438555, -0.03035726, 1.46675970, -0.74621349, -0.72588772,
+ 0.63905160, 0.61501527, -0.98983780, -1.00447874, -0.62759469,
+ 0.66206163, 1.04312009, -0.10305385, 0.75775634, 0.32566578));
+
+function median(x: array of real; startIndex, endIndex: integer): real;
+begin
+ var size := endIndex - startIndex + 1;
+ assert(size > 0, 'array slice cannot be empty');
+ var m := startIndex + size div 2;
+ result := if size mod 2 = 1 then x[m] else (x[m - 1] + x[m]) / 2
+end;
+
+function fivenum(x: array of real): array of real;
+begin
+ setlength(result, 5);
+ x := x.Sorted.ToArray;
+ var m := x.length div 2;
+ var lowerEnd := if x.length mod 2 = 1 then m else m - 1;
+ result[0] := x[0];
+ result[1] := median(x, 0, lowerEnd);
+ result[2] := median(x, 0, x.high);
+ result[3] := median(x, m, x.high);
+ result[4] := x[^1];
+end;
+
+begin
+ foreach var list in Lists do
+ begin
+ println(list.toarray);
+ println(' → ', fivenum(list));
+ end;
+end.
diff --git a/Task/Floyds-triangle/ALGOL-68/floyds-triangle.alg b/Task/Floyds-triangle/ALGOL-68/floyds-triangle.alg
index 3e06ecbe63..c3bd144573 100644
--- a/Task/Floyds-triangle/ALGOL-68/floyds-triangle.alg
+++ b/Task/Floyds-triangle/ALGOL-68/floyds-triangle.alg
@@ -1,7 +1,11 @@
-# procedure to print a Floyd's Triangle with n lines #
+# procedure to print a Floyd's Triangle with n lines #
PROC floyds triangle = ( INT n )VOID:
BEGIN
+ # the triangle should be left aligned with the individual numbers #
+ # right-aligned with only one space before the number in the final #
+ # row #
+
# calculate the number of the highest number that will be printed #
# ( the sum of the integers 1, 2, ... n ) #
INT max number = ( n * ( n + 1 ) ) OVER 2;
@@ -24,10 +28,6 @@ BEGIN
END; # floyds triangle #
-main: (
-
- floyds triangle( 5 );
- print( ( newline ) );
- floyds triangle( 14 )
-
-)
+floyds triangle( 5 );
+print( ( newline ) );
+floyds triangle( 14 )
diff --git a/Task/Fork/PascalABC.NET/fork.pas b/Task/Fork/PascalABC.NET/fork.pas
new file mode 100644
index 0000000000..5430bd8480
--- /dev/null
+++ b/Task/Fork/PascalABC.NET/fork.pas
@@ -0,0 +1,15 @@
+uses System.Threading;
+
+procedure Fork;
+begin
+ WriteLn('Spawned Thread');
+end;
+
+begin
+ var t := new Thread(ThreadStart(Fork));
+ t.Start;
+
+ WriteLn('Main Thread');
+ t.Join;
+ Readln;
+end.
diff --git a/Task/Functional-coverage-tree/C++/functional-coverage-tree.cpp b/Task/Functional-coverage-tree/C++/functional-coverage-tree.cpp
new file mode 100644
index 0000000000..9397979952
--- /dev/null
+++ b/Task/Functional-coverage-tree/C++/functional-coverage-tree.cpp
@@ -0,0 +1,170 @@
+#include
+#include
+#include
+#include
+#include
+#include
+
+class FCNode {
+public:
+ FCNode(const std::string& name, const uint32_t& weight, const double& coverage)
+ : name(name), weight(weight), coverage(coverage), parent(NULL) {}
+
+ void add_children(const std::vector>& nodes) {
+ for ( const std::shared_ptr& node : nodes ) {
+ node->parent = this;
+ children.emplace_back(node);
+ update_coverage();
+ }
+ }
+
+ double get_coverage() {
+ return coverage;
+ }
+
+ void set_coverage(const double& aCoverage) {
+ if ( coverage != aCoverage ) {
+ coverage = aCoverage;
+ if ( parent ) {
+ parent->update_coverage();
+ }
+ }
+ }
+
+ void display() {
+ display(0);
+ }
+
+private:
+ void update_coverage() {
+ double sum_weighted_coverage = 0.0;
+ uint32_t sum_weight = 0;
+ for ( const std::shared_ptr& node : children ) {
+ sum_weighted_coverage += node->weight * node->coverage;
+ sum_weight += node->weight;
+ }
+
+ set_coverage(sum_weighted_coverage / sum_weight);
+ }
+
+ void display(uint32_t level) {
+ const std::string initial = std::string(4 * level, ' ') + name;
+ const std::string padding = std::string(NAME_FIELD_WIDTH - initial.length(), ' ');
+ std::cout << initial + padding + "|";
+ std::cout << " " << std::setw(3) << weight << " |";
+ std::cout << " " << std::fixed << std::setprecision(6) << coverage << " |" << std::endl;
+
+ for ( const std::shared_ptr& child : children ) {
+ child->display(level + 1);
+ }
+ }
+
+ std::string name;
+ uint32_t weight;
+ double coverage;
+ FCNode* parent;
+ std::vector> children{ };
+
+ static constexpr uint32_t NAME_FIELD_WIDTH = 32;
+};
+
+int main() {
+ FCNode cleaning("Cleaning", 1, 0.0);
+
+ std::vector> houses = {
+ std::make_shared("House_1", 40, 0.0),
+ std::make_shared("House_2", 60, 0.0)
+ };
+ cleaning.add_children(houses);
+
+ std::vector> house_1 = {
+ std::make_shared("Bedrooms", 1, 0.25),
+ std::make_shared("Bathrooms", 1, 0.0),
+ std::make_shared("Attic", 1, 0.75),
+ std::make_shared("Kitchen", 1, 0.1),
+ std::make_shared("Living_rooms", 1, 0.0),
+ std::make_shared("Basement", 1, 0.0),
+ std::make_shared("Garage", 1, 0.0),
+ std::make_shared("Garden",1, 0.8)
+ };
+ houses[0]->add_children(house_1);
+
+ std::vector> bathrooms_house_1 = {
+ std::make_shared("Bathroom_1", 1, 0.5),
+ std::make_shared("Bathroom_2", 1, 0.0),
+ std::make_shared("Outside_lavatory", 1, 1.0)
+ };
+ house_1[1]->add_children(bathrooms_house_1);
+
+ std::vector> living_rooms_house_1 = {
+ std::make_shared("lounge", 1, 0.0),
+ std::make_shared("Dining_room", 1, 0.0),
+ std::make_shared("Conservatory", 1, 0.0),
+ std::make_shared("Playroom", 1, 1.0)
+ };
+ house_1[4]->add_children(living_rooms_house_1);
+
+ std::vector> house_2 = {
+ std::make_shared("Upstairs", 1, 0.15),
+ std::make_shared("Ground_floor", 1, 0.316667),
+ std::make_shared("Basement", 1, 0.916667)
+ };
+ houses[1]->add_children(house_2);
+
+ std::vector> upstairs = {
+ std::make_shared("Bedrooms", 1, 0.0),
+ std::make_shared("Bathroom", 1, 0.0),
+ std::make_shared("Toilet", 1, 0.0),
+ std::make_shared("Attics", 1, 0.6)
+ };
+ house_2[0]->add_children(upstairs);
+
+ std::vector> ground_floor = {
+ std::make_shared("Kitchen", 1, 0.0),
+ std::make_shared("Living_rooms", 1, 0.0),
+ std::make_shared("Wet_room_&_toilet", 1, 0.0),
+ std::make_shared("Garage", 1, 0.0),
+ std::make_shared("Garden", 1, 0.9),
+ std::make_shared("Hot_tub_suite", 1, 1.0)
+ };
+ house_2[1]->add_children(ground_floor);
+
+ std::vector> basement = {
+ std::make_shared("Cellars", 1, 1.0),
+ std::make_shared("Wine_cellar", 1, 1.0),
+ std::make_shared("Cinema", 1, 0.75)
+ };
+ house_2[2]->add_children(basement);
+
+ std::vector> bedrooms = {
+ std::make_shared("Suite_1", 1, 0.0),
+ std::make_shared("Suite_2", 1, 0.0),
+ std::make_shared("Bedroom_3",1, 0.0),
+ std::make_shared("Bedroom_4",1, 0.0)
+ };
+ upstairs[0]->add_children(bedrooms);
+
+ std::vector> living_rooms_house_2 = {
+ std::make_shared("lounge", 1, 0.0),
+ std::make_shared("Dining_room", 1, 0.0),
+ std::make_shared("Conservatory", 1, 0.0),
+ std::make_shared("Playroom", 1, 0.0)
+ };
+ ground_floor[1]->add_children(living_rooms_house_2);
+
+ const double overall_coverage = cleaning.get_coverage();
+ std::cout << "OVERALL COVERAGE = " << std::fixed << std::setprecision(6)
+ << overall_coverage << std::endl << std::endl;
+ std::cout << "NAME HIERARCHY | WEIGHT | COVERAGE |" << std::endl;
+ std::cout << "--------------------------------|--------|----------|" << std::endl;
+ cleaning.display();
+ std::cout << std::endl;
+
+ basement[2]->set_coverage(1.0); // Change House_2 Cinema node coverage to 1.0
+ const double updated_coverage = cleaning.get_coverage();
+ const double difference = updated_coverage - overall_coverage;
+ std::cout << "If the coverage of the House_2 Cinema node were increased " << std::endl;
+ std::cout << "from 0.75 to 1.0 the overall coverage would increase by ";
+ std::cout << std::fixed << std::setprecision(6) << difference << " to " << updated_coverage << std::endl;
+ basement[2]->set_coverage(0.75); // Restore to House_2 Cinema node coverage to its original value
+}
diff --git a/Task/Functional-coverage-tree/Java/functional-coverage-tree.java b/Task/Functional-coverage-tree/Java/functional-coverage-tree.java
index 8fd0797f54..703ad2b3f5 100644
--- a/Task/Functional-coverage-tree/Java/functional-coverage-tree.java
+++ b/Task/Functional-coverage-tree/Java/functional-coverage-tree.java
@@ -78,7 +78,8 @@ public final class FunctionalCoverageTree {
ground_floor.get(1).addChildren(living_rooms_house_2);
final double overallCoverage = cleaning.getCoverage();
- System.out.println("OVERALL COVERAGE = " + String.format("%.6f", overallCoverage) + System.lineSeparator());
+ System.out.println("OVERALL COVERAGE = " + String.format("%.6f", overallCoverage));
+ System.out.println();
System.out.println("NAME HIERARCHY | WEIGHT | COVERAGE |" );
System.out.println("--------------------------------|--------|----------|");
cleaning.display();
@@ -129,14 +130,14 @@ final class FCNode {
}
private void updateCoverage() {
- double value1 = 0.0;
- int value2 = 0;
+ double sumWeightedCoverage = 0.0;
+ int sumWeight = 0;
for ( FCNode node : children ) {
- value1 += node.weight * node.coverage;
- value2 += node.weight;
+ sumWeightedCoverage += node.weight * node.coverage;
+ sumWeight += node.weight;
}
- setCoverage(value1 / value2);
+ setCoverage(sumWeightedCoverage / sumWeight);
}
private void display(int aLevel) {
diff --git a/Task/Gamma-function/PascalABC.NET/gamma-function.pas b/Task/Gamma-function/PascalABC.NET/gamma-function.pas
new file mode 100644
index 0000000000..5c189dbe31
--- /dev/null
+++ b/Task/Gamma-function/PascalABC.NET/gamma-function.pas
@@ -0,0 +1,28 @@
+const
+ g = 7;
+ p: array of real =
+ (0.99999999999980993, 676.5203681218851, -1259.1392167224028,
+ 771.32342877765313, -176.61502916214059, 12.507343278686905,
+ -0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7);
+
+function Gamma(z: Complex): Complex;
+begin
+ if (z.Real < 0.5) then
+ begin
+ result := pi / (Sin(pi * z) * Gamma(1 - z));
+ exit;
+ end
+ else
+ begin
+ z -= 1;
+ var x: Complex := p[0];
+ for var i := 1 to g + 1 do x += p[i] / (z + i);
+ var t := z + g + 0.5;
+ result := Sqrt(2 * pi) * (Power(t, z + 0.5)) * Exp(-t) * x;
+ end;
+end;
+
+begin
+ writeln('z Lanczos');
+ for var i := 1 to 10 do writeln(i / 3:6:4, gamma(i / 3):25);
+end.
diff --git a/Task/Hello-world-Graphical/Autohotkey-V2/hello-world-graphical.ahk b/Task/Hello-world-Graphical/AutoHotKey-V2/hello-world-graphical.ahk
similarity index 100%
rename from Task/Hello-world-Graphical/Autohotkey-V2/hello-world-graphical.ahk
rename to Task/Hello-world-Graphical/AutoHotKey-V2/hello-world-graphical.ahk
diff --git a/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/M2000-Interpreter/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.m2000 b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/M2000-Interpreter/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.m2000
new file mode 100644
index 0000000000..1ab74f5f29
--- /dev/null
+++ b/Task/Idiomatically-determine-all-the-characters-that-can-be-used-for-symbols/M2000-Interpreter/idiomatically-determine-all-the-characters-that-can-be-used-for-symbols.m2000
@@ -0,0 +1,12 @@
+for=100
+print for=100
+for for=1 to 10:Print for: Next for
+Print for=11
+to=100
+print to=100
+for to=1 to 10:Print to: Next to
+Print to=11
+Print=100
+print Print=100
+for Print=1 to 10:Print Print: Next Print
+Print Print=11
diff --git a/Task/Loops-N-plus-one-half/M2000-Interpreter/loops-n-plus-one-half.m2000 b/Task/Loops-N-plus-one-half/M2000-Interpreter/loops-n-plus-one-half.m2000
index 57a77c794f..1d319333b1 100644
--- a/Task/Loops-N-plus-one-half/M2000-Interpreter/loops-n-plus-one-half.m2000
+++ b/Task/Loops-N-plus-one-half/M2000-Interpreter/loops-n-plus-one-half.m2000
@@ -1,27 +1,25 @@
Module Checkit {
- \\ old type loop
- For i=1 to 10
- Print i;
- If i=10 Then Exit For
- Print ", ";
- Next i
- Print
- \\ fast type loop. Continue exit block, without breaking loop.
- For i=1 to 10 {
- Print i;
- If i=10 Then Continue
- Print ", ";
- }
- Print
- Print
- i=0
- {
- loop \\ this mark block for loop, each time need to mark
- i++
- Print i;
- If i=10 Then Exit ' so now we use exit to break loop
- Print ", ";
- }
- Print
+ For i=1 to 10
+ Print i;
+ If i=10 Then Continue
+ Print ",";
+ Next i
+ Print
+ i=1
+ { Print i;
+ If i=10 Then Continue
+ loop ' this mark block for loop
+ Print ",";
+ i++
+ }
+ Print
+05 REM like Basic Old type
+10 LET i=0
+20 i=i+1
+30 PRINT i;
+40 IF i=10 THEN 70
+50 PRINT ",";
+60 GOTO 20
+70 PRINT
}
Checkit
diff --git a/Task/Loops-With-multiple-ranges/M2000-Interpreter/loops-with-multiple-ranges.m2000 b/Task/Loops-With-multiple-ranges/M2000-Interpreter/loops-with-multiple-ranges.m2000
index 97a01bb63b..f5e4197b8e 100644
--- a/Task/Loops-With-multiple-ranges/M2000-Interpreter/loops-with-multiple-ranges.m2000
+++ b/Task/Loops-With-multiple-ranges/M2000-Interpreter/loops-with-multiple-ranges.m2000
@@ -1,5 +1,7 @@
Module MultipleLoop {
- def long prod=1, sum=0, x=+5,y=-5, z=-2, one=1, three=3, seven=7, j
+ long sum=0, x=+5,y=-5, z=-2, j
+ double prod=1
+ const one=1&, three=3&, seven=7&
Range=lambda (a, b, c=1) ->{
=lambda a, b, c (&f)-> {
if compare(a,b)=sgn(c) then =false else =true: f=a: a+=c
@@ -13,13 +15,15 @@ Module MultipleLoop {
k++ : always
}
}
- Exec=MultipleRange(Range(-three, 3**3, three), Range(-seven, +seven, x), Range(555, 550-y), Range(22, -28, -three), Range(1927, 1939), Range(x,y,z), Range(11**x, 11**x+one))
+ flush
+ data Range(-three, 3**3, three), Range(-seven, +seven, x), Range(555, 550-y), Range(22, -28, -three)
+ data Range(1927, 1939), Range(x,y,z), Range(11**x, 11**x+one)
+ Exec=MultipleRange(![])
j=0
while Exec(&j)
sum+=abs(j)
if abs(prod) < 2^27 And j <> 0 then prod*=j
End While
-
Print "sum=";sum
Print "prod=";prod
}
diff --git a/Task/Magic-constant/FutureBasic/magic-constant.basic b/Task/Magic-constant/FutureBasic/magic-constant.basic
new file mode 100644
index 0000000000..c464a664e9
--- /dev/null
+++ b/Task/Magic-constant/FutureBasic/magic-constant.basic
@@ -0,0 +1,31 @@
+long def fn MagicConstant( n as long ) = n*(n^2+1)/2
+
+UInt64 local fn InvA( x as double )
+ UInt64 k = 0
+ while ( k*(k^2+1)/2+2 < x )
+ k++
+ wend
+end fn = k
+
+void local fn DoIt
+ window 1, @"Magic constant", (0,0,640,400)
+ print @"First 20 magic constants:"
+ long n = 3
+ while n <= 1002
+ if ( n <= 22 )
+ print fn MagicConstant( n );@" ";
+ end if
+ if ( n == 1002 ) then print @"\n\n1000th magic constant: ";fn MagicConstant(1002)
+ n++
+ wend
+
+ print
+
+ for long e = 1 to 20
+ printf @"10^%ld: %ld",e,fn InvA(10^e)
+ next
+end fn
+
+fn DoIt
+
+HandleEvents
diff --git a/Task/Metallic-ratios/FreeBASIC/metallic-ratios.basic b/Task/Metallic-ratios/FreeBASIC/metallic-ratios.basic
new file mode 100644
index 0000000000..6e0408b64e
--- /dev/null
+++ b/Task/Metallic-ratios/FreeBASIC/metallic-ratios.basic
@@ -0,0 +1,82 @@
+' version 01-11-2024
+' compile with: fbc -s console
+
+#Include Once "gmp.bi"
+#Include Once "crt\stdio.bi"
+#Define prec 32
+
+Dim Shared As String ratio_names(0 To 9)
+For x As Integer = 0 To 9
+ Read ratio_names(x)
+Next
+
+Data "Platinum", "Golden", "Silver", "Bronze", "Copper"
+Data "Nickel", "Aluminium", "Iron", "Tin", "Lead"
+
+Sub lucas(b As UInteger)
+ Print Using "Lucas sequence for & ratio, where b = #";ratio_names(b); b
+ Dim As UInteger i, l0 = 1, l1 = 1, l2
+ Print "First 15 elements are 1, 1";
+ For i = 1 To 13
+ l2 = b * l1 + l0
+ Print ", "; l2;
+ Swap l0, l1
+ Swap l1, l2
+ Next
+ Print
+End Sub
+
+Sub metallic_ratio(b As UInteger, pr As UInteger)
+
+ Dim As UInteger i, dp
+ Dim As String str1
+ Dim As ZString Ptr gmp_str : gmp_str = Allocate(100)
+ Dim As mpf_ptr bb, l0, l1, l2, ra
+ bb = Allocate(Len(__Mpf_struct)) : Mpf_init2(bb, pr * 4)
+ l0 = Allocate(Len(__Mpf_struct)) : Mpf_init2(l0, pr * 4)
+ l1 = Allocate(Len(__Mpf_struct)) : Mpf_init2(l1, pr * 4)
+ l2 = Allocate(Len(__Mpf_struct)) : Mpf_init2(l2, pr * 4)
+ ra = Allocate(Len(__Mpf_struct)) : Mpf_init2(ra, pr * 4)
+
+ mpf_set_ui(bb, b)
+ mpf_set_ui(l0, 1)
+ mpf_set_ui(l1, 1)
+ mpf_div(ra, l1, l0)
+ Gmp_sprintf(gmp_str, "%.*Ff", pr, ra)
+ str1 = *gmp_str
+
+ Do
+ i += 1
+ mpf_mul(l2, bb, l1)
+ mpf_add(l2, l2, l0)
+ mpf_div(ra, l2, l1)
+ Gmp_sprintf(gmp_str, "%.*Ff", pr, ra)
+ If str1 = *gmp_str Then
+ Print "Value to "; Str(pr); " dp after "; Str(i); " iteration"; IIf(i < 2, "", "s"); ": ";
+ If pr = 256 Then print
+ If i = 1 Then Print Trim(Trim(str1,"0"), ".") Else Print str1
+ Print
+ mpf_clears(bb, l0, l1, l2, ra, NULL)
+ DeAllocate(gmp_str)
+ Return
+ End If
+ str1 = *gmp_str
+ mpf_swap(l0, l1)
+ mpf_swap(l1, l2)
+ Loop
+End Sub
+
+' ------=< MAIN >=------
+
+For x As Integer = 0 To 9
+ lucas(x)
+ metallic_ratio(x, prec)
+Next
+Print "Golden ratio, where b = 1"
+metallic_ratio(1, 256)
+
+' empty keyboard buffer
+While Inkey <> "" : Wend
+Print : Print "hit any key to end program"
+Sleep
+End
diff --git a/Task/Mouse-position/Haskell/mouse-position.hs b/Task/Mouse-position/Haskell/mouse-position.hs
new file mode 100644
index 0000000000..0fb5ea1c0d
--- /dev/null
+++ b/Task/Mouse-position/Haskell/mouse-position.hs
@@ -0,0 +1,20 @@
+import qualified Graphics.UI.Threepenny as UI
+import Graphics.UI.Threepenny.Core
+
+main :: IO ()
+main = do
+ startGUI defaultConfig setup -- Start the Threepenny server
+
+setup :: Window -> UI ()
+setup window = do
+ -- Set the window title
+ pure window # set UI.title "Cursor Position Example"
+
+ -- Create a display area
+ displayArea <- UI.div # set UI.style [("width", "100%"), ("height", "100vh"), ("background", "#f0f0f0")]
+ getBody window #+ [element displayArea]
+
+ -- Event listener for mouse movements
+ on UI.mousemove displayArea $ \(x, y) -> do
+ -- This prints in terminal where threepenny-gui server was started, NOT in browser console
+ liftIO $ putStrLn $ "Mouse cursor position relative to window: (" ++ show x ++ ", " ++ show y ++ ")"
diff --git a/Task/Percolation-Mean-cluster-density/FreeBASIC/percolation-mean-cluster-density.basic b/Task/Percolation-Mean-cluster-density/FreeBASIC/percolation-mean-cluster-density.basic
new file mode 100644
index 0000000000..8957533daf
--- /dev/null
+++ b/Task/Percolation-Mean-cluster-density/FreeBASIC/percolation-mean-cluster-density.basic
@@ -0,0 +1,83 @@
+Const As Long RAND_MAX = 32767
+Const ALFA = "+.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+Const ALEN = Len(ALFA) - 3
+
+Dim Shared As Integer grid()
+Dim Shared As Integer w, ww
+
+Sub makeGrid(p As Single)
+ Dim As Long thresh, r
+ thresh = Int(p * RAND_MAX)
+
+ ww = w * w
+ Redim grid(ww - 1)
+
+ For i As Integer = ww - 1 To 0 Step -1
+ r = Int(Rnd * (RAND_MAX + 1))
+ grid(i) = Iif(r < thresh, -1, 0)
+ Next
+End Sub
+
+Sub showCluster()
+ Dim As Integer k, i, j, s
+ Dim As String c
+
+ k = 0
+ For i = 0 To w - 1
+ For j = 0 To w - 1
+ s = grid(k)
+ k += 1
+ c = Iif(s < ALEN, Mid(ALFA, 1 + s + 1, 1), "?")
+ Print " " & c;
+ Next
+ Print
+ Next
+End Sub
+
+Sub recur(x As Integer, v As Integer)
+ If x >= 0 Andalso x < ww Andalso grid(x) = -1 Then
+ grid(x) = v
+ recur(x - w, v)
+ recur(x - 1, v)
+ recur(x + 1, v)
+ recur(x + w, v)
+ End If
+End Sub
+
+Function countClusters() As Integer
+ Dim As Integer ccl, i
+
+ ccl = 0
+ For i = 0 To ww - 1
+ If grid(i) = -1 Then
+ ccl += 1
+ recur(i, ccl)
+ End If
+ Next
+ Return ccl
+End Function
+
+Function tests(n As Integer, p As Single) As Single
+ Dim k As Single = 0
+ For i As Integer = 0 To n - 1
+ makeGrid(p)
+ k += countClusters() / ww
+ Next
+ Return k / n
+End Function
+
+' Main program
+Randomize Timer
+w = 15
+makeGrid(0.5)
+Print "width = 15, p = 0.5, " & countClusters() & " clusters:"
+showCluster()
+
+Print !"\np = 0.5, iter = 5:"
+w = 4
+While w <= 8192
+ Print Using "##### #.######"; w; tests(5, 0.5)
+ w Shl= 1
+Wend
+
+Sleep
diff --git a/Task/Real-constants-and-functions/M2000-Interpreter/real-constants-and-functions.m2000 b/Task/Real-constants-and-functions/M2000-Interpreter/real-constants-and-functions.m2000
index 93fbecb658..dead3d1f50 100644
--- a/Task/Real-constants-and-functions/M2000-Interpreter/real-constants-and-functions.m2000
+++ b/Task/Real-constants-and-functions/M2000-Interpreter/real-constants-and-functions.m2000
@@ -5,12 +5,16 @@ Module Checkit {
Print Sgn(-5)=-1
Print Abs(-2.10#)=2.1#
Def exptype$(x)=type$(x)
+ Print exptype$(Abs(-2.1@))="Decimal"
Print exptype$(Abs(-2.1#))="Currency"
Print exptype$(Abs(-2.1~))="Single"
- Print exptype$(Abs(-2.1@))="Decimal"
+ Print exptype$(Abs(-2.212e34~))="Single"
+ Print exptype$(Abs(-2.212e34))="Double"
+ Print exptype$(Abs(-12345612345612345&&))="Long Long"
Print exptype$(Abs(-2&))="Long"
Print exptype$(Abs(-2%))="Integer"
- Print exptype$(Abs(-2.212e34))="Double"
+ Print exptype$(234ub)="Byte"
+ Print exptype$(4600ud)="Date"
Print exptype$(Sgn(-2.1#))="Integer"
\\ Sgn return integer type
@@ -26,17 +30,27 @@ Module Checkit {
\\ 64bit Long Long (from Version 12)
Print exptype$(2&&^2&&)="Long Long"
Print exptype$(2&&**2&&)="Long Long"
+ Print exptype$(2&& mod 2&&)="Long Long"
+ Print exptype$(2&& div 2&&)="Long Long"
+ Print exptype$(2&& / 2&&)="Double"
Print exptype$(2&&*2&)="Long Long"
+ // Byte only + - * work for byte (byte is unsigned, from 0 to 255)
+ Print exptype$(2ub^2ub)="Double"
+ Print exptype$(2ub**2ub)="Double"
+ Print exptype$(2ub*2ub)="Byte"
+ Print exptype$(2ub*255ub)="Integer"
+ try ok {Print exptype$(256ub*255ub), "??"}
+ If error or not ok then print error$ ' error in exponet Overflow
+ Print exptype$(2ub mod 2ub)="Double"
+ Print exptype$(2ub div 2ub)="Double"
+ Print exptype$(2ub / 2ub)="Double"
Print 2**2=4, 2^2=4, 2^2^2=16, 2**2**2=16
\\ floor() and Int() is the same
Print Int(-2.7)=-3, Int(2.7)=2
Print Floor(-2.7)=-3, Floor(2.7)=2
Print Ceil(-2.7)=-2, Ceil(2.7)=3
-
Print round(-2.7, 0)=-3, round(2.7, 0)=3
Print round(-2.2, 0)=-2, round(2.2, 0)=2
-
-
Print Sqrt(4)=2
}
Checkit
diff --git a/Task/Real-constants-and-functions/S-BASIC/real-constants-and-functions.basic b/Task/Real-constants-and-functions/S-BASIC/real-constants-and-functions.basic
new file mode 100644
index 0000000000..29d7d6cbf4
--- /dev/null
+++ b/Task/Real-constants-and-functions/S-BASIC/real-constants-and-functions.basic
@@ -0,0 +1,28 @@
+print "Square root of 2.7 ="; sqr(2.7)
+print "Natural log of 2.7 ="; log(2.7)
+print "Exp() of 2.7 ="; exp(2.7)
+print "Absolute value of -2.7 ="; abs(-2.7)
+print "Floor of 2.7 ="; int(2.7)
+print "Floor of -2.7 ="; int(-2.7)
+print "2.7 to the 3rd power ="; 2.7 ^ 3 rem or 2.7 ** 3
+
+comment
+ e, pi, and ceiling() are not built-in, but are
+ easily implemented
+end
+
+function e = real
+end = exp(1.0)
+
+function pi = real
+end = atn(1.0) * 4.0
+
+function ceil(x = real) = real
+end = int(x) + 1
+
+print "e ="; e
+print "pi ="; pi
+print "ceiling of 2.7 = "; ceil(2.7)
+print "ceiling of -2.7 = "; ceil(-2.7)
+
+end
diff --git a/Task/Rep-string/ALGOL-68/rep-string.alg b/Task/Rep-string/ALGOL-68/rep-string.alg
index 89215df160..c3737b746e 100644
--- a/Task/Rep-string/ALGOL-68/rep-string.alg
+++ b/Task/Rep-string/ALGOL-68/rep-string.alg
@@ -36,8 +36,7 @@ END; # longest rep string #
# test the longest rep string procedure #
-main:
-(
+BEGIN
[]STRING tests = ( "1001110011"
, "1110111011"
@@ -65,4 +64,4 @@ main:
)
)
OD
-)
+END
diff --git a/Task/Selectively-replace-multiple-instances-of-a-character-within-a-string/Ring/selectively-replace-multiple-instances-of-a-character-within-a-string.ring b/Task/Selectively-replace-multiple-instances-of-a-character-within-a-string/Ring/selectively-replace-multiple-instances-of-a-character-within-a-string.ring
new file mode 100644
index 0000000000..74b3fd319b
--- /dev/null
+++ b/Task/Selectively-replace-multiple-instances-of-a-character-within-a-string/Ring/selectively-replace-multiple-instances-of-a-character-within-a-string.ring
@@ -0,0 +1,24 @@
+str = "abracadabra"
+strTemp = "abracadabra"
+
+repSel(str,"a","A",1)
+repSel(str,"a","B",2)
+repSel(str,"a","C",4)
+repSel(str,"a","D",5)
+repSel(str,"b","E",1)
+repSel(str,"r","F",2)
+
+see str + " -> " + strTemp + nl
+
+func repSel(str,char1,char2,nr)
+ num = 0
+ for n = 1 to len(str)
+ if str[n] = char1
+ num += 1
+ ok
+ if num = nr
+ strTemp[n] = char2
+ exit
+ ok
+ next
+ return strTemp
diff --git a/Task/Sierpinski-triangle-Graphical/Ada/sierpinski-triangle-graphical.ada b/Task/Sierpinski-triangle-Graphical/Ada/sierpinski-triangle-graphical.ada
new file mode 100644
index 0000000000..ed5a4149a4
--- /dev/null
+++ b/Task/Sierpinski-triangle-Graphical/Ada/sierpinski-triangle-graphical.ada
@@ -0,0 +1,37 @@
+pragma Ada_2022;
+with Ada.Command_Line; use Ada.Command_Line;
+with Ada.Text_IO; use Ada.Text_IO;
+with Easy_Graphics; use Easy_Graphics;
+
+procedure Sierpinski_Triangle_Graphical is
+ Max_Order : constant Integer := 8;
+ subtype Valid_Order is Integer range 0 .. Max_Order;
+ Length : constant Positive := 2 ** (Max_Order + 1);
+ Order : Valid_Order;
+ Img : Easy_Image := New_Image ((1, 1), (550, 550), BLACK);
+ Turtle : Turtle_Rec := New_Turtle (Img'Unrestricted_Access);
+
+ procedure Sier_Triangle (Order : Valid_Order; Length : Positive) is
+ begin
+ if Order > 0 then
+ for I in 1 .. 3 loop
+ Sier_Triangle (Order - 1, Length / 2);
+ Turtle.Forward (Length);
+ Turtle.Right (120);
+ end loop;
+ end if;
+ end Triangle;
+
+begin
+ if Argument_Count /= 1 then
+ Put_Line ("Usage: sierpinski_triangle_graphical ");
+ Put_Line ("Where: is 0 .. 8");
+ return;
+ end if;
+ Order := Natural'Value (Argument (1));
+ Turtle.Pen_Color (MAGENTA);
+ Turtle.Go_To ((25, 25));
+ Turtle.Pen_Down;
+ Sier_Triangle (Order, Length);
+ Write_GIF (Img, "sierpinski_triangle.gif");
+end Sierpinski_Triangle_Graphical;
diff --git a/Task/Simple-windowed-application/Forth/simple-windowed-application-4.fth b/Task/Simple-windowed-application/Forth/simple-windowed-application-4.fth
index 9fca6cb3fb..347b3b67bd 100644
--- a/Task/Simple-windowed-application/Forth/simple-windowed-application-4.fth
+++ b/Task/Simple-windowed-application/Forth/simple-windowed-application-4.fth
@@ -13,7 +13,7 @@ TextView' t
\ the running count is always on the stack
\ so a variable for that is not needed
-:noname
+:noname ( count -- count+1 )
1+ \ increment the count
" Number of clicks: " put: t
dup deciNumstr insert: t ; setAction: b \ update the text representation of count
diff --git a/Task/Smarandache-prime-digital-sequence/Ring/smarandache-prime-digital-sequence.ring b/Task/Smarandache-prime-digital-sequence/Ring/smarandache-prime-digital-sequence.ring
index b7f1b6f267..1d64a486e1 100644
--- a/Task/Smarandache-prime-digital-sequence/Ring/smarandache-prime-digital-sequence.ring
+++ b/Task/Smarandache-prime-digital-sequence/Ring/smarandache-prime-digital-sequence.ring
@@ -1,28 +1,49 @@
load "stdlib.ring"
-see "First 25 Smarandache primes:" + nl + nl
-
+sum = 0
num = 0
-limit = 26
-limit100 = 100
-for n = 1 to 34000
- flag = 0
- nStr = string(n)
- for x = 1 to len(nStr)
- nx = number(nStr[x])
- if isprime(n) and isprime(nx)
- flag = flag + 1
- else
- exit
- ok
- next
- if flag = len(nStr)
- num = num + 1
- if num < limit
- see "" + n + " "
- ok
- if num = limit100
- see nl + nl + "100th Smarandache prime: " + n + nl
- ok
- ok
+Sma = []
+while true
+ num += 1
+ flag = 0
+ numb = 0
+ if isPrime(num)
+ nrStr = string(num)
+ for n = 1 to len(nrStr)
+ nrTemp = number(nrStr[n])
+ if isPrime(nrTemp)
+ numb += 1
+ if numb = len(nrStr)
+ add(Sma,num)
+ sum += 1
+ if sum = 100
+ exit 2
+ ok
+ ok
+ else
+ exit
+ ok
+ next
+ ok
+end
+
+for n = 1 to 25
+ if len(string(Sma[n])) = 1
+ see " " + Sma[n]
+ ok
+ if len(string(Sma[n])) = 2
+ see " " + Sma[n]
+ ok
+ if len(string(Sma[n])) = 3
+ see " " + Sma[n]
+ ok
+ if len(string(Sma[n])) = 4
+ see " " + Sma[n]
+ ok
+ if n%5 = 0
+ see nl
+ ok
next
+
+see nl
+see "Hundredth SPDS prime: " + Sma[100]
diff --git a/Task/Solve-a-Numbrix-puzzle/Python/solve-a-numbrix-puzzle.py b/Task/Solve-a-Numbrix-puzzle/Python/solve-a-numbrix-puzzle-1.py
similarity index 100%
rename from Task/Solve-a-Numbrix-puzzle/Python/solve-a-numbrix-puzzle.py
rename to Task/Solve-a-Numbrix-puzzle/Python/solve-a-numbrix-puzzle-1.py
diff --git a/Task/Solve-a-Numbrix-puzzle/Python/solve-a-numbrix-puzzle-2.py b/Task/Solve-a-Numbrix-puzzle/Python/solve-a-numbrix-puzzle-2.py
new file mode 100644
index 0000000000..c62d207bed
--- /dev/null
+++ b/Task/Solve-a-Numbrix-puzzle/Python/solve-a-numbrix-puzzle-2.py
@@ -0,0 +1,85 @@
+# numbrix.py by Xing216
+MOVES = [(1, 0), (0, 1), (-1, 0), (0, -1)]
+class Numbrix:
+ def __init__(self) -> None:
+ self.grid: list[list[int]]
+ self.clues: list[int]
+ self.totalToFill: int
+ self.startRow: int
+ self.StartCol: int
+ def solve(self, row, col, count:int, nextClue: int) -> bool:
+ if count > self.totalToFill:
+ return True
+ back = self.grid[row][col]
+ if back not in [0, count]:
+ return False
+ if back == 0 and nextClue < len(self.clues) and self.clues[nextClue] == count:
+ return False
+ nextClue = nextClue
+ if back == count: nextClue += 1
+ self.grid[row][col] = count
+ for move in MOVES:
+ if self.solve(row + move[1], col + move[0], count + 1, nextClue):
+ return True
+ self.grid[row][col] = back
+ def xprint(self):
+ for row in self.grid:
+ for val in row:
+ if val != -1:
+ print(f"{val:02d} ",end='')
+ print()
+def initNumbrix(board: list[str]) -> Numbrix:
+ result = Numbrix()
+ nRows = len(board)
+ nCols = len(board[0].split(','))
+ result.grid = [[-1]*(nCols + 2) for _ in range(nRows + 2)]
+ result.totalToFill = nRows * nCols
+ xlist = []
+ for r, row in enumerate(board):
+ row = row.split(',')
+ for c, tile in enumerate(row):
+ val = int(tile)
+ result.grid[r + 1][c + 1] = val
+ if val > 0:
+ xlist.append(val)
+ if val == 1:
+ result.startRow = r + 1
+ result.startCol = c + 1
+ xlist.sort()
+ result.clues = xlist
+ return result
+if __name__ == "__main__":
+ EXAMPLE1 = ["00,00,00,00,00,00,00,00,00",
+ "00,00,46,45,00,55,74,00,00",
+ "00,38,00,00,43,00,00,78,00",
+ "00,35,00,00,00,00,00,71,00",
+ "00,00,33,00,00,00,59,00,00",
+ "00,17,00,00,00,00,00,67,00",
+ "00,18,00,00,11,00,00,64,00",
+ "00,00,24,21,00,01,02,00,00",
+ "00,00,00,00,00,00,00,00,00"]
+ EXAMPLE2 = ["00,00,00,00,00,00,00,00,00",
+ "00,11,12,15,18,21,62,61,00",
+ "00,06,00,00,00,00,00,60,00",
+ "00,33,00,00,00,00,00,57,00",
+ "00,32,00,00,00,00,00,56,00",
+ "00,37,00,01,00,00,00,73,00",
+ "00,38,00,00,00,00,00,72,00",
+ "00,43,44,47,48,51,76,77,00",
+ "00,00,00,00,00,00,00,00,00"]
+ EXAMPLE3 = ["17,00,00,00,11,00,00,00,59",
+ "00,15,00,00,06,00,00,61,00",
+ "00,00,03,00,00,00,63,00,00",
+ "00,00,00,01,66,00,00,00,00",
+ "23,24,00,68,67,78,00,54,55",
+ "00,00,00,00,72,00,00,00,00",
+ "00,00,35,00,00,00,49,00,00",
+ "00,29,00,00,40,00,00,47,00",
+ "31,00,00,00,39,00,00,00,45"]
+ for i, board in enumerate([EXAMPLE1,EXAMPLE2, EXAMPLE3]):
+ numbrix = initNumbrix(board)
+ if numbrix.solve(numbrix.startRow, numbrix.startCol, 1, 0):
+ print(f"Solution for example {i+1}:", end="")
+ numbrix.xprint()
+ else:
+ "No solution."
diff --git a/Task/Sort-an-array-of-composite-structures/M2000-Interpreter/sort-an-array-of-composite-structures.m2000 b/Task/Sort-an-array-of-composite-structures/M2000-Interpreter/sort-an-array-of-composite-structures.m2000
index 74f48e2295..6f21257769 100644
--- a/Task/Sort-an-array-of-composite-structures/M2000-Interpreter/sort-an-array-of-composite-structures.m2000
+++ b/Task/Sort-an-array-of-composite-structures/M2000-Interpreter/sort-an-array-of-composite-structures.m2000
@@ -57,8 +57,7 @@ module Sort_an_array_of_composite_structures{
return
}
Sort_an_array_of_composite_structures
-
-
+Pint
module Checkit2 {
Inventory Alfa="Joe":=5531, "Adam":=2341, "Bernie":=122
Append Alfa, "Walter":=1234, "David":=19
@@ -69,6 +68,7 @@ module Checkit2 {
}
}
Checkit2
+Print
module Checkit3 {
class any {
x
@@ -80,11 +80,37 @@ module Checkit3 {
Sort Alfa
k=Each(Alfa)
While k {
- \\ k^ is the index number by k cursor
- \\ Alfa("joe") return object
- \\ Alfa(0!) return first element object
- \\ Alfa(k^!) return (k^) objext
+ ' k^ is the index number by k cursor
+ ' Alfa("joe") return object
+ ' Alfa(0!) return first element object
+ ' Alfa(k^!) return (k^) objext
Print eval$(Alfa, k^), Alfa(k^!).x
}
}
Checkit3
+
+Module Sort2Darray {
+ const ascending=0, descending=1
+ const Names=0, Rate=1
+ flush
+ Data "Bernie", 1
+ Data "Adam", 2341
+ Data "David", 19
+ Data "Bernie", 5
+ Data "Joe", 5531
+ Data "Walter", 1234
+ Data "Bernie", 122
+ k=stack.size/2
+ dim a(k,2)
+ Pen 15 {Print "Fill Array"}
+ for i=0 to k-1: read a(i,0), a(i,1): next
+ Pen 15 {Print "Unsorted"}
+ for i=0 to k-1: ? a(i,0), a(i,1): next
+ ' there is a special sort for 2D arrays
+ profiler
+ sort a(),0,k-1,Names, ascending, Rate, descending
+ print timecount
+ Pen 15 {Print "Sorted"}
+ for i=0 to k-1: ? a(i,0), a(i,1): next
+}
+Sort2Darray
diff --git a/Task/Substitution-cipher/Common-Lisp/substitution-cipher.lisp b/Task/Substitution-cipher/Common-Lisp/substitution-cipher.lisp
new file mode 100644
index 0000000000..8a9352a874
--- /dev/null
+++ b/Task/Substitution-cipher/Common-Lisp/substitution-cipher.lisp
@@ -0,0 +1,24 @@
+;
+; substution.lsp
+;
+(defvar _original "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
+(defvar _substitute "dthnxkmqrwzseglyoaubjpcfivTKXMGVUPOIRFDEJZNYWCAQSLBH")
+(defvar _text "The quick brown fox jumps over the lazy dog!")
+
+(defun encode (_plaintext _original _substitute)
+ (map 'string
+ #'(lambda (_char)
+ (let*
+ ((_offset (position _char _original)))
+ (if _offset
+ (aref _substitute _offset)
+ _char)))
+ _plaintext))
+
+(print _text)
+(setq _text (encode _text _original _substitute))
+(print _text)
+(setq _text (encode _text _substitute _original))
+(print _text)
+
+(exit)
diff --git a/Task/Ukkonen-s-suffix-tree-construction/C++/ukkonen-s-suffix-tree-construction.cpp b/Task/Ukkonen-s-suffix-tree-construction/C++/ukkonen-s-suffix-tree-construction.cpp
new file mode 100644
index 0000000000..6781444d65
--- /dev/null
+++ b/Task/Ukkonen-s-suffix-tree-construction/C++/ukkonen-s-suffix-tree-construction.cpp
@@ -0,0 +1,193 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include