Zhang-Suen thinning algorithm: Difference between revisions

Content added Content deleted
m (Added syntax highlighting (working from the back of the task list).)
m (syntax highlighting fixup automation)
Line 111: Line 111:
{{trans|Python}}
{{trans|Python}}


<syntaxhighlight lang=11l>V beforeTxt = |‘1100111
<syntaxhighlight lang="11l">V beforeTxt = |‘1100111
1100111
1100111
1100111
1100111
Line 263: Line 263:


=={{header|Action!}}==
=={{header|Action!}}==
<syntaxhighlight lang=Action!>PROC DrawImage(BYTE ARRAY image BYTE x,y,width,height)
<syntaxhighlight lang="action!">PROC DrawImage(BYTE ARRAY image BYTE x,y,width,height)
BYTE i,j
BYTE i,j
BYTE POINTER ptr
BYTE POINTER ptr
Line 398: Line 398:


=={{header|AppleScript}}==
=={{header|AppleScript}}==
<syntaxhighlight lang=applescript>-- Params:
<syntaxhighlight lang="applescript">-- Params:
-- List of lists (rows) of "pixel" values.
-- List of lists (rows) of "pixel" values.
-- Record indicating the values representing black and white.
-- Record indicating the values representing black and white.
Line 503: Line 503:
00000000000000000000000000000000"</pre>
00000000000000000000000000000000"</pre>
Alternative demo:
Alternative demo:
<syntaxhighlight lang=applescript>on demo()
<syntaxhighlight lang="applescript">on demo()
set pattern to "
set pattern to "
################# #############
################# #############
Line 556: Line 556:
{{works with|AutoHotkey_L}}
{{works with|AutoHotkey_L}}
Reads input from a text file and writes output to a different text file (first creating the file, if necessary).
Reads input from a text file and writes output to a different text file (first creating the file, if necessary).
<syntaxhighlight lang=AutoHotkey>FileIn := A_ScriptDir "\Zhang-Suen.txt"
<syntaxhighlight lang="autohotkey">FileIn := A_ScriptDir "\Zhang-Suen.txt"
FileOut := A_ScriptDir "\NewFile.txt"
FileOut := A_ScriptDir "\NewFile.txt"


Line 655: Line 655:
</pre>
</pre>
The images before and after thinning are also printed on the console.
The images before and after thinning are also printed on the console.
<syntaxhighlight lang=C>
<syntaxhighlight lang="c">
#include<stdlib.h>
#include<stdlib.h>
#include<stdio.h>
#include<stdio.h>
Line 886: Line 886:
=={{header|C++}}==
=={{header|C++}}==
Compiled with --std=c++14
Compiled with --std=c++14
<syntaxhighlight lang=CPP>#include <iostream>
<syntaxhighlight lang="cpp">#include <iostream>
#include <string>
#include <string>
#include <sstream>
#include <sstream>
Line 1,201: Line 1,201:
=={{header|D}}==
=={{header|D}}==
This uses the module from the Bitmap Task. And it performs no heap allocations.
This uses the module from the Bitmap Task. And it performs no heap allocations.
<syntaxhighlight lang=d>import std.stdio, std.algorithm, std.string, std.functional,
<syntaxhighlight lang="d">import std.stdio, std.algorithm, std.string, std.functional,
std.typecons, std.typetuple, bitmap;
std.typecons, std.typetuple, bitmap;


Line 1,429: Line 1,429:
ELENA 5.0 :
ELENA 5.0 :
{{trans|Java}}
{{trans|Java}}
<syntaxhighlight lang=elena>import system'collections;
<syntaxhighlight lang="elena">import system'collections;
import system'routines;
import system'routines;
import extensions;
import extensions;
Line 1,620: Line 1,620:
=={{header|Elixir}}==
=={{header|Elixir}}==
{{trans|Ruby}}
{{trans|Ruby}}
<syntaxhighlight lang=elixir>defmodule ZhangSuen do
<syntaxhighlight lang="elixir">defmodule ZhangSuen do
@neighbours [{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1}] # 8 neighbours
@neighbours [{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1}] # 8 neighbours
Line 1,772: Line 1,772:


