kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Real constants and functions
C#: using System;

class Program {
    static void Main(string[] args) {        
        Console.WriteLine(Math.E); 
        Console.WriteLine(Math.PI); 
        Console.WriteLine(Math.Sqrt(10)); 
        Console.WriteLine(Math.Log(10)); 
        Console.WriteLine(Math.Log10(10)); 
        Console.WriteLine(Math.Exp(10)); 
        Console.WriteLine(Math.Abs(10)); 
        Console.WriteLine(Math.Floor(10.0)); 
        Console.WriteLine(Math.Ceiling(10.0)); 
        Console.WriteLine(Math.Pow(2, 5)); 
    }
}

Java: Math.E; 
Math.PI; 
Math.sqrt(x); 
Math.log(x); 
Math.exp(x); 
Math.abs(x); 
Math.floor(x); 
Math.ceil(x); 
Math.pow(x,y);
Task: Real constants and functions
C#: using System;

class Program {
    static void Main(string[] args) {        
        Console.WriteLine(Math.E); 
        Console.WriteLine(Math.PI); 
        Console.WriteLine(Math.Sqrt(10)); 
        Console.WriteLine(Math.Log(10)); 
        Console.WriteLine(Math.Log10(10)); 
        Console.WriteLine(Math.Exp(10)); 
        Console.WriteLine(Math.Abs(10)); 
        Console.WriteLine(Math.Floor(10.0)); 
        Console.WriteLine(Math.Ceiling(10.0)); 
        Console.WriteLine(Math.Pow(2, 5)); 
    }
}

Python: import math

math.e          
math.pi         
math.sqrt(x)    
math.log(x)     
math.log10(x)   
math.exp(x)     
abs(x)          
math.floor(x)   
math.ceil(x)    
x ** y          
pow(x, y[, n])
Task: Real constants and functions
Go: package main

import (
    "fmt"
    "math"
    "math/big"
)

func main() {
    
    
    
    fmt.Println("float64 values:")
    fmt.Println("e:", math.E)
    fmt.Println("π:", math.Pi)

    

    
    fmt.Println("square root(1.44):", math.Sqrt(1.44))
    
    
    
    fmt.Println("ln(e):", math.Log(math.E))
    
    fmt.Println("exponential(1):", math.Exp(1))
    fmt.Println("absolute value(-1.2):", math.Abs(-1.2))
    fmt.Println("floor(-1.2):", math.Floor(-1.2))
    fmt.Println("ceiling(-1.2):", math.Ceil(-1.2))
    fmt.Println("power(1.44, .5):", math.Pow(1.44, .5))

    
    
    fmt.Println("\nfloat32 values:")
    fmt.Println("e:", float32(math.E))
    fmt.Println("π:", float32(math.Pi))

    
    
    
    
    
    
    
    pi := "3.141592653589793238462643383279502884197169399375105820974944"
    π, _, _ := big.ParseFloat(pi, 10, 200, 0)
    fmt.Println("\nbig.Float values:")
    fmt.Println("π:", π)
    
    x := new(big.Float).Neg(π)
    y := new(big.Float)
    fmt.Println("x:", x)
    fmt.Println("abs(x):", y.Abs(x))
}

Java: Math.E; 
Math.PI; 
Math.sqrt(x); 
Math.log(x); 
Math.exp(x); 
Math.abs(x); 
Math.floor(x); 
Math.ceil(x); 
Math.pow(x,y);
Task: Real constants and functions
Java: Math.E; 
Math.PI; 
Math.sqrt(x); 
Math.log(x); 
Math.exp(x); 
Math.abs(x); 
Math.floor(x); 
Math.ceil(x); 
Math.pow(x,y); 

Python: import math

math.e          
math.pi         
math.sqrt(x)    
math.log(x)     
math.log10(x)   
math.exp(x)     
abs(x)          
math.floor(x)   
math.ceil(x)    
x ** y          
pow(x, y[, n])
Task: Real constants and functions
C++: #include <iostream>
#include <cmath>

#ifdef M_E
static double euler_e = M_E;
#else
static double euler_e = std::exp(1); 
#endif

#ifdef M_PI
static double pi = M_PI;
#else
static double pi = std::acos(-1);
#endif

int main()
{
  std::cout << "e = " << euler_e
            << "\npi = " << pi
            << "\nsqrt(2) = " << std::sqrt(2.0)
            << "\nln(e) = " << std::log(euler_e)
            << "\nlg(100) = " << std::log10(100.0)
            << "\nexp(3) = " << std::exp(3.0)
            << "\n|-4.5| = " << std::abs(-4.5)   
            << "\nfloor(4.5) = " << std::floor(4.5)
            << "\nceiling(4.5) = " << std::ceil(4.5)
            << "\npi^2 = " << std::pow(pi,2.0) << std::endl;
}

Python: import math

math.e          
math.pi         
math.sqrt(x)    
math.log(x)     
math.log10(x)   
math.exp(x)     
abs(x)          
math.floor(x)   
math.ceil(x)    
x ** y          
pow(x, y[, n])
Task: Real constants and functions
C#: using System;

class Program {
    static void Main(string[] args) {        
        Console.WriteLine(Math.E); 
        Console.WriteLine(Math.PI); 
        Console.WriteLine(Math.Sqrt(10)); 
        Console.WriteLine(Math.Log(10)); 
        Console.WriteLine(Math.Log10(10)); 
        Console.WriteLine(Math.Exp(10)); 
        Console.WriteLine(Math.Abs(10)); 
        Console.WriteLine(Math.Floor(10.0)); 
        Console.WriteLine(Math.Ceiling(10.0)); 
        Console.WriteLine(Math.Pow(2, 5)); 
    }
}

C++: #include <iostream>
#include <cmath>

#ifdef M_E
static double euler_e = M_E;
#else
static double euler_e = std::exp(1); 
#endif

#ifdef M_PI
static double pi = M_PI;
#else
static double pi = std::acos(-1);
#endif

int main()
{
  std::cout << "e = " << euler_e
            << "\npi = " << pi
            << "\nsqrt(2) = " << std::sqrt(2.0)
            << "\nln(e) = " << std::log(euler_e)
            << "\nlg(100) = " << std::log10(100.0)
            << "\nexp(3) = " << std::exp(3.0)
            << "\n|-4.5| = " << std::abs(-4.5)   
            << "\nfloor(4.5) = " << std::floor(4.5)
            << "\nceiling(4.5) = " << std::ceil(4.5)
            << "\npi^2 = " << std::pow(pi,2.0) << std::endl;
}
Task: Real constants and functions
Go: package main

import (
    "fmt"
    "math"
    "math/big"
)

func main() {
    
    
    
    fmt.Println("float64 values:")
    fmt.Println("e:", math.E)
    fmt.Println("π:", math.Pi)

    

    
    fmt.Println("square root(1.44):", math.Sqrt(1.44))
    
    
    
    fmt.Println("ln(e):", math.Log(math.E))
    
    fmt.Println("exponential(1):", math.Exp(1))
    fmt.Println("absolute value(-1.2):", math.Abs(-1.2))
    fmt.Println("floor(-1.2):", math.Floor(-1.2))
    fmt.Println("ceiling(-1.2):", math.Ceil(-1.2))
    fmt.Println("power(1.44, .5):", math.Pow(1.44, .5))

    
    
    fmt.Println("\nfloat32 values:")
    fmt.Println("e:", float32(math.E))
    fmt.Println("π:", float32(math.Pi))

    
    
    
    
    
    
    
    pi := "3.141592653589793238462643383279502884197169399375105820974944"
    π, _, _ := big.ParseFloat(pi, 10, 200, 0)
    fmt.Println("\nbig.Float values:")
    fmt.Println("π:", π)
    
    x := new(big.Float).Neg(π)
    y := new(big.Float)
    fmt.Println("x:", x)
    fmt.Println("abs(x):", y.Abs(x))
}

