F# is a functional-first programming language, making it ideal for implementing Functional Programming principles / styles. These code files show how F# can be used to make Tic-Tac-Toe in Functional Programming.
F# requires the Microsoft .NET framework (SDK) v9.0 to be installed. This can be installed on Ubuntu by the following the instructions at https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install?tabs=dotnet9&pivots=os-linux-ubuntu-2404, or on Windows at: https://learn.microsoft.com/en-us/dotnet/core/install/windows.
- Once .NET is installed, run
dotnet new console -lang "F#" -o TicTacToeFSharp
to setup a new project folder. - Move the F# files into this new directory, including the .fsproj file.
- Run
dotnet build
within the directory, to create the necessary binaries. - Run
dotnet run
to run the project, using the aforementioned binaries.
If you would like to edit the files, you can edit them in text editors such as VSCode (by installing the 'Ionide for F#' extension), or IDEs including Visual Studios. You may have to re-arrange the order of the files within the F# Solution Explorer, with the dependencies being higher in the hierarchy (as these need to be loaded first). This is because of FSharp's dependency top-down approach.