Coder Social home page Coder Social logo

skaruts / game-of-life-in-multiple-languages Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 1.53 MB

The result of me learning multiple languages/frameworks over time

C++ 6.03% Nim 20.13% Lua 64.55% Python 4.25% C 4.39% GDScript 0.66%
game-of-life sfml love2d lua tic-80 raylib godot-nim godot gdnative nim python

game-of-life-in-multiple-languages's Introduction

Game of Life in Multiple Languages

I always make a Game of Life when learning a new language or framework, and since over the years I've jumped around between quite a few of them, eventually I ended up with a bunch of Games of Life made in a variety of languages and frameworks. Ultimately, it has also given me a first hand perspective of the difference in performance between the languages/frameworks.

I'm gathering them in this repo just for the heck of it, as I clean them up in my spare time.


All versions except the TIC-80 (lua) are just a bare bones GoL. The TIC-80 version is a quite intricate one, with some fun drawing tools to play around with. All of them have a scalar variable m that can be given the values 1, 2, 4, 8 or 16, to make the cells bigger/smaller, respectively: m=1 makes cells of 16x16 pixels and an 80x50 grid, and m=16 makes cells of 1 pixel in a 1280x800 grid.

All of them use the same generation algorithm, which is the fastest among the simplest I could come up with so far. Maybe one day I'll manage to wrap my head around Tony Finch's algorithms or even hashlife, but for now this is the best I got. And I'm not unhappy with it.

On performance (the limits of reasonable performance):

  • Cpp/Nim versions give me ~20fps with 1px cells, and ~60-70fps with 2px cells. They run like wild with larger cells. The C-Raylib version seemed slightly slower, but I haven't tested it much.

  • Love2D gives me ~40fps with 4px cells.

  • PySFML gives me ~60-70 with... 16px cells. (Pretty bad. Either I did something wrong or...)

  • TIC-80 can't have a very large grid (240x136, maximum) and is slower by design, and gives me ~20fps with 1px cells (in this case the largest cells are 8px, so the scalar m can only go up to 8 for 1px cells).

game-of-life-in-multiple-languages's People

Contributors

skaruts avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

boyquotes

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.