Python: import math

math.e          
math.pi         
math.sqrt(x)    
math.log(x)     
math.log10(x)   
math.exp(x)     
abs(x)          
math.floor(x)   
math.ceil(x)    
x ** y          
pow(x, y[, n])
Task: Real constants and functions
C: #include <math.h>

M_E; 
M_PI; 
sqrt(x); 
log(x); 
exp(x); 
abs(x); 
fabs(x); 
floor(x); 
ceil(x); 
pow(x,y); 

PHP: M_E; //e
M_PI; //pi
sqrt(x); //square root
log(x); //natural logarithm--log base 10 also available (log10)
exp(x); //exponential
abs(x); //absolute value
floor(x); //floor
ceil(x); //ceiling
pow(x,y); //power
Task: Real constants and functions
C#: using System;

class Program {
    static void Main(string[] args) {        
        Console.WriteLine(Math.E); 
        Console.WriteLine(Math.PI); 
        Console.WriteLine(Math.Sqrt(10)); 
        Console.WriteLine(Math.Log(10)); 
        Console.WriteLine(Math.Log10(10)); 
        Console.WriteLine(Math.Exp(10)); 
        Console.WriteLine(Math.Abs(10)); 
        Console.WriteLine(Math.Floor(10.0)); 
        Console.WriteLine(Math.Ceiling(10.0)); 
        Console.WriteLine(Math.Pow(2, 5)); 
    }
}

PHP: M_E; //e
M_PI; //pi
sqrt(x); //square root
log(x); //natural logarithm--log base 10 also available (log10)
exp(x); //exponential
abs(x); //absolute value
floor(x); //floor
ceil(x); //ceiling
pow(x,y); //power
Task: Real constants and functions
C++: #include <iostream>
#include <cmath>

#ifdef M_E
static double euler_e = M_E;
#else
static double euler_e = std::exp(1); 
#endif

#ifdef M_PI
static double pi = M_PI;
#else
static double pi = std::acos(-1);
#endif

int main()
{
  std::cout << "e = " << euler_e
            << "\npi = " << pi
            << "\nsqrt(2) = " << std::sqrt(2.0)
            << "\nln(e) = " << std::log(euler_e)
            << "\nlg(100) = " << std::log10(100.0)
            << "\nexp(3) = " << std::exp(3.0)
            << "\n|-4.5| = " << std::abs(-4.5)   
            << "\nfloor(4.5) = " << std::floor(4.5)
            << "\nceiling(4.5) = " << std::ceil(4.5)
            << "\npi^2 = " << std::pow(pi,2.0) << std::endl;
}

PHP: M_E; //e
M_PI; //pi
sqrt(x); //square root
log(x); //natural logarithm--log base 10 also available (log10)
exp(x); //exponential
abs(x); //absolute value
floor(x); //floor
ceil(x); //ceiling
pow(x,y); //power
Task: Real constants and functions
Go: package main

import (
    "fmt"
    "math"
    "math/big"
)

func main() {
    
    
    
    fmt.Println("float64 values:")
    fmt.Println("e:", math.E)
    fmt.Println("π:", math.Pi)

    

    
    fmt.Println("square root(1.44):", math.Sqrt(1.44))
    
    
    
    fmt.Println("ln(e):", math.Log(math.E))
    
    fmt.Println("exponential(1):", math.Exp(1))
    fmt.Println("absolute value(-1.2):", math.Abs(-1.2))
    fmt.Println("floor(-1.2):", math.Floor(-1.2))
    fmt.Println("ceiling(-1.2):", math.Ceil(-1.2))
    fmt.Println("power(1.44, .5):", math.Pow(1.44, .5))

    
    
    fmt.Println("\nfloat32 values:")
    fmt.Println("e:", float32(math.E))
    fmt.Println("π:", float32(math.Pi))

    
    
    
    
    
    
    
    pi := "3.141592653589793238462643383279502884197169399375105820974944"
    π, _, _ := big.ParseFloat(pi, 10, 200, 0)
    fmt.Println("\nbig.Float values:")
    fmt.Println("π:", π)
    
    x := new(big.Float).Neg(π)
    y := new(big.Float)
    fmt.Println("x:", x)
    fmt.Println("abs(x):", y.Abs(x))
}