=={{header|Fortran}}==
=={{header|Fortran}}==
With F90 came standardisation of a variety of array manipulation facilities. Since the image array is to be inspected as a whole then adjusted rather than adjusted step-by-step as it is inspected, the first thought was to employ the special facility of the FOR ALL statement, which is that in an expression such as <syntaxhighlight lang=Fortarn>FOR ALL (i = 2:n - 1) A(i) = (A(i - 1) + A(i) + A(i + 1))/3</syntaxhighlight> all right-hand-side expressions will be evaluated with the original values of the array, while in the less special array assignment <syntaxhighlight lang=Fortran>A(2:N - 1) = (A(1:N - 2) + A(2:N - 1) + A(3:N))/3</syntaxhighlight> as in the case of the equivalent DO-loop, the processing will be with a mixture of old and new values as the loop proceeds.
With F90 came standardisation of a variety of array manipulation facilities. Since the image array is to be inspected as a whole then adjusted rather than adjusted step-by-step as it is inspected, the first thought was to employ the special facility of the FOR ALL statement, which is that in an expression such as <syntaxhighlight lang="fortarn">FOR ALL (i = 2:n - 1) A(i) = (A(i - 1) + A(i) + A(i + 1))/3</syntaxhighlight> all right-hand-side expressions will be evaluated with the original values of the array, while in the less special array assignment <syntaxhighlight lang="fortran">A(2:N - 1) = (A(1:N - 2) + A(2:N - 1) + A(3:N))/3</syntaxhighlight> as in the case of the equivalent DO-loop, the processing will be with a mixture of old and new values as the loop proceeds.


So, that suggests something like <syntaxhighlight lang=Fortran> FOR ALL (I = 2:N - 1, J = 2:M - 1)
So, that suggests something like <syntaxhighlight lang="fortran"> FOR ALL (I = 2:N - 1, J = 2:M - 1)
WHERE(DOT(I,J) .NE. 0) DOT(I,J) = ADJUST(DOT,I,J)</syntaxhighlight>
WHERE(DOT(I,J) .NE. 0) DOT(I,J) = ADJUST(DOT,I,J)</syntaxhighlight>
This requires function ADJUST to be a "pure" function, and they are not supposed to perpetrate side effects, such as one reporting that any adjustment was made. Nor is it clear that array DOT must be presented as a parameter either as the entire array or as element DOT(i,j), or if not, that it can be global to function ADJUST - which would also be an impurity - and for that matter, variables I and J could be global also...
This requires function ADJUST to be a "pure" function, and they are not supposed to perpetrate side effects, such as one reporting that any adjustment was made. Nor is it clear that array DOT must be presented as a parameter either as the entire array or as element DOT(i,j), or if not, that it can be global to function ADJUST - which would also be an impurity - and for that matter, variables I and J could be global also...
Line 1,780: Line 1,780:
Instead, thought turned to more closely following the task specification, which involves producing a list of elements to be adjusted after an inspection pass. Given that array DOT is two-dimensional, it would be nice if an element could be indexed via an expression such as <code>DOT(INDEX)</code> where INDEX was an array of two elements with INDEX(1) = i, and INDEX(2) = j, so as to access DOT(i,j) If this were possible, then obviously one could hope that array INDEX could be extended so as to store the multiple elements of a list of such locations to access, with a view to <code>DOT(INDEX(1:n)) = 0</code> adjusting the image.
Instead, thought turned to more closely following the task specification, which involves producing a list of elements to be adjusted after an inspection pass. Given that array DOT is two-dimensional, it would be nice if an element could be indexed via an expression such as <code>DOT(INDEX)</code> where INDEX was an array of two elements with INDEX(1) = i, and INDEX(2) = j, so as to access DOT(i,j) If this were possible, then obviously one could hope that array INDEX could be extended so as to store the multiple elements of a list of such locations to access, with a view to <code>DOT(INDEX(1:n)) = 0</code> adjusting the image.


Alas, such a syntax form is not accommodated. However, F90 also introduced the ability to define and use compound data types, such as the type PLACE as used below. It is not possible to define a type of a special, recognised form, such as say "SUBSCRIPT LIST" that can be used as dreamt of above, so the components are just ordinary variables. Two ordinary arrays could be used, one for each of the two subscripts, or a compound type could be devised in a hint towards self-documentation. Thus, <syntaxhighlight lang=Fortran> DOT(WHACK(1:WHACKCOUNT).I,WHACK(1:WHACKCOUNT).J) = 0</syntaxhighlight>
Alas, such a syntax form is not accommodated. However, F90 also introduced the ability to define and use compound data types, such as the type PLACE as used below. It is not possible to define a type of a special, recognised form, such as say "SUBSCRIPT LIST" that can be used as dreamt of above, so the components are just ordinary variables. Two ordinary arrays could be used, one for each of the two subscripts, or a compound type could be devised in a hint towards self-documentation. Thus, <syntaxhighlight lang="fortran"> DOT(WHACK(1:WHACKCOUNT).I,WHACK(1:WHACKCOUNT).J) = 0</syntaxhighlight>


But it doesn't work... After a fair amount of head scratching, not at all assisted by the woolly generalities and inane examples of the compiler's "help" collection, it became apparent that the expression did not work through a list of indices as anticipated, but instead, for ''each'' value of the first index, ''all'' the values of the second index were selected. Thus, instead of the first change being DOT(WHACK('''1''').I,WHACK('''1''').J) only, it was DOT(WHACK('''1''').I,WHACK('''1:WHACKCOUNT''').J) that were being cleared. Accordingly, the fancy syntax has to be abandoned in favour of a specific DO-loop.
But it doesn't work... After a fair amount of head scratching, not at all assisted by the woolly generalities and inane examples of the compiler's "help" collection, it became apparent that the expression did not work through a list of indices as anticipated, but instead, for ''each'' value of the first index, ''all'' the values of the second index were selected. Thus, instead of the first change being DOT(WHACK('''1''').I,WHACK('''1''').J) only, it was DOT(WHACK('''1''').I,WHACK('''1:WHACKCOUNT''').J) that were being cleared. Accordingly, the fancy syntax has to be abandoned in favour of a specific DO-loop.


<syntaxhighlight lang=Fortran> MODULE ZhangSuenThinning !Image manipulation.
<syntaxhighlight lang="fortran"> MODULE ZhangSuenThinning !Image manipulation.
CONTAINS
CONTAINS
SUBROUTINE ZST(DOT) !Attempts to thin out thick lines.
SUBROUTINE ZST(DOT) !Attempts to thin out thick lines.
Line 1,919: Line 1,919:


=={{header|FreeBASIC}}==
=={{header|FreeBASIC}}==
<syntaxhighlight lang=freebasic>' version 08-10-2016
<syntaxhighlight lang="freebasic">' version 08-10-2016
' compile with: fbc -s console
' compile with: fbc -s console


Line 2,079: Line 2,079:


=={{header|Go}}==
=={{header|Go}}==
<syntaxhighlight lang=go>package main
<syntaxhighlight lang="go">package main


