-
If you do not have OCaml and/or Dune, install it on your machine using the CS 3110 textbook installation instructions here: https://cs3110.github.io/textbook/chapters/preface/install.html
-
Install the OCaml graphics library on your machine by using the tutorial listed below, which a copied portion from the tutorial "Installing OCaml Graphics" under the GitHub respository "OCaml Graphics Demo" by the Yale-NUS College module on Data Structures and Algorithms. Link: https://github.com/ysc2229/ocaml-graphics-demo.
If you followed the initially provided instructions for installing the OCaml infrastructure on your operating system, the project should be working. Otherwise, follow the instructions below.
This project relies on OCaml's graphics
package, which is somewhat
non-trivial to install, due to native system dependencies. Some
instructions on how make it work are provided below:
-
Install XQuartz.
-
Log-out from the system and log-in again.
-
After that, you will have to re-install all packages you have previously installed via opam. The following commands will all be done in the terminal within the project directory. For instance, first try
opam switch
If your switch name is, for instance
cs3110-2022sp
, next runopam switch reinstall cs3110-2022sp
It will take a while, as it re-builds all packages from scratch.
Note: the
graphics
package has been checked to work with OCaml4.06.1
,4.07.1
, and4.10.0
. -
Next, execute
opam update; opam upgrade opam install graphics
After that you should be able to build the project.
-
You might need to install
core
, andbatteries
viaopam
(usingopam install .
).
-
Make sure that x11 window manager is installed (it comes as a part of most of the standard distributions).
-
Proceed to Step 3 for Mac OS X (above).
-
As it seems to be the case, x11 graphic interface is included into Cygwin (https://x.cygwin.com/).
-
Proceed to Step 3 for Mac OS X (above).
- Run the system using "make play" in the terminal in the directory of the project.
How to use/controls:
To edit, press the edit button. When done editing, press the done button.
To spawn a road: While in edit mode, press the "add road" button. Click on two points to define a road.
You now get a prompt to name the road. Type in the name and press enter when you are done. You should know see the road as a line with the street name.
To spawn a location: While in edit mode, press the "add location" button. Click on a point to define a location. Note: this can only be done when there is at least one road on the screen.
You now get a prompt to name the location. Type in the name and press enter when done. Then you are prompted to type a category. Type in the category name and press enter when done. You show now see the location as a circle with name and category, placed on the closest road to the point you clicked.