PHP: M_E; //e
M_PI; //pi
sqrt(x); //square root
log(x); //natural logarithm--log base 10 also available (log10)
exp(x); //exponential
abs(x); //absolute value
floor(x); //floor
ceil(x); //ceiling
pow(x,y); //power
Task: Real constants and functions
Java: Math.E; 
Math.PI; 
Math.sqrt(x); 
Math.log(x); 
Math.exp(x); 
Math.abs(x); 
Math.floor(x); 
Math.ceil(x); 
Math.pow(x,y); 

PHP: M_E; //e
M_PI; //pi
sqrt(x); //square root
log(x); //natural logarithm--log base 10 also available (log10)
exp(x); //exponential
abs(x); //absolute value
floor(x); //floor
ceil(x); //ceiling
pow(x,y); //power
Task: Real constants and functions
Python: import math

math.e          
math.pi         
math.sqrt(x)    
math.log(x)     
math.log10(x)   
math.exp(x)     
abs(x)          
math.floor(x)   
math.ceil(x)    
x ** y          
pow(x, y[, n])  




PHP: M_E; //e
M_PI; //pi
sqrt(x); //square root
log(x); //natural logarithm--log base 10 also available (log10)
exp(x); //exponential
abs(x); //absolute value
floor(x); //floor
ceil(x); //ceiling
pow(x,y); //power
Task: Real constants and functions
VB: Public Sub Main() 
  
  Dim e As Float = Exp(1) 
  
  Print "e     = "; e 
  Print "π     = "; Pi 
  Dim x As Float = 12.345 
  Dim y As Float = 1.23 
  Print "sqrt  = "; Sqr(x)
  Print "ln    = "; Log(x)
  Print "log10 = "; Log(x) / Log(10) 
  Print "log   = "; Log(x) / Log(y)
  Print "exp   = "; Exp(x)          
  Print "abs   = "; Abs(-x)
  Print "floor = "; Floor(x)
  Print "ceil  = "; Ceil(x)
  Print "power = "; x ^ y 
  
End

PHP: M_E; //e
M_PI; //pi
sqrt(x); //square root
log(x); //natural logarithm--log base 10 also available (log10)
exp(x); //exponential
abs(x); //absolute value
floor(x); //floor
ceil(x); //ceiling
pow(x,y); //power
Task: Conway's Game of Life
C: #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define for_x for (int x = 0; x < w; x++)
#define for_y for (int y = 0; y < h; y++)
#define for_xy for_x for_y
void show(void *u, int w, int h)
{
	int (*univ)[w] = u;
	printf("\033[H");
	for_y {
		for_x printf(univ[y][x] ? "\033[07m  \033[m" : "  ");
		printf("\033[E");
	}
	fflush(stdout);
}

void evolve(void *u, int w, int h)
{
	unsigned (*univ)[w] = u;
	unsigned new[h][w];

	for_y for_x {
		int n = 0;
		for (int y1 = y - 1; y1 <= y + 1; y1++)
			for (int x1 = x - 1; x1 <= x + 1; x1++)
				if (univ[(y1 + h) % h][(x1 + w) % w])
					n++;

		if (univ[y][x]) n--;
		new[y][x] = (n == 3 || (n == 2 && univ[y][x]));
	}
	for_y for_x univ[y][x] = new[y][x];
}

