1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-12 14:28:08 +03:00
juvix/examples/milestone/TicTacToe
Jan Mas Rovira 3736ed1c2d
Migrate old named application syntax (#2876)
- Closes #2668

This pr migrates the old named application syntax to the new one. In
order to migrate a juvix file to the new syntax it suffices to run the
formatter.
After the next release, we should completely remove the support for the
old syntax.

## Other changes
I've improved Scope negative tests. Previously, when a negative test
failed, you could only see the title of the test and the message
"Incorrect Error", as well as the Haskell file and line where the test
is defined.
This is extremely incovenient because you have to go to the haskell test
file, go to the line where the error is defined, look at the name of the
file and then visit that file. Moreover, you need to manually run the
scoper on that file to see the error that was returned.
I've fixed that and it now shows all relevant information. Example:

![image](https://github.com/anoma/juvix/assets/5511599/f0b7ec60-55dc-4f38-9b51-1fbedbda63f4)
I've implemented this only using the `Generic` instance for the
`ScoperError` type, so doing something similar for the rest of negative
tests should be straightforward.
2024-07-12 18:31:09 +02:00
..
CLI Make juvix format line width 100 with ribbon width 100 (#2883) 2024-07-10 18:21:09 +01:00
Logic Make juvix format line width 100 with ribbon width 100 (#2883) 2024-07-10 18:21:09 +01:00
Package.juvix Migrate old named application syntax (#2876) 2024-07-12 18:31:09 +02:00
README.org Remove missing Juvix examples and webapp example from docs build (#1890) 2023-03-15 12:01:06 +00:00
TicTacToe.juvix CI pre-commit maintenance (#1905) 2023-03-23 08:57:38 +00:00

TicTacToe

TicTacToe

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

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

Terminal application

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

cd CLI
juvix compile TicTacToe.juvix
./TicTacToe

You will see the following output:

MiniTicTacToe
-------------

Type a number then ENTER to make a move

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