Coder Social home page Coder Social logo

mehrab832 / shorelark Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patryk27/shorelark

0.0 0.0 0.0 605 KB

Simulation of life & evolution

Home Page: https://pwy.io/en/posts/learning-to-fly-pt1/

License: MIT License

JavaScript 21.95% Rust 71.33% CSS 1.02% Nix 4.86% HTML 0.84%

shorelark's Introduction

๐Ÿฆ Shorelark

Simulation of evolution, powered by neural networks, genetic algorithms & high-school math:

screenshot

Feeling curious? I've described the implementation ab ovo on my blog: Learning to Fly.

Building

Using Nix

# 1/3: Clone the repository
$ git clone https://github.com/Patryk27/shorelark
$ cd shorelark

# 2/3: Build the application
#      (this might take a few minutes)
$ nix build
#
# ^ This command will create a directory called `result`
#   that'll contain the compiled WebAssembly code and a few
#   frontend files.
#
# If `nix build` fails, you might be using an older version
# of Nix that doesn't support flakes - if that's the case,
# please use this command instead:
#
# $ nix-build

# 3/3: Start the frontend application
$ nix shell nixpkgs#php -c php -S localhost:8080 -t result
#
# ^ After launching this, open `http://localhost:8080` in
#   your web browser - you should see the simulation working
#   as the doctor ordered :-)

# > But why are we downloading PHP? This seems insane!
# 
# It's due to CORS:
# https://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local
#
# Bottom line: it's not possible to open a local HTML file
# and make it load WebAssembly code - there *has* to be a
# web server used; and it just happens that PHP includes 
# a simple web server out of the box.
#
# If you don't want PHP on your machine - :-) - anything
# from this list will do the work, too:
#
# https://gist.github.com/willurd/5720255

Using Cargo and npm

Requires cargo, npm and wasm-pack (0.11.0):

# 1/3: Clone the repository
$ git clone https://github.com/Patryk27/shorelark
$ cd shorelark

# 2/3: Compile Rust into WebAssembly
#      (this might take a minute)
$ cd libs/simulation-wasm
$ wasm-pack build --release

# 3/3: Start the frontend application
$ cd ../../www
$ npm install
$ npm run start

# ^ After launching this, open `http://localhost:8080` in
#   your web browser - you should see the simulation working
#   as the doctor ordered :-)

Usage

Shorelark contains a simple in-game introduction - just read what the terminal on the left side says and have fun!

License

Copyright (c) 2020 Patryk Wychowaniec [email protected].
Licensed under the MIT license.

shorelark's People

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.