void game(int w, int h)
{
	unsigned univ[h][w];
	for_xy univ[y][x] = rand() < RAND_MAX / 10 ? 1 : 0;
	while (1) {
		show(univ, w, h);
		evolve(univ, w, h);
		usleep(200000);
	}
}

int main(int c, char **v)
{
	int w = 0, h = 0;
	if (c > 1) w = atoi(v[1]);
	if (c > 2) h = atoi(v[2]);
	if (w <= 0) w = 30;
	if (h <= 0) h = 30;
	game(w, h);
}

Go: package main

import (
	"bytes"
	"fmt"
	"math/rand"
	"time"
)

type Field struct {
	s    [][]bool
	w, h int
}

func NewField(w, h int) Field {
	s := make([][]bool, h)
	for i := range s {
		s[i] = make([]bool, w)
	}
	return Field{s: s, w: w, h: h}
}

func (f Field) Set(x, y int, b bool) {
	f.s[y][x] = b
}

func (f Field) Next(x, y int) bool {
	on := 0
	for i := -1; i <= 1; i++ {
		for j := -1; j <= 1; j++ {
			if f.State(x+i, y+j) && !(j == 0 && i == 0) {
				on++
			}
		}
	}
	return on == 3 || on == 2 && f.State(x, y)
}

func (f Field) State(x, y int) bool {
	for y < 0 {
		y += f.h
	}
	for x < 0 {
		x += f.w
	}
	return f.s[y%f.h][x%f.w]
}

type Life struct {
	w, h int
	a, b Field
}

func NewLife(w, h int) *Life {
	a := NewField(w, h)
	for i := 0; i < (w * h / 2); i++ {
		a.Set(rand.Intn(w), rand.Intn(h), true)
	}
	return &Life{
		a: a,
		b: NewField(w, h),
		w: w, h: h,
	}
}

func (l *Life) Step() {
	for y := 0; y < l.h; y++ {
		for x := 0; x < l.w; x++ {
			l.b.Set(x, y, l.a.Next(x, y))
		}
	}
	l.a, l.b = l.b, l.a
}

func (l *Life) String() string {
	var buf bytes.Buffer
	for y := 0; y < l.h; y++ {
		for x := 0; x < l.w; x++ {
			b := byte(' ')
			if l.a.State(x, y) {
				b = '*'
			}
			buf.WriteByte(b)
		}
		buf.WriteByte('\n')
	}
	return buf.String()
}

func main() {
	l := NewLife(80, 15)
	for i := 0; i < 300; i++ {
		l.Step()
		fmt.Print("\x0c")
		fmt.Println(l)
		time.Sleep(time.Second / 30)
	}
}
Task: Conway's Game of Life
C: #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define for_x for (int x = 0; x < w; x++)
#define for_y for (int y = 0; y < h; y++)
#define for_xy for_x for_y
void show(void *u, int w, int h)
{
	int (*univ)[w] = u;
	printf("\033[H");
	for_y {
		for_x printf(univ[y][x] ? "\033[07m  \033[m" : "  ");
		printf("\033[E");
	}
	fflush(stdout);
}

void evolve(void *u, int w, int h)
{
	unsigned (*univ)[w] = u;
	unsigned new[h][w];

	for_y for_x {
		int n = 0;
		for (int y1 = y - 1; y1 <= y + 1; y1++)
			for (int x1 = x - 1; x1 <= x + 1; x1++)
				if (univ[(y1 + h) % h][(x1 + w) % w])
					n++;

		if (univ[y][x]) n--;
		new[y][x] = (n == 3 || (n == 2 && univ[y][x]));
	}
	for_y for_x univ[y][x] = new[y][x];
}

void game(int w, int h)
{
	unsigned univ[h][w];
	for_xy univ[y][x] = rand() < RAND_MAX / 10 ? 1 : 0;
	while (1) {
		show(univ, w, h);
		evolve(univ, w, h);
		usleep(200000);
	}
}