import (
import (
Line 2,283: Line 2,283:


=={{header|Groovy}}==
=={{header|Groovy}}==
<syntaxhighlight lang=groovy>def zhangSuen(text) {
<syntaxhighlight lang="groovy">def zhangSuen(text) {
def image = text.split('\n').collect { line -> line.collect { it == '#' ? 1 : 0} }
def image = text.split('\n').collect { line -> line.collect { it == '#' ? 1 : 0} }
def p2, p3, p4, p5, p6, p7, p8, p9
def p2, p3, p4, p5, p6, p7, p8, p9
Line 2,309: Line 2,309:
}</syntaxhighlight>
}</syntaxhighlight>
Testing:
Testing:
<syntaxhighlight lang=groovy>def small = """\
<syntaxhighlight lang="groovy">def small = """\
................................
................................
.#########.......########.......
.#########.......########.......
Line 2,412: Line 2,412:


=={{header|Haskell}}==
=={{header|Haskell}}==
<syntaxhighlight lang=Haskell>import Data.Array
<syntaxhighlight lang="haskell">import Data.Array
import qualified Data.List as List
import qualified Data.List as List


Line 2,564: Line 2,564:
=={{header|J}}==
=={{header|J}}==
'''Solution:'''
'''Solution:'''
<syntaxhighlight lang=j>isBlackPx=: '1'&=;._2 NB. boolean array of black pixels
<syntaxhighlight lang="j">isBlackPx=: '1'&=;._2 NB. boolean array of black pixels
toImage=: [: , LF ,.~ '01' {~ ] NB. convert to original representation
toImage=: [: , LF ,.~ '01' {~ ] NB. convert to original representation
frameImg=: 0 ,. 0 , >:@$ {. ] NB. adds border of 0's to image
frameImg=: 0 ,. 0 , >:@$ {. ] NB. adds border of 0's to image
Line 2,590: Line 2,590:
zhangSuen=: [: toImage [: step2@step1^:_ isBlackPx</syntaxhighlight>
zhangSuen=: [: toImage [: step2@step1^:_ isBlackPx</syntaxhighlight>
'''Alternative, explicit representation of last verb above'''
'''Alternative, explicit representation of last verb above'''
<syntaxhighlight lang=j>zhangSuenX=: verb define
<syntaxhighlight lang="j">zhangSuenX=: verb define
img=. isBlackPx y
img=. isBlackPx y
whilst. 0 < +/ , msk1 +.&-. msk2 do.
whilst. 0 < +/ , msk1 +.&-. msk2 do.
Line 2,601: Line 2,601:
)</syntaxhighlight>
)</syntaxhighlight>
'''Example Use:'''
'''Example Use:'''
<syntaxhighlight lang=j>toASCII=: ' #' {~ '1'&=;._2 NB. convert to ASCII representation
<syntaxhighlight lang="j">toASCII=: ' #' {~ '1'&=;._2 NB. convert to ASCII representation


ExampleImg=: noun define
ExampleImg=: noun define
Line 2,630: Line 2,630:
=={{header|Java}}==
=={{header|Java}}==
{{works with|Java|7}}
{{works with|Java|7}}
<syntaxhighlight lang=java>import java.awt.Point;
<syntaxhighlight lang="java">import java.awt.Point;
import java.util.*;
import java.util.*;


Line 2,768: Line 2,768:
=={{header|JavaScript}}==
=={{header|JavaScript}}==
{{trans|Java}}
{{trans|Java}}
<syntaxhighlight lang=javascript>function Point(x, y) {
<syntaxhighlight lang="javascript">function Point(x, y) {
this.x = x;
this.x = x;
this.y = y;
this.y = y;
Line 2,894: Line 2,894:


=={{header|Julia}}==
=={{header|Julia}}==
<syntaxhighlight lang=julia>
<syntaxhighlight lang="julia">
const pixelstring =
const pixelstring =
"00000000000000000000000000000000" *
"00000000000000000000000000000000" *
Line 2,989: Line 2,989:
=={{header|Kotlin}}==
=={{header|Kotlin}}==
{{trans|Java}}
{{trans|Java}}
<syntaxhighlight lang=scala>// version 1.1.2
<syntaxhighlight lang="scala">// version 1.1.2


class Point(val x: Int, val y: Int)
class Point(val x: Int, val y: Int)
Line 3,111: Line 3,111:


=={{header|Lua}}==
=={{header|Lua}}==
<syntaxhighlight lang=lua>function zhangSuenThin(img)
<syntaxhighlight lang="lua">function zhangSuenThin(img)
local dirs={
local dirs={
{ 0,-1},
{ 0,-1},
Line 3,270: Line 3,270:
Mathematica supports directly the Thinning methods "Morphological" and "MedialAxis".
Mathematica supports directly the Thinning methods "Morphological" and "MedialAxis".
The Zhang-Suen algorithm implementation could be done with:
The Zhang-Suen algorithm implementation could be done with:
<syntaxhighlight lang=Mathematica>nB[mat_] := Delete[mat // Flatten, 5] // Total;
<syntaxhighlight lang="mathematica">nB[mat_] := Delete[mat // Flatten, 5] // Total;


nA[mat_] := Module[{l},
nA[mat_] := Module[{l},
Line 3,451: Line 3,451:


=={{header|Nim}}==
=={{header|Nim}}==
<syntaxhighlight lang=Nim>import math, sequtils, strutils
<syntaxhighlight lang="nim">import math, sequtils, strutils


type
type
Line 3,574: Line 3,574:
=={{header|Perl}}==
=={{header|Perl}}==
{{trans|Raku}}
{{trans|Raku}}
<syntaxhighlight lang=perl>use List::Util qw(sum min);
<syntaxhighlight lang="perl">use List::Util qw(sum min);


$source = <<'END';
$source = <<'END';
Line 3,658: Line 3,658:


=={{header|Phix}}==
=={{header|Phix}}==
<!--<syntaxhighlight lang=Phix>(phixonline)-->
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">n</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{{-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">0</span><span style="color: #0000FF;">},{-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">0</span><span style="color: #0000FF;">},{</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">0</span><span style="color: #0000FF;">}};</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">n</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{{-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">0</span><span style="color: #0000FF;">},{-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">0</span><span style="color: #0000FF;">},{</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">},{-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">0</span><span style="color: #0000FF;">}};</span>
Line 3,741: Line 3,741:


=={{header|PL/I}}==
=={{header|PL/I}}==
<syntaxhighlight lang=PL/I>zhang: procedure options (main); /* 8 July 2014 */
<syntaxhighlight lang="pl/i">zhang: procedure options (main); /* 8 July 2014 */


declare pic(10) bit(32) initial (
declare pic(10) bit(32) initial (
Line 3,954: Line 3,954:
=={{header|Python}}==
=={{header|Python}}==
Several input images are converted.
Several input images are converted.
<syntaxhighlight lang=python># -*- coding: utf-8 -*-
<syntaxhighlight lang="python"># -*- coding: utf-8 -*-


# Example from [http://nayefreza.wordpress.com/2013/05/11/zhang-suen-thinning-algorithm-java-implementation/ this blog post].
# Example from [http://nayefreza.wordpress.com/2013/05/11/zhang-suen-thinning-algorithm-java-implementation/ this blog post].
Line 4,101: Line 4,101:
=={{header|Racket}}==
=={{header|Racket}}==


<syntaxhighlight lang=racket>#lang racket
<syntaxhighlight lang="racket">#lang racket
(define (img-01string->vector str)
(define (img-01string->vector str)
(define lines (regexp-split "\n" str))
(define lines (regexp-split "\n" str))
Line 4,244: Line 4,244:
(formerly Perl 6)
(formerly Perl 6)
Source image may be based on any characters whose low bits are 0 or 1 (which conveniently includes . and #).
Source image may be based on any characters whose low bits are 0 or 1 (which conveniently includes . and #).
<syntaxhighlight lang=perl6>my $source = qq:to/EOD/;
<syntaxhighlight lang="raku" line>my $source = qq:to/EOD/;
................................
................................
.#########.......########.......
.#########.......########.......
Line 4,314: Line 4,314:


=={{header|REXX}}==
=={{header|REXX}}==
<syntaxhighlight lang=rexx>/*REXX program thins a NxM character grid using the Zhang-Suen thinning algorithm.*/
<syntaxhighlight lang="rexx">/*REXX program thins a NxM character grid using the Zhang-Suen thinning algorithm.*/
parse arg iFID .; if iFID=='' then iFID='ZHANG_SUEN.DAT'
parse arg iFID .; if iFID=='' then iFID='ZHANG_SUEN.DAT'
white=' '; @.=white /* [↓] read the input character grid. */
white=' '; @.=white /* [↓] read the input character grid. */
Line 4,428: Line 4,428:
First I define a function zs which given a point and its eight neighbours returns 1 if the point may be culled, 0 otherwise. g indicates if this is step 1 or step 2 in the task description. zs may be changed to remember the step independently if the reader does not wish to explore the algorithm.
First I define a function zs which given a point and its eight neighbours returns 1 if the point may be culled, 0 otherwise. g indicates if this is step 1 or step 2 in the task description. zs may be changed to remember the step independently if the reader does not wish to explore the algorithm.


<syntaxhighlight lang=ruby>class ZhangSuen
<syntaxhighlight lang="ruby">class ZhangSuen
NEIGHBOUR8 = [[-1,0],[-1,1],[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1]] # 8 neighbors
NEIGHBOUR8 = [[-1,0],[-1,1],[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1]] # 8 neighbors
CIRCULARS = NEIGHBOUR8 + [NEIGHBOUR8.first] # P2, ... P9, P2
CIRCULARS = NEIGHBOUR8 + [NEIGHBOUR8.first] # P2, ... P9, P2
Line 4,513: Line 4,513:
=={{header|Sidef}}==
=={{header|Sidef}}==
{{trans|Ruby}}
{{trans|Ruby}}
<syntaxhighlight lang=ruby>class ZhangSuen(str, black="1") {
<syntaxhighlight lang="ruby">class ZhangSuen(str, black="1") {
const NEIGHBOURS = [[-1,0],[-1,1],[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1]] # 8 neighbors
const NEIGHBOURS = [[-1,0],[-1,1],[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1]] # 8 neighbors
const CIRCULARS = (NEIGHBOURS + [NEIGHBOURS.first]) # P2, ... P9, P2
const CIRCULARS = (NEIGHBOURS + [NEIGHBOURS.first]) # P2, ... P9, P2
Line 4,587: Line 4,587:
{{trans|Python}}
{{trans|Python}}


<syntaxhighlight lang=swift>import UIKit
<syntaxhighlight lang="swift">import UIKit


// testing examples
// testing examples
Line 4,862: Line 4,862:
=={{header|Tcl}}==
=={{header|Tcl}}==
Only the single image is converted.
Only the single image is converted.
<syntaxhighlight lang=tcl># -*- coding: utf-8 -*-
<syntaxhighlight lang="tcl"># -*- coding: utf-8 -*-


set data {
set data {
Line 4,957: Line 4,957:
=={{header|VBA}}==
=={{header|VBA}}==
{{trans|Phix}}
{{trans|Phix}}
<syntaxhighlight lang=vb>Public n As Variant
<syntaxhighlight lang="vb">Public n As Variant
Private Sub init()
Private Sub init()
n = [{-1,0;-1,1;0,1;1,1;1,0;1,-1;0,-1;-1,-1;-1,0}]
n = [{-1,0;-1,1;0,1;1,1;1,0;1,-1;0,-1;-1,-1;-1,0}]
Line 5,053: Line 5,053:
=={{header|Wren}}==
=={{header|Wren}}==
{{trans|Kotlin}}
{{trans|Kotlin}}
<syntaxhighlight lang=ecmascript>class Point {
<syntaxhighlight lang="ecmascript">class Point {
construct new(x, y) {
construct new(x, y) {
_x = x
_x = x