Skip to content

pkoos/Game_Of_Life_webdev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conway's Game of Life

This is written in very basic html5 and Javascript. The purpose of this project was mainly for me to do a little bit of webdev practice, as well as play around with the game of life. This is written using the html5 canvas, as well as vanilla Javascript. There are no JS libraries at all, and is now separated into multiple files. Once I get the thing working, I might try to convert the code to TypeScript, but we'll see.

Running the program

The way I run this program is using the basic Python http server. With Python installed, you can run the following command:

python3 -m http.server

In some cases, you do not need the '3' above, and would run this command:

python -m http.server

There are two versions of the files: JavaScript and TypeScript. You can run either, although after this point (11/2/2023), I will most likely move over to TypeScript and continue development.

Within the head of the html file, there are two script tags, with one being commented out. Above each line is a comment. Simply comment out the one you do not want to use, and uncomment the one you do want to use.

  <!-- <script src="src/main.js" type="module"></script> -->
  <script src="src/ts/build/main.js" type="module"></script>

With TypeScript, there is an additional step of compiling the Typescript files into Javascript. Use this command from the root directory:

tsc -p src/ts

the above python or python3 command can be run at any time, but you need to compile the files if using TypeScript.

Future improvements and TODOs

This is a first pass, with mostly naive implementations, so there are many areas to improve upon.

Possible improvements:

  1. Unglobal a lot of things, like arrays, contexts, etc.
  2. Add persistence. Currently when you refresh the page, you lose everything.
  3. Write in something other than Javascript. If I can figure this out, I might try to do this in wasm or another language.
  4. Use some type of restful functions.
  5. Add a web framework to make the website better.
  6. Figure out how to separate the monolith JS file into separate files.

Basic Shapes

  • Shapes Wiki - This seems to have everything and is a good general reference.

Still lifes

These shapes do not move or change.

Oscillators

These shapes will change, and eventually go back to the original shape. The period is how many different forms this has before transforming back to its original shape.

Spaceships

These shapes will move across the screen.

Helpful Links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published