chore: standardize internal bot dir structure (src/, tests/, out/)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ version = "0.1.0"
|
|||||||
author = "Davide Cappellini"
|
author = "Davide Cappellini"
|
||||||
description = "GotoTest — throwaway goto(x,y) controller prototype"
|
description = "GotoTest — throwaway goto(x,y) controller prototype"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
srcDir = "src"
|
||||||
bin = @["GotoTest"]
|
bin = @["GotoTest"]
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ version = "0.1.0"
|
|||||||
author = "Davide Cappellini"
|
author = "Davide Cappellini"
|
||||||
description = "PPO-trained Tank Royale bot"
|
description = "PPO-trained Tank Royale bot"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
srcDir = "src"
|
||||||
bin = @["PPO_Bot"]
|
bin = @["PPO_Bot"]
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
switch("passL", "-L/nix/store/v07svn2y92bvzjl51aj7c9ca1cwg7rw7-openblas-0.3.32/lib -lopenblas")
|
switch("passL", "-L/nix/store/v07svn2y92bvzjl51aj7c9ca1cwg7rw7-openblas-0.3.32/lib -lopenblas")
|
||||||
switch("threads", "on")
|
switch("threads", "on")
|
||||||
switch("outdir", "out")
|
switch("outdir", "out")
|
||||||
|
switch("path", thisDir() & "/src")
|
||||||
# begin Nimble config (version 2)
|
# begin Nimble config (version 2)
|
||||||
when withDir(thisDir(), system.fileExists("nimble.paths")):
|
when withDir(thisDir(), system.fileExists("nimble.paths")):
|
||||||
include "nimble.paths"
|
include "nimble.paths"
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
import std/[os, strformat, strutils, math, times, algorithm]
|
import std/[os, strformat, strutils, math, times, algorithm]
|
||||||
import arraymancer
|
import arraymancer
|
||||||
import tankroyale_botapi
|
import tankroyale_botapi
|
||||||
import network
|
import PPO_Bot/network
|
||||||
import actions
|
import PPO_Bot/actions
|
||||||
import training
|
import PPO_Bot/training
|
||||||
import weights
|
import PPO_Bot/weights
|
||||||
import ./enemy_tracker
|
import PPO_Bot/enemy_tracker
|
||||||
import ./state_vector
|
import PPO_Bot/state_vector
|
||||||
|
|
||||||
# ── Hyperparameters from env vars (PPOB_ prefix) ─────────────────────────────
|
# ── Hyperparameters from env vars (PPOB_ prefix) ─────────────────────────────
|
||||||
# All optional; defaults match ppoUpdate signature in training.nim.
|
# All optional; defaults match ppoUpdate signature in training.nim.
|
||||||
@@ -64,7 +64,7 @@ proc hyperparmSnapshot(): string =
|
|||||||
&"\"logStdFloor\":{logStdFloor},\"logStdCeiling\":{logStdCeiling},\"initialLogStd\":{initialLogStd}"
|
&"\"logStdFloor\":{logStdFloor},\"logStdCeiling\":{logStdCeiling},\"initialLogStd\":{initialLogStd}"
|
||||||
|
|
||||||
const botJsonPath = currentSourcePath().parentDir / "PPO_Bot.json"
|
const botJsonPath = currentSourcePath().parentDir / "PPO_Bot.json"
|
||||||
const weightsRoot = currentSourcePath().parentDir / "weights"
|
const weightsRoot = currentSourcePath().parentDir / "../weights"
|
||||||
|
|
||||||
type
|
type
|
||||||
InFlightBullet = object
|
InFlightBullet = object
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
switch("path", "../src")
|
||||||
|
switch("path", "../../common_libs/tankroyale_botapi")
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
import std/[math, random]
|
import std/[math, random]
|
||||||
import arraymancer
|
import arraymancer
|
||||||
import "../network"
|
import PPO_Bot/network
|
||||||
import "../training"
|
import PPO_Bot/training
|
||||||
|
|
||||||
var ac = initActorCritic()
|
var ac = initActorCritic()
|
||||||
var adam: ACAdamStates # uninitialised → ppoUpdate must reinit (fresh-process path)
|
var adam: ACAdamStates # uninitialised → ppoUpdate must reinit (fresh-process path)
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
import std/[os]
|
import std/[os]
|
||||||
import arraymancer
|
import arraymancer
|
||||||
import "../network"
|
import PPO_Bot/network
|
||||||
import "../training"
|
import PPO_Bot/training
|
||||||
import "../weights"
|
import PPO_Bot/weights
|
||||||
|
|
||||||
const weightsRoot = currentSourcePath().parentDir.parentDir / "weights"
|
const weightsRoot = currentSourcePath().parentDir.parentDir / "weights"
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import arraymancer
|
import arraymancer
|
||||||
import std/math
|
import std/math
|
||||||
import "../actions"
|
import PPO_Bot/actions
|
||||||
|
|
||||||
template check(cond: bool, msg: string) =
|
template check(cond: bool, msg: string) =
|
||||||
if not cond:
|
if not cond:
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
## Run: nim c -r tests/test_controllers.nim
|
## Run: nim c -r tests/test_controllers.nim
|
||||||
|
|
||||||
import std/math
|
import std/math
|
||||||
import "../controllers"
|
import PPO_Bot/controllers
|
||||||
|
|
||||||
template check(cond: bool, msg: string) =
|
template check(cond: bool, msg: string) =
|
||||||
if not cond:
|
if not cond:
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
import arraymancer
|
import arraymancer
|
||||||
import std/[math, strformat]
|
import std/[math, strformat]
|
||||||
import ../network
|
import PPO_Bot/network
|
||||||
import ../actions
|
import PPO_Bot/actions
|
||||||
|
|
||||||
func isFiniteF(x: float32): bool = classify(x) notin {fcNan, fcInf, fcNegInf}
|
func isFiniteF(x: float32): bool = classify(x) notin {fcNan, fcInf, fcNegInf}
|
||||||
func isNaNF(x: float32): bool = classify(x) == fcNan
|
func isNaNF(x: float32): bool = classify(x) == fcNan
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
## Run: nim c -r tests/test_radar_lock.nim
|
## Run: nim c -r tests/test_radar_lock.nim
|
||||||
|
|
||||||
import std/[math, strformat]
|
import std/[math, strformat]
|
||||||
import "../enemy_tracker"
|
import PPO_Bot/enemy_tracker
|
||||||
|
|
||||||
template check(cond: bool, msg: string) =
|
template check(cond: bool, msg: string) =
|
||||||
if not cond:
|
if not cond:
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import std/[math, strformat]
|
|||||||
import arraymancer
|
import arraymancer
|
||||||
|
|
||||||
# Import from parent dir
|
# Import from parent dir
|
||||||
import "../enemy_tracker"
|
import PPO_Bot/enemy_tracker
|
||||||
import "../state_vector"
|
import PPO_Bot/state_vector
|
||||||
|
|
||||||
template check(cond: bool, msg: string) =
|
template check(cond: bool, msg: string) =
|
||||||
if not cond:
|
if not cond:
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
import std/[math, random]
|
import std/[math, random]
|
||||||
import arraymancer
|
import arraymancer
|
||||||
import "../network"
|
import PPO_Bot/network
|
||||||
import "../training"
|
import PPO_Bot/training
|
||||||
|
|
||||||
template check(cond: bool, msg: string) =
|
template check(cond: bool, msg: string) =
|
||||||
if not cond:
|
if not cond:
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
import std/[os, math]
|
import std/[os, math]
|
||||||
import arraymancer
|
import arraymancer
|
||||||
import "../network"
|
import PPO_Bot/network
|
||||||
import "../training"
|
import PPO_Bot/training
|
||||||
import "../weights"
|
import PPO_Bot/weights
|
||||||
|
|
||||||
template check(cond: bool, msg: string) =
|
template check(cond: bool, msg: string) =
|
||||||
if not cond:
|
if not cond:
|
||||||
|
|||||||
Binary file not shown.
@@ -3,6 +3,7 @@ version = "0.1.0"
|
|||||||
author = "Davide Cappellini"
|
author = "Davide Cappellini"
|
||||||
description = "Tabular Q-learning Tank Royale bot — chained action decomposition prototype"
|
description = "Tabular Q-learning Tank Royale bot — chained action decomposition prototype"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
srcDir = "src"
|
||||||
bin = @["QBot"]
|
bin = @["QBot"]
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
--path:"../common_libs"
|
--path:"../common_libs"
|
||||||
switch("outdir", "out")
|
switch("outdir", "out")
|
||||||
|
switch("path", thisDir() & "/src")
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import radar_lock/radar_lock as radar_lock
|
|||||||
|
|
||||||
# ── Constants ──────────────────────────────────────────────────────────────────
|
# ── Constants ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const botJsonPath = currentSourcePath().parentDir / "QBot.json"
|
const botJsonPath = currentSourcePath().parentDir / "../QBot.json"
|
||||||
const qtablesDir = currentSourcePath().parentDir / "qtables"
|
const qtablesDir = currentSourcePath().parentDir / "../qtables"
|
||||||
|
|
||||||
const
|
const
|
||||||
# State features
|
# State features
|
||||||
Reference in New Issue
Block a user