int main(int c, char **v)
{
	int w = 0, h = 0;
	if (c > 1) w = atoi(v[1]);
	if (c > 2) h = atoi(v[2]);
	if (w <= 0) w = 30;
	if (h <= 0) h = 30;
	game(w, h);
}

Java: public class GameOfLife{
	public static void main(String[] args){
		String[] dish= {
				"_#_",
				"_#_",
				"_#_",};
		int gens= 3;
		for(int i= 0;i < gens;i++){
			System.out.println("Generation " + i + ":");
			print(dish);
			dish= life(dish);
		}
	}

	public static String[] life(String[] dish){
		String[] newGen= new String[dish.length];
		for(int row= 0;row < dish.length;row++){
			newGen[row]= "";
			for(int i= 0;i < dish[row].length();i++){
				String above= "";
				String same= "";
				String below= "";
				if(i == 0){
					
					
					above= (row == 0) ? null : dish[row - 1].substring(i,
									i + 2);
					same= dish[row].substring(i + 1, i + 2);
					
					
					below= (row == dish.length - 1) ? null : dish[row + 1]
									.substring(i, i + 2);
				}else if(i == dish[row].length() - 1){
					
					
					above= (row == 0) ? null : dish[row - 1].substring(i - 1,
									i + 1);
					same= dish[row].substring(i - 1, i);
					
					
					below= (row == dish.length - 1) ? null : dish[row + 1]
									.substring(i - 1, i + 1);
				}else{
					
					
					above= (row == 0) ? null : dish[row - 1].substring(i - 1,
									i + 2);
					same= dish[row].substring(i - 1, i)
									+ dish[row].substring(i + 1, i + 2);
					
					
					below= (row == dish.length - 1) ? null : dish[row + 1]
									.substring(i - 1, i + 2);
				}
				int neighbors= getNeighbors(above, same, below);
				if(neighbors < 2 || neighbors > 3){
					newGen[row]+= "_";
				}else if(neighbors == 3){
					newGen[row]+= "#";
				}else{
					newGen[row]+= dish[row].charAt(i);
				}
			}
		}
		return newGen;
	}

	public static int getNeighbors(String above, String same, String below){
		int ans= 0;
		if(above != null){
			for(char x: above.toCharArray()){
				if(x == '#') ans++;
			}
		}
		for(char x: same.toCharArray()){
			if(x == '#') ans++;
		}
		if(below != null){
			for(char x: below.toCharArray()){
				if(x == '#') ans++;
			}
		}
		return ans;
	}

	public static void print(String[] dish){
		for(String s: dish){
			System.out.println(s);
		}
	}
}
Task: Conway's Game of Life
C: #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define for_x for (int x = 0; x < w; x++)
#define for_y for (int y = 0; y < h; y++)
#define for_xy for_x for_y
void show(void *u, int w, int h)
{
	int (*univ)[w] = u;
	printf("\033[H");
	for_y {
		for_x printf(univ[y][x] ? "\033[07m  \033[m" : "  ");
		printf("\033[E");
	}
	fflush(stdout);
}

void evolve(void *u, int w, int h)
{
	unsigned (*univ)[w] = u;
	unsigned new[h][w];

	for_y for_x {
		int n = 0;
		for (int y1 = y - 1; y1 <= y + 1; y1++)
			for (int x1 = x - 1; x1 <= x + 1; x1++)
				if (univ[(y1 + h) % h][(x1 + w) % w])
					n++;

		if (univ[y][x]) n--;
		new[y][x] = (n == 3 || (n == 2 && univ[y][x]));
	}
	for_y for_x univ[y][x] = new[y][x];
}

void game(int w, int h)
{
	unsigned univ[h][w];
	for_xy univ[y][x] = rand() < RAND_MAX / 10 ? 1 : 0;
	while (1) {
		show(univ, w, h);
		evolve(univ, w, h);
		usleep(200000);
	}
}

