EluciusFTW.Tui48
0.1.4
dotnet add package EluciusFTW.Tui48 --version 0.1.4
NuGet\Install-Package EluciusFTW.Tui48 -Version 0.1.4
<PackageReference Include="EluciusFTW.Tui48" Version="0.1.4" />
<PackageVersion Include="EluciusFTW.Tui48" Version="0.1.4" />
<PackageReference Include="EluciusFTW.Tui48" />
paket add EluciusFTW.Tui48 --version 0.1.4
#r "nuget: EluciusFTW.Tui48, 0.1.4"
#:package EluciusFTW.Tui48@0.1.4
#addin nuget:?package=EluciusFTW.Tui48&version=0.1.4
#tool nuget:?package=EluciusFTW.Tui48&version=0.1.4
EluciusFTW.Tui48
A 2048-style sliding tile game as an Elmish component for SpectreTuff.Elmish programs. Host it as a whole app, or embed it in your own, for example as a pop-up game.
Slide the tiles with the arrow keys (or h j k l); equal tiles merge and add to your score.
Reach the 2048 tile to win, then keep going if you like. Boards from 3x3 to 6x6 (keys 3–6), with
the best score per board size kept.
Based on the original 2048 by Gabriele Cirulli.
Hosting the component
open Tui48
// Highscores: Store.defaultFile (shared with the standalone game), Store.file path,
// Store.none, or your own { Load = ...; Save = ... }.
let deps = Tui48.Dependencies.create Highscore.Store.defaultFile
let init () = Tui48.init deps
let update msg model =
let model, cmd, out = Tui48.update deps msg model
match out with
| Some Tui48.Closed -> model, Cmd.batch [ cmd; TuiCmd.exit ] // the player pressed q or Esc
| None -> model, cmd
Elmish.Program.mkProgram init update Tui48.view
|> Elmish.Program.withSubscription (fun model -> Subscriptions.keys Tui48.InputMsg @ Tui48.subscriptions model)
|> Tui.run
When embedding, wrap the component's messages in your own (TileMsg of Tui48.Msg), route key
presses to it as Tui48.InputMsg key, render Tui48.view on top of your view, and decide
what Closed means, e.g. hiding the overlay instead of exiting. Keep the cmd returned along with
Closed: it saves a new highscore of the game in progress.
See src/Tuigames.Cli in this repository for a host that embeds this and other games behind a menu.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- EluciusFTW.SpectreTuff (>= 0.14.14)
- EluciusFTW.SpectreTuff.Elmish (>= 0.14.14)
- FSharp.Core (>= 10.1.402)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.