Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for compiling/running the TicTacToe example #1664

Merged
merged 2 commits into from
Dec 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions examples/milestone/TicTacToe/README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#+TITLE: TicTacToe

** TicTacToe

This directory contains Juvix code for a Tic-Tac-Toe game that can be run as a
terminal application or a Web application.

The common logic code is in =Logic/=, the code specific to the terminal
application is in =CLI/= and the code specific to the Web application is in
=Web/=.

*** Terminal application

To compile and run the terminal application use the following steps:

#+begin_src shell
cd CLI
juvix compile TicTacToe.juvix
./TicTacToe
#+end_src

You will see the following output:

#+begin_src shell
MiniTicTacToe
-------------

Type a number then ENTER to make a move

+---+---+---+
| 1 | 2 | 3 |
+---+---+---+
| 4 | 5 | 6 |
+---+---+---+
| 7 | 8 | 9 |
+---+---+---+
Player X:
#+end_src

*** Web application

To compile the Web application use the following steps:

#+begin_src shell
cd Web
juvix compile -t wasm -r standalone TicTacToe.juvix
#+end_src

To run the Web application you must first serve the files in the =Web/=
directory, using Python for example:

#+begin_src shell
python3 -m http.server
#+end_src

Then navigate to [[http://localhost:8000]] in your browser.