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 NNG.GameServer.Utils
|
||||
import NNG.GameServer.EnvExtensions
|
||||
import GameServer.Utils
|
||||
import GameServer.EnvExtensions
|
||||
|
||||
open Lean Meta
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import NNG.GameServer.HashMapExtension
|
||||
import NNG.GameServer.SingleValPersistentEnvExtension
|
||||
import GameServer.HashMapExtension
|
||||
import GameServer.SingleValPersistentEnvExtension
|
||||
|
||||
/-! # Environment extensions
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
import NNG.GameServer.Server
|
||||
import NNG.NNG
|
||||
|
||||
def System.FilePath.parent! (fp : System.FilePath) : System.FilePath :=
|
||||
match fp.parent with
|
||||
| some path => path
|
||||
| none => panic! "Couldn't find parent folder"
|
||||
|
||||
unsafe def main : IO Unit := do
|
||||
let build_folder := (← IO.appPath).parent!.parent!
|
||||
let paths : List System.FilePath := [build_folder/"lib",
|
||||
(← Lean.findSysroot) / "lib" / "lean"]
|
||||
Server.runGame `NNG paths
|
||||
import GameServer.Server
|
||||
|
||||
unsafe def main (args : List String) : IO Unit := do
|
||||
|
||||
if args.length != 2 then
|
||||
throw (IO.userError "Expected two arguments: The name of the game module and the path to the game project.")
|
||||
|
||||
let out ← IO.Process.output { cwd := args[1]!, cmd := "lake", args := #["env","printenv","LEAN_PATH"] }
|
||||
|
||||
if out.exitCode != 0 then
|
||||
IO.eprintln out.stderr
|
||||
else
|
||||
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
|
||||
open Lake DSL
|
||||
|
||||
package nng {
|
||||
-- add package configuration options here
|
||||
}
|
||||
|
||||
lean_lib NNG {
|
||||
-- add library configuration options here
|
||||
}
|
||||
package GameServer
|
||||
|
||||
lean_lib NNG.levels {
|
||||
-- add library configuration options here
|
||||
}
|
||||
lean_lib GameServer
|
||||
|
||||
@[defaultTarget]
|
||||
lean_exe nng {
|
||||
lean_exe gameserver {
|
||||
root := `Main
|
||||
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
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import NNG.Metadata
|
||||
import TestGame.Metadata
|
||||
|
||||
Level 2
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import NNG.Metadata
|
||||
import TestGame.Metadata
|
||||
|
||||
Level 3
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import NNG.Metadata
|
||||
import TestGame.Metadata
|
||||
|
||||
Level 4
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import NNG.Metadata
|
||||
import NNG.Tactics
|
||||
import TestGame.Metadata
|
||||
import TestGame.Tactics
|
||||
|
||||
Level 5
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import NNG.GameServer.Commands
|
||||
import NNG.MyNat
|
||||
import NNG.TacticDocs
|
||||
import NNG.LemmaDocs
|
||||
import GameServer.Commands
|
||||
import TestGame.MyNat
|
||||
import TestGame.TacticDocs
|
||||
import TestGame.LemmaDocs
|
||||
|
||||
Game "NNG"
|
||||
Game "TestGame"
|
||||
|
||||
Title "The Natural Number Game"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import NNG.GameServer.Commands
|
||||
import GameServer.Commands
|
||||
|
||||
import NNG.Tactics
|
||||
import TestGame.Tactics
|
||||
|
||||
TacticDoc rfl
|
||||
"
|
||||
@ -1,5 +1,5 @@
|
||||
import Lean
|
||||
import NNG.MyNat
|
||||
import TestGame.MyNat
|
||||
|
||||
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