Rush Carnifex LISP
In this project, you will be developing a game that was originally produced by mathematician John Conway in 1970. This game is called Game of Life. This game is a zero-player game that is influenced by an initial conditions. The initial conditions will evolve based on the user’s specified initial condition (https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life).
This game had a board that consists of a 2D grid of cells. These cells have two possible states: alive or dead. The cells interact with 8 neighbors (orthogonal and corners).
Rules to follow:
1. Underpopulation: cells <2 alive neighbors dies
2. Next generation: cells with 2–3 alive neighbors live
3. Overpopulation: cells with >3 alive neighbors dies
4. Reproduction: DEAD cells with =3 alive neighbors becomes ALIVE
Summation:
1. Cells with 2–3 alive neighbors continue to live
2. Dead cells with 3 alive comes to life
3. All other = dead
GameOfLife: https://playgameoflife.com/
Basic Youtube Video: https://www.youtube.com/watch?v=C2vgICfQawE
Why does 42 want us to code in Lisp?
Writing code faster than other languages. Many higher languages (eg. Python) incorporated features from Lisp.
Perl advocates: “makes easy and hard things possible”
Python advocates: “clean and simple” code
In lisp, you can add a feature so no more saying that “you wish this language supports a feature.” In addition, there is less code to write. It is a “programmable programming language.”
***NOTE. for those of us doing LISP rush, it seems like it just refuses to work using SBCL v.1.2.11 for those of us who have Mac OS v 10.13.4. the only guy who was able to successfully even start the “lispbuilder-sdl” with (sdl:with-events ()) had Mac OS v.10.13.3.
Correction:
SBCL v1.2.11 works fine
what doesn’t work is the library we were supposed to use: lispbuilder-sdl. it just kept crushing” -ES, another 42 cadet.
I had tried it with a friend’s MAC 10.13.3, my way of installing it worked fine. it was able to run online github code. On my MAC 10.13.4, it did not work.
Things to Install
1. Simple DirectMedia Layer (SDL), which is a development library that will allows us to display the graphical automation
2. Lisp Interpeter sbcl 1.211…think of it like python interpreter or compiler. So you can run .lisp files by doing sbcl --load file.lisp
3. Quicklisp, a library manager that allows us to quickly install other libraries for Lisp. It’s mainly important if you have multiple files (according to another cadet)
**MANUALLY TYPE THE INFORMATION BELOW**
Installing SDL
1. Go to the MAC search bar
2. Type in: Managed Software Center (MSC)
3. Install: SDL Library 1.2.15
The code below DID NOT WORK for me. Do not try it with brew install.
brew install sdl
Installing Lisp Interpreter SBCL (link)
1. Download the .tar file
2. Untar the folder
3. cd within the folder and type:
INSTALL_ROOT=$Home/.sbcl sh install.sh
4. Go to the home folder (cd) and open .zshrc. Type:
export INSTALL_ROOT=”$HOME/.sbcl”
export SBCL_HOME=”$HOME/.sbcl/lib/sbcl”
export PATH=”$PATH:$HOME/.sbcl/bin”
alias sbcl=”sbcl — noinform”
If you copy and paste this, you need to fix the quotes.
Installing Quick Start (Try this: Link)
- In the terminal, type
sbcl --load quicklisp.lisp
- Once you get to the * mode, type:
(quicklisp-quickstart:install :path “/nfs/2019/v/vinguyen/.sbcl/quicklisp”)
3. Now, type (ql:add-to-init-file)
4. Type: (ql:quickload "lispbuilder-sdl")
At this point, you will get an error message. IT IS OKAY! KEEP ON GOING!
5. cd /nfs/2019/v/vinguyen/.sbcl/quicklisp/dists/quicklisp/software/lispbuilder-20190521-git/lispbuilder-sdl/cocoahelper
6. make
THERE WILL BE AN ERROR MESSAGE/WARNING. IT IS OKAY! Keep going.
7. sbcl
8. Type: (ql:quickload "lispbuilder-sdl")