Git Product home page Git Product logo

life10's Introduction

Conway's Game of Life in 10 Programming Languages

This is a straightforward implementation of the Game of Life rules in 10 programming languages:

The program simply displays an initial configuration and then the configuration after G generations and exits. The grid (board) dimensions are given by parameters N and M and the initial configuration is hard-coded but can be modified at your will. The universe is wrapped.

The MANOOL version has an additional parameter, AllocOpt, which determines whether the code is explicitly memory allocation-aware or completely relies on copy-on-write aspects of the language semantics.

The main purpose of this repository is to have a benchmark (which is both computationally-intensive and fun) to compare performance of the MANOOL translator with that of other language implementations and to compare MANOOL with other languages. However, while coding the same task in so many of them, I suddenly realized how bizarre are the similarities (and differences) between programming languages.

The choice of languages is made due to the following:

  • These are all dynamically-typed programming languages (except C++, which is included for reference purposes)
  • The implementations have relatively lightweight installation packages for Unix-like systems (again, except for C++ ;-)

A performance comparison report and an analisis of MANOOL syntax and semantics with respect of these programming languages is to follow at some point of the future.

The examples are written in the most idiomatic but most similar way from the performance comparison and stylistic point of view. I did not have any previous working experience with Python, Ruby, Tcl, Lua, and Scheme (had never written code of similar complexity), so you are welcome to suggest improvements if there are even more idiomatic ways to use them.

Examples of command line to run:

C++

g++ -std=c++11 -O3 life.cc && time ./a.out; rm -f a.out

or

clang++ -std=c++11 -O3 life.cc && time ./a.out; rm -f a.out

Python

time python life.py

or

time python3 life.py3

PHP

time php life.php

Perl

time perl life.pl

Ruby

time ruby life.rb

JavaScript/ECMAScript

time node life.js

Tcl

time tclsh life.tcl

Lua

time lua life.lua

or

time luajit life.lua

Scheme

time guile life.scm

or

csc -C -O3 life.scm && time ./life; rm -f life

MANOOL

time MNL_PATH=~/manool/build/lib ~/manool/build/mnlexec life.mnl

To clone this repo:

git clone https://github.com/rusini/life10.git

Have fun! — rusini[email protected]

life10's People

Contributors

rusini avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.