2023-04-25 18:37:27 +02:00
|
|
|
import Lake
|
|
|
|
|
open Lake DSL
|
|
|
|
|
|
2023-11-09 17:51:20 +01:00
|
|
|
-- Using this assumes that each dependency has a tag of the form `v4.X.0`.
|
|
|
|
|
def leanVersion : String := s!"v{Lean.versionString}"
|
|
|
|
|
|
2025-08-09 01:19:55 +02:00
|
|
|
/--
|
|
|
|
|
Use the GameServer from a `lean4game` folder lying next to the game on your local computer.
|
|
|
|
|
Activated with `lake update -Klean4game.local`.
|
|
|
|
|
-/
|
2023-05-04 11:48:58 +02:00
|
|
|
def LocalGameServer : Dependency := {
|
|
|
|
|
name := `GameServer
|
2025-08-06 00:25:53 +02:00
|
|
|
scope := "hhu-adam"
|
|
|
|
|
src? := DependencySrc.path "../lean4game/server"
|
|
|
|
|
version? := none
|
|
|
|
|
opts := ∅
|
2023-05-04 11:48:58 +02:00
|
|
|
}
|
|
|
|
|
|
2025-08-09 01:19:55 +02:00
|
|
|
/--
|
|
|
|
|
Use the GameServer version from github.
|
|
|
|
|
Deactivate local version with `lake update -R`.
|
|
|
|
|
-/
|
2023-05-04 11:48:58 +02:00
|
|
|
def RemoteGameServer : Dependency := {
|
|
|
|
|
name := `GameServer
|
2025-08-06 00:25:53 +02:00
|
|
|
scope := "hhu-adam"
|
|
|
|
|
src? := DependencySrc.git "https://github.com/leanprover-community/lean4game.git" leanVersion "server"
|
|
|
|
|
version? := s!"git#{leanVersion}"
|
|
|
|
|
opts := ∅
|
2023-05-04 11:48:58 +02:00
|
|
|
}
|
|
|
|
|
|
2025-08-09 01:19:55 +02:00
|
|
|
/-
|
|
|
|
|
Choose GameServer dependency depending on whether `-Klean4game.local` has been passed to `lake`.
|
|
|
|
|
-/
|
2023-05-04 11:48:58 +02:00
|
|
|
open Lean in
|
|
|
|
|
#eval (do
|
2023-11-22 13:15:12 +01:00
|
|
|
let gameServerName := if get_config? lean4game.local |>.isSome then
|
|
|
|
|
``LocalGameServer else ``RemoteGameServer
|
2023-05-04 11:48:58 +02:00
|
|
|
modifyEnv (fun env => Lake.packageDepAttr.ext.addEntry env gameServerName)
|
2023-11-09 17:51:20 +01:00
|
|
|
: Elab.Command.CommandElabM Unit)
|
|
|
|
|
|
2025-08-09 01:19:55 +02:00
|
|
|
/-!
|
|
|
|
|
# USER DEPENDENCIES
|
2023-11-09 17:51:20 +01:00
|
|
|
|
2025-08-09 01:19:55 +02:00
|
|
|
Add any further dependencies of your game below.
|
2023-11-09 17:51:20 +01:00
|
|
|
|
|
|
|
|
Note: If your package (like `mathlib` or `Std`) has tags of the form `v4.X.0` then
|
2025-08-09 01:19:55 +02:00
|
|
|
you can use
|
2023-11-09 17:51:20 +01:00
|
|
|
|
2025-08-09 01:19:55 +02:00
|
|
|
```
|
|
|
|
|
require "leanprover-community" / mathlib @ git leanVersion
|
|
|
|
|
```
|
|
|
|
|
-/
|
2023-11-09 17:51:20 +01:00
|
|
|
|
2025-08-09 01:19:55 +02:00
|
|
|
require "leanprover-community" / mathlib @ git leanVersion
|
2023-11-09 17:51:20 +01:00
|
|
|
|
2025-08-09 01:19:55 +02:00
|
|
|
/-!
|
|
|
|
|
# PACKAGE CONFIGURATION
|
2023-11-09 17:51:20 +01:00
|
|
|
|
2025-08-09 01:19:55 +02:00
|
|
|
Here you can set options used in your game. The player will use the same options as you'll
|
|
|
|
|
have set here.
|
2023-05-04 11:48:58 +02:00
|
|
|
|
2025-08-09 01:19:55 +02:00
|
|
|
NOTE: The `leanOptions` and `moreServerOptions` influence how the player preceives the game.
|
|
|
|
|
For example, it is important to have `linter.all` set to `false` to prevent any linter
|
|
|
|
|
warnings from showing up during playing.
|
2023-08-04 17:14:49 +02:00
|
|
|
|
2025-08-09 01:19:55 +02:00
|
|
|
NOTE: We abuse the `trace.debug` option to toggle messages in VSCode on and
|
|
|
|
|
off when calling `lake build`. Ideally there would be a better way using `logInfo` and
|
|
|
|
|
an option like `lean4game.verbose`.
|
|
|
|
|
-/
|
2023-05-15 15:05:02 +02:00
|
|
|
package Game where
|
2025-08-09 01:19:55 +02:00
|
|
|
/- Used in all cases. -/
|
|
|
|
|
leanOptions := #[
|
|
|
|
|
/- linter warnings might block the player. (IMPORTANT) -/
|
|
|
|
|
⟨`linter.all, false⟩,
|
|
|
|
|
/- make all assumptions always accessible. -/
|
|
|
|
|
⟨`tactic.hygienic, false⟩]
|
|
|
|
|
/- Used when calling `lake build`. -/
|
2023-11-09 17:51:20 +01:00
|
|
|
moreLeanArgs := #[
|
2025-08-09 01:19:55 +02:00
|
|
|
-- TODO: replace with `lean4game.verbose`
|
2023-10-18 11:37:07 +02:00
|
|
|
"-Dtrace.debug=false"]
|
2025-08-09 01:19:55 +02:00
|
|
|
/- Used when opening a file in VSCode or when playing the game. -/
|
2024-01-24 22:38:38 +00:00
|
|
|
moreServerOptions := #[
|
2025-08-09 01:19:55 +02:00
|
|
|
-- TODO: replace with `lean4game.verbose`
|
2024-01-24 22:38:38 +00:00
|
|
|
⟨`trace.debug, true⟩]
|
2023-04-25 18:37:27 +02:00
|
|
|
|
|
|
|
|
@[default_target]
|
2023-05-15 15:05:02 +02:00
|
|
|
lean_lib Game
|