-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for compiling/running the TicTacToe example (#1664)
* Add documentation for compiling/running the TicTacToe example * Fix TicTacToe example steps
- Loading branch information
1 parent
116c4a7
commit e41e020
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |