Skip to content

Commit

Permalink
Merge branch 'dev' of ssh://ssh.github.com:443/hhzzff/THUAI7 into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
hhzzff committed Apr 26, 2024
2 parents 8942193 + bf2296d commit d48c73c
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 82 deletions.
2 changes: 1 addition & 1 deletion CAPI/cpp/API/include/API.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class IAPI
public:
// 选手可执行的操作,应当保证所有函数的返回值都应当为std::future,例如下面的移动函数:
// 指挥本角色进行移动,`timeInMilliseconds` 为移动时间,单位为毫秒;`angleInRadian` 表示移动的方向,单位是弧度,使用极坐标——竖直向下方向为 x 轴,水平向右方向为 y 轴
// 发送信息、接受信息,注意收消息时无消息则返回nullopt
// 发送信息、接受信息,注意收消息时无消息则返回(-1,"")
virtual std::future<bool> SendTextMessage(int32_t toPlayerID, std::string) = 0;
virtual std::future<bool> SendBinaryMessage(int32_t toPlayerID, std::string) = 0;
[[nodiscard]] virtual bool HaveMessage() = 0;
Expand Down
55 changes: 25 additions & 30 deletions CAPI/cpp/API/include/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ namespace Constants
struct Home
{
SCCI int32_t maxHp = 24000;
SCCI int32_t energySpeed = 1;
SCCI int32_t energySpeed = 100;
};
struct Factory
{
SCCI int32_t maxHp = 8000;
SCCI int32_t energySpeed = 3;
SCCI int32_t energySpeed = 300;
};
struct Community
{
Expand All @@ -52,69 +52,69 @@ namespace Constants
SCCI int32_t basicArmor = 0;
SCCI int32_t basicShield = 0;
SCCI int32_t Speed = 3000;
SCCI int32_t Cost = 40;
SCCI int32_t Cost = 4000;
};
struct MilitaryShip
{
SCCI int32_t maxHp = 4000;
SCCI int32_t basicArmor = 400;
SCCI int32_t basicShield = 400;
SCCI int32_t Speed = 2800;
SCCI int32_t Cost = 120;
SCCI int32_t Cost = 12000;
};
struct FlagShip
{
SCCI int32_t maxHp = 12000;
SCCI int32_t basicArmor = 800;
SCCI int32_t basicShield = 800;
SCCI int32_t Speed = 2700;
SCCI int32_t Cost = 500;
SCCI int32_t Cost = 50000;
};

// 模块
struct Producer
{
SCCI int32_t energySpeed1 = 5;
SCCI int32_t energySpeed2 = 7;
SCCI int32_t energySpeed3 = 10;
SCCI int32_t energySpeed1 = 100;
SCCI int32_t energySpeed2 = 200;
SCCI int32_t energySpeed3 = 300;
SCCI int32_t Cost1 = 0;
SCCI int32_t Cost2 = 40;
SCCI int32_t Cost3 = 80;
SCCI int32_t Cost2 = 4000;
SCCI int32_t Cost3 = 8000;
};
struct Constructor
{
SCCI int32_t constructSpeed1 = 500;
SCCI int32_t constructSpeed2 = 750;
SCCI int32_t constructSpeed3 = 1000;
SCCI int32_t constructSpeed1 = 300;
SCCI int32_t constructSpeed2 = 400;
SCCI int32_t constructSpeed3 = 500;
SCCI int32_t Cost1 = 0;
SCCI int32_t Cost2 = 40;
SCCI int32_t Cost3 = 80;
SCCI int32_t Cost2 = 4000;
SCCI int32_t Cost3 = 8000;
};
struct Armor
{
SCCI int32_t armor1 = 2000;
SCCI int32_t armor2 = 3000;
SCCI int32_t armor3 = 4000;
SCCI int32_t Cost1 = 60;
SCCI int32_t Cost2 = 120;
SCCI int32_t Cost3 = 180;
SCCI int32_t Cost1 = 6000;
SCCI int32_t Cost2 = 12000;
SCCI int32_t Cost3 = 18000;
};
struct Shield
{
SCCI int32_t shield1 = 2000;
SCCI int32_t shield2 = 3000;
SCCI int32_t shield3 = 4000;
SCCI int32_t Cost1 = 60;
SCCI int32_t Cost2 = 120;
SCCI int32_t Cost3 = 180;
SCCI int32_t Cost1 = 6000;
SCCI int32_t Cost2 = 12000;
SCCI int32_t Cost3 = 18000;
};
struct Weapon
{
SCCI int32_t LaserCost = 0;
SCCI int32_t PlasmaCost = 120;
SCCI int32_t ShellCost = 130;
SCCI int32_t MissileCost = 180;
SCCI int32_t ArcCost = 240;
SCCI int32_t PlasmaCost = 12000;
SCCI int32_t ShellCost = 13000;
SCCI int32_t MissileCost = 18000;
SCCI int32_t ArcCost = 24000;
};

// 子弹
Expand Down Expand Up @@ -169,10 +169,5 @@ namespace Constants
SCCI int32_t CastTime = 600; // ms
SCCI int32_t BackSwing = 600;
};