int main(int c, char **v)
{
	int w = 0, h = 0;
	if (c > 1) w = atoi(v[1]);
	if (c > 2) h = atoi(v[2]);
	if (w <= 0) w = 30;
	if (h <= 0) h = 30;
	game(w, h);
}

VB: option explicit
const tlcr=3, tlcc=3
const maxdim=15

dim a(15,15)
dim b(15,15)
dim ans0:ans0=chr(27)&"["
dim gen,n

erase a

a(0,1)=true:a(1,2)=true:a(2,0)=true:a(2,1)=true:a(2,2)=true

a(3,13)=true:a(4,13)=true:a(5,13)=true

a(11,1)=true:a(11,2)=true: a(12,1)=true:a(12,2)=true
a(13,3)=true:a(13,4)=true: a(14,3)=true:a(14,4)=true

gen=0
doframe

do
  display 
  wscript.sleep(100)
  n=newgen
loop until n=0
display 

sub cls()  wscript.StdOut.Write ans0 &"2J"&ans0 &"?25l":end sub 
sub toxy(r,c,s)  wscript.StdOut.Write ans0 & r & ";" & c & "f"  & s :end sub
function iif(a,b,c) if a then iif=b else iif=c end if :end function

sub doframe
  dim r,c,s
	const frame="@"
	cls
	toxy 1,tlcc-1, "Conway
	toxy tlcr-1,tlcc-1,string(maxdim+3,frame)
	s=frame&space(maxdim+1)&frame
	for r=0 to maxdim
		toxy tlcr+r,tlcc-1,s
	next
	toxy tlcr+maxdim+1,tlcc-1,string(maxdim+3,frame)
end sub

sub display 
dim r,c
const pix="#"
for r=0 to maxdim
   for c=0 to maxdim
	   toxy tlcr+r,tlcc+c,iif (a(r,c),pix," ") 
	 next
next
toxy tlcr+maxdim+2,tlcc-1,gen & " " & n
toxy tlcr+maxdim+3,tlcc-1,""
gen=gen+1
end sub

function newgen
  dim r,c,cnt,cp,cm,rp,rm
	for r=0 to maxdim
	  for c=0 to maxdim
			cp=(c+1) and maxdim    
			cm=(c-1) and maxdim
			rp=(r+1) and maxdim
			rm=(r-1) and maxdim
			cnt=0
			cnt=- a(rp,cp) - a(rp,c) - a(rp,cm)  
			cnt=cnt- a(r,cp)-	 a(r,cm)	
			cnt=cnt- a(rm,cp)- a(rm,c) - a(rm,cm)  
			 
			if a(r,c) then 
				b(r,c)=iif (cnt=2 or cnt=3,true,false)
			else
				b(r,c)=iif (cnt=3,true,false)					
			end if
	  next 
	next
	for r=0 to maxdim
	  for c=0 to maxdim
		  a(r,c)=b(r,c)
		  newgen=newgen- b(r,c)
	  next
	next
end function
Task: Conway's Game of Life
Go: package main

import (
	"bytes"
	"fmt"
	"math/rand"
	"time"
)

type Field struct {
	s    [][]bool
	w, h int
}

func NewField(w, h int) Field {
	s := make([][]bool, h)
	for i := range s {
		s[i] = make([]bool, w)
	}
	return Field{s: s, w: w, h: h}
}

func (f Field) Set(x, y int, b bool) {
	f.s[y][x] = b
}

func (f Field) Next(x, y int) bool {
	on := 0
	for i := -1; i <= 1; i++ {
		for j := -1; j <= 1; j++ {
			if f.State(x+i, y+j) && !(j == 0 && i == 0) {
				on++
			}
		}
	}
	return on == 3 || on == 2 && f.State(x, y)
}

func (f Field) State(x, y int) bool {
	for y < 0 {
		y += f.h
	}
	for x < 0 {
		x += f.w
	}
	return f.s[y%f.h][x%f.w]
}

