Zhang-Suen thinning algorithm: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
(Dialects of BASIC moved to the BASIC section.)
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(2 intermediate revisions by one other user not shown)
Line 1,684:
 
=={{header|Elena}}==
ELENA 56.0x :
{{trans|Java}}
<syntaxhighlight lang="elena">import system'collections;
Line 1,711:
" "};
 
static int[][] nbrs = new int[][]
{
new int[]{0, -1}, new int[]{1, -1}, new int[]{1, 0}, new int[]{1, 1}, new int[]{0, 1},
Line 1,717:
};
 
static int[][][] nbrGroups = new int[][][]
{
new int[][]{new int[]{0, 2, 4}, new int[]{2, 4, 6}},
Line 1,750:
int count := 0;
for (int i := 0,; i < nbrs.Length, - 1; i += 1)
{
if (self[r + nbrs[i][1]][c + nbrs[i + 1][0]] == $35)
{ count += 1 }
};
Line 1,763:
int count := 0;
for (int i := 0,; i < nbrs.Length, - 1; i += 1)
{
if (self[r + nbrs[i][1]][c + nbrs[i][0]] == $32)
Line 1,781:
int count := 0;
var group := nbrGroups[step];
for(int i := 0,; i < 3,2; i += 1)
{
for(int j := 0,; j < group[i].Length,; j += 1)
{
var nbr := nbrs[group[i][j]];
if (self[r + nbr[1]][c + nbr[0]] == $32)
{ count := count + 1; ^ true$break; };
^ false
}
};
Line 1,808 ⟶ 1,806:
firstStep := firstStep.Inverted;
for(int r := 1,; r < self.Rows, - 1; r += 1)
{
for(int c := 1,; c < self.Columns, - 1; c += 1)
{
if(self.proceed(r,c,toWhite,firstStep))
Line 1,817 ⟶ 1,815:
};
toWhite.forEach::(p){ self[p.y][p.x] := $32 };
toWhite.clear()
}
Line 1,826 ⟶ 1,824:
var it := self.enumerator();
it.forEach::(ch){ console.print(ch," ") };
while (it.next())
{
console.writeLine();
 
it.forEach::(ch){ console.print(ch," ") }
}
}
Line 1,858 ⟶ 1,856:
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # #
# # # #
# # # #
# # #
# # # # #
# # # # # # # # # # # #
# # # # # # # # # # # # #
# # #
# # #
# # #
# # #
# # #
# # # # # # # # # # # # #
# # # # # #
Line 5,054 ⟶ 5,052:
=={{header|Wren}}==
{{trans|Kotlin}}
<syntaxhighlight lang="ecmascriptwren">class Point {
construct new(x, y) {
_x = x
9,476

edits