split off test game
still need to adapt the call to the lean binary to provide two argumentspull/43/head
parent
7563730292
commit
d6bd2c98da
@ -0,0 +1,2 @@
|
|||||||
|
import GameServer.Commands
|
||||||
|
import GameServer.Server
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import Lean
|
import Lean
|
||||||
|
|
||||||
import NNG.GameServer.Utils
|
import GameServer.Utils
|
||||||
import NNG.GameServer.EnvExtensions
|
import GameServer.EnvExtensions
|
||||||
|
|
||||||
open Lean Meta
|
open Lean Meta
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import NNG.GameServer.HashMapExtension
|
import GameServer.HashMapExtension
|
||||||
import NNG.GameServer.SingleValPersistentEnvExtension
|
import GameServer.SingleValPersistentEnvExtension
|
||||||
|
|
||||||
/-! # Environment extensions
|
/-! # Environment extensions
|
||||||
|
|
||||||
@ -1,13 +1,16 @@
|
|||||||
import NNG.GameServer.Server
|
import GameServer.Server
|
||||||
import NNG.NNG
|
|
||||||
|
unsafe def main (args : List String) : IO Unit := do
|
||||||
def System.FilePath.parent! (fp : System.FilePath) : System.FilePath :=
|
|
||||||
match fp.parent with
|
if args.length != 2 then
|
||||||
| some path => path
|
throw (IO.userError "Expected two arguments: The name of the game module and the path to the game project.")
|
||||||
| none => panic! "Couldn't find parent folder"
|
|
||||||
|
let out ← IO.Process.output { cwd := args[1]!, cmd := "lake", args := #["env","printenv","LEAN_PATH"] }
|
||||||
unsafe def main : IO Unit := do
|
|
||||||
let build_folder := (← IO.appPath).parent!.parent!
|
if out.exitCode != 0 then
|
||||||
let paths : List System.FilePath := [build_folder/"lib",
|
IO.eprintln out.stderr
|
||||||
(← Lean.findSysroot) / "lib" / "lean"]
|
else
|
||||||
Server.runGame `NNG paths
|
let paths : List System.FilePath := System.SearchPath.parse out.stdout.trim
|
||||||
|
let currentDir ← IO.currentDir
|
||||||
|
let paths := paths.map fun p => currentDir / (args[1]! : System.FilePath) / p
|
||||||
|
Server.runGame (Lean.Name.mkSimple args[0]!) paths
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
import NNG.Metadata
|
|
||||||
import NNG.Levels.Level1
|
|
||||||
import NNG.Levels.Level2
|
|
||||||
import NNG.Levels.Level3
|
|
||||||
import NNG.Levels.Level4
|
|
||||||
import NNG.Levels.Level5
|
|
||||||
|
|
||||||
@ -1,20 +1,12 @@
|
|||||||
import Lake
|
import Lake
|
||||||
open Lake DSL
|
open Lake DSL
|
||||||
|
|
||||||
package nng {
|
package GameServer
|
||||||
-- add package configuration options here
|
|
||||||
}
|
|
||||||
|
|
||||||
lean_lib NNG {
|
|
||||||
-- add library configuration options here
|
|
||||||
}
|
|
||||||
|
|
||||||
lean_lib NNG.levels {
|
lean_lib GameServer
|
||||||
-- add library configuration options here
|
|
||||||
}
|
|
||||||
|
|
||||||
@[defaultTarget]
|
@[defaultTarget]
|
||||||
lean_exe nng {
|
lean_exe gameserver {
|
||||||
root := `Main
|
root := `Main
|
||||||
supportInterpreter := true
|
supportInterpreter := true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
build
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import TestGame.Metadata
|
||||||
|
import TestGame.Levels.Level1
|
||||||
|
import TestGame.Levels.Level2
|
||||||
|
import TestGame.Levels.Level3
|
||||||
|
import TestGame.Levels.Level4
|
||||||
|
import TestGame.Levels.Level5
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import NNG.Metadata
|
import TestGame.Metadata
|
||||||
|
|
||||||
Level 1
|
Level 1
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import NNG.Metadata
|
import TestGame.Metadata
|
||||||
|
|
||||||
Level 2
|
Level 2
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import NNG.Metadata
|
import TestGame.Metadata
|
||||||
|
|
||||||
Level 3
|
Level 3
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import NNG.Metadata
|
import TestGame.Metadata
|
||||||
|
|
||||||
Level 4
|
Level 4
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import NNG.Metadata
|
import TestGame.Metadata
|
||||||
import NNG.Tactics
|
import TestGame.Tactics
|
||||||
|
|
||||||
Level 5
|
Level 5
|
||||||
|
|
||||||
@ -1,9 +1,9 @@
|
|||||||
import NNG.GameServer.Commands
|
import GameServer.Commands
|
||||||
import NNG.MyNat
|
import TestGame.MyNat
|
||||||
import NNG.TacticDocs
|
import TestGame.TacticDocs
|
||||||
import NNG.LemmaDocs
|
import TestGame.LemmaDocs
|
||||||
|
|
||||||
Game "NNG"
|
Game "TestGame"
|
||||||
|
|
||||||
Title "The Natural Number Game"
|
Title "The Natural Number Game"
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import NNG.GameServer.Commands
|
import GameServer.Commands
|
||||||
|
|
||||||
import NNG.Tactics
|
import TestGame.Tactics
|
||||||
|
|
||||||
TacticDoc rfl
|
TacticDoc rfl
|
||||||
"
|
"
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import Lean
|
import Lean
|
||||||
import NNG.MyNat
|
import TestGame.MyNat
|
||||||
|
|
||||||
open Lean Elab Tactic
|
open Lean Elab Tactic
|
||||||
|
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
import Lake
|
||||||
|
open Lake DSL
|
||||||
|
|
||||||
|
require GameServer from ".."/"server"
|
||||||
|
|
||||||
|
package TestGame
|
||||||
|
|
||||||
|
@[defaultTarget]
|
||||||
|
lean_lib TestGame
|
||||||
@ -0,0 +1 @@
|
|||||||
|
leanprover/lean4:nightly-2022-09-23
|
||||||
Loading…
Reference in New Issue