type Life struct {
	w, h int
	a, b Field
}

func NewLife(w, h int) *Life {
	a := NewField(w, h)
	for i := 0; i < (w * h / 2); i++ {
		a.Set(rand.Intn(w), rand.Intn(h), true)
	}
	return &Life{
		a: a,
		b: NewField(w, h),
		w: w, h: h,
	}
}

func (l *Life) Step() {
	for y := 0; y < l.h; y++ {
		for x := 0; x < l.w; x++ {
			l.b.Set(x, y, l.a.Next(x, y))
		}
	}
	l.a, l.b = l.b, l.a
}

func (l *Life) String() string {
	var buf bytes.Buffer
	for y := 0; y < l.h; y++ {
		for x := 0; x < l.w; x++ {
			b := byte(' ')
			if l.a.State(x, y) {
				b = '*'
			}
			buf.WriteByte(b)
		}
		buf.WriteByte('\n')
	}
	return buf.String()
}

func main() {
	l := NewLife(80, 15)
	for i := 0; i < 300; i++ {
		l.Step()
		fmt.Print("\x0c")
		fmt.Println(l)
		time.Sleep(time.Second / 30)
	}
}

VB: option explicit
const tlcr=3, tlcc=3
const maxdim=15

dim a(15,15)
dim b(15,15)
dim ans0:ans0=chr(27)&"["
dim gen,n

erase a

a(0,1)=true:a(1,2)=true:a(2,0)=true:a(2,1)=true:a(2,2)=true

a(3,13)=true:a(4,13)=true:a(5,13)=true

a(11,1)=true:a(11,2)=true: a(12,1)=true:a(12,2)=true
a(13,3)=true:a(13,4)=true: a(14,3)=true:a(14,4)=true

gen=0
doframe

do
  display 
  wscript.sleep(100)
  n=newgen
loop until n=0
display 

sub cls()  wscript.StdOut.Write ans0 &"2J"&ans0 &"?25l":end sub 
sub toxy(r,c,s)  wscript.StdOut.Write ans0 & r & ";" & c & "f"  & s :end sub
function iif(a,b,c) if a then iif=b else iif=c end if :end function

sub doframe
  dim r,c,s
	const frame="@"
	cls
	toxy 1,tlcc-1, "Conway
	toxy tlcr-1,tlcc-1,string(maxdim+3,frame)
	s=frame&space(maxdim+1)&frame
	for r=0 to maxdim
		toxy tlcr+r,tlcc-1,s
	next
	toxy tlcr+maxdim+1,tlcc-1,string(maxdim+3,frame)
end sub

sub display 
dim r,c
const pix="#"
for r=0 to maxdim
   for c=0 to maxdim
	   toxy tlcr+r,tlcc+c,iif (a(r,c),pix," ") 
	 next
next
toxy tlcr+maxdim+2,tlcc-1,gen & " " & n
toxy tlcr+maxdim+3,tlcc-1,""
gen=gen+1
end sub

function newgen
  dim r,c,cnt,cp,cm,rp,rm
	for r=0 to maxdim
	  for c=0 to maxdim
			cp=(c+1) and maxdim    
			cm=(c-1) and maxdim
			rp=(r+1) and maxdim
			rm=(r-1) and maxdim
			cnt=0
			cnt=- a(rp,cp) - a(rp,c) - a(rp,cm)  
			cnt=cnt- a(r,cp)-	 a(r,cm)	
			cnt=cnt- a(rm,cp)- a(rm,c) - a(rm,cm)  
			 
			if a(r,c) then 
				b(r,c)=iif (cnt=2 or cnt=3,true,false)
			else
				b(r,c)=iif (cnt=3,true,false)					
			end if
	  next 
	next
	for r=0 to maxdim
	  for c=0 to maxdim
		  a(r,c)=b(r,c)
		  newgen=newgen- b(r,c)
	  next
	next
end function