// SCCI int32_t basicStudentAlertnessRadius = 15 * numOfGridPerCell;
// SCCI int32_t basicTrickerAlertnessRadius = 17 * numOfGridPerCell;
// SCCI int32_t basicStudentViewRange = 10 * numOfGridPerCell;
// SCCI int32_t basicTrickerViewRange = 13 * numOfGridPerCell;
} // namespace Constants
#endif
6 changes: 2 additions & 4 deletions CAPI/cpp/API/src/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ void Logic::Main(CreateAIFunc createAI, std::string IP, std::string port, bool f
fileLogger->set_pattern(pattern);
printLogger->set_pattern(pattern);
if (file)
fileLogger->set_level(spdlog::level::trace);
fileLogger->set_level(spdlog::level::debug);
else
fileLogger->set_level(spdlog::level::off);
if (print)
Expand All @@ -936,10 +936,8 @@ void Logic::Main(CreateAIFunc createAI, std::string IP, std::string port, bool f
if (warnOnly)
printLogger->set_level(spdlog::level::warn);
logger = std::make_unique<spdlog::logger>("logicLogger", spdlog::sinks_init_list{fileLogger, printLogger});
// TODO
// logger->flush_on(spdlog::level::warn);
logger->flush_on(spdlog::level::trace);

logger->flush_on(spdlog::level::warn);
// 打印当前的调试信息
logger->info("*********Basic Info*********");
logger->info("asynchronous: {}", asynchronous);
Expand Down
69 changes: 26 additions & 43 deletions CAPI/python/PyAPI/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,94 +11,81 @@ class Constants:
recycleMultiplier = 0.5
sizeOfShip = 800


class Home:
maxHp = 24000
energySpeed = 1

energySpeed = 100

class Factory:
maxHp = 8000
energySpeed = 3

energySpeed = 300

class Community:
maxHp = 6000


class Fort:
maxHp = 12000
attackRange = 8000
damage = 1200


class CivilianShip:
Speed = 3000
basicArmor = 0
basicShield = 0
maxHp = 3000
Cost = 40

Cost = 4000

class MilitaryShip:
Speed = 2800
basicArmor = 400
basicShield = 400
maxHp = 4000
Cost = 120

Cost = 12000

class FlagShip:
Speed = 2700
basicArmor = 800
basicShield = 800
maxHp = 12000
Cost = 500

Cost = 50000

class Producer:
energySpeed1 = 5
energySpeed2 = 7
energySpeed3 = 10
energySpeed1 = 100
energySpeed2 = 200
energySpeed3 = 300
Cost1 = 0
Cost2 = 40
Cost3 = 80

Cost2 = 4000
Cost3 = 8000

class Constructor:
constructSpeed1 = 500
constructSpeed2 = 750
constructSpeed3 = 1000
constructSpeed1 = 300
constructSpeed2 = 400
constructSpeed3 = 500
Cost1 = 0
Cost2 = 40
Cost3 = 80

Cost2 = 4000
Cost3 = 8000

class Armor:
armor1 = 2000
armor2 = 3000
armor3 = 4000
Cost1 = 60
Cost2 = 120
Cost3 = 180

Cost1 = 6000
Cost2 = 12000
Cost3 = 18000

class Shield:
shield1 = 2000
shield2 = 3000
shield3 = 4000
Cost1 = 60
Cost2 = 120
Cost3 = 180

Cost1 = 6000
Cost2 = 12000
Cost3 = 18000

class Weapon:
LaserCost = 0
PlasmaCost = 120
ShellCost = 130
MissleCost = 180
ArcCost = 240

PlasmaCost = 12000
ShellCost = 13000
MissleCost = 18000
ArcCost = 24000

class Laser:
Damage = 1200
Expand All @@ -109,17 +96,15 @@ class Laser:
CastTime = 300
BackSwing = 300


class Plasma:
Damage = 1300
AttackRange = 4000
ArmorDamageMultiplier = 2
ArmorDamageMultiplier = 2.0
ShieldDamageMultiplier = 0.4
Speed = 10000
CastTime = 400
BackSwing = 400


class Shell:
Damage = 1800
AttackRange = 4000
Expand All @@ -129,7 +114,6 @@ class Shell:
CastTime = 200
BackSwing = 200


class Missle:
Damage = 1600
AttackRange = 8000
Expand All @@ -140,7 +124,6 @@ class Missle:
CastTime = 600
BackSwing = 600


class Arc:
Damage = 3200
AttackRange = 8000
Expand Down
8 changes: 4 additions & 4 deletions installer/Model/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,11 @@ protected override void Log(LogLevel logLevel, int eventId, string message)
writer.WriteLine($"[{DateTime.Now:HH:mm:ss.fff}, {eventId}] Warning: {message}");
break;
case LogLevel.Error:
writer.WriteLine("\nError happens!");
writer.WriteLine("\nError occurred!");
writer.WriteLine($"[{DateTime.Now:HH:mm:ss.fff}, {eventId}] Error: {message}\n");
break;
case LogLevel.Critical:
writer.WriteLine("\nCritical error happens!");
writer.WriteLine("\nCritical error occurred!");
writer.WriteLine($"[{DateTime.Now:HH:mm:ss.fff}, {eventId}] Critical: {message}\n");
break;
default:
Expand Down Expand Up @@ -323,11 +323,11 @@ protected override void Log(LogLevel logLevel, string message)
writer.WriteLine($"[{DateTime.Now:HH:mm:ss.fff}, ~] Warning: {message}");
break;
case LogLevel.Error:
writer.WriteLine("\nError happens!");
writer.WriteLine("\nError occurred!");
writer.WriteLine($"[{DateTime.Now:HH:mm:ss.fff}, ~] Error: {message}\n");
break;
case LogLevel.Critical:
writer.WriteLine("\nCritical error happens!");
writer.WriteLine("\nCritical error occurred!");
writer.WriteLine($"[{DateTime.Now:HH:mm:ss.fff}, ~] Critical: {message}\n");
break;
default:
Expand Down

0 comments on commit d48c73c

Please sign in to comment.