Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy PR for review #1

Open
wants to merge 66 commits into
base: review
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
a57b1ad
Init nanowar
fraknoiadam Oct 30, 2022
ad34515
bugfixes and ask
Oct 30, 2022
352255d
resolved conficts
Oct 30, 2022
3d36b10
added option to ask for number of lines
Oct 30, 2022
354ed3a
fixing bugs in nanowar
fraknoiadam Nov 1, 2022
4c177e2
Change position to x and y
fraknoiadam Nov 6, 2022
267fbb0
Rename some vars
fraknoiadam Nov 6, 2022
e1a0c69
add state export functions to the visualizer
fraknoiadam Nov 6, 2022
080f570
Refactor nanowar (create types.ts and initStates.ts)
fraknoiadam Nov 6, 2022
a5a2490
fix bug in fights
fraknoiadam Nov 6, 2022
441369c
fix some bugs in nanowar
fraknoiadam Nov 7, 2022
4c1e973
fix playerIDs in initStates
fraknoiadam Nov 7, 2022
a755183
fix game ends
fraknoiadam Nov 7, 2022
13d85d7
rethink output of troops
Nov 7, 2022
9bb38cf
Add AI Arena configuration
leanil Nov 26, 2022
6eee43c
Remove node_modules and dist
leanil Nov 27, 2022
1a918c8
Add eslint & prettier config
leanil Nov 27, 2022
d259b60
Run auto fixes and formatting
leanil Nov 27, 2022
c3dd785
Handle spaces in program paths
leanil Dec 11, 2022
2854762
Exit _after_ the match is over
leanil Dec 11, 2022
cb21212
Scale down cover image
leanil Dec 21, 2022
8bd5d4c
update nanowar based on Andris' suggestions
fraknoiadam Dec 23, 2022
b1d0f59
update .gitignore, remove unnecessary files and .out files
fraknoiadam Dec 23, 2022
910a0cd
Terminate the bots at the end
leanil Mar 12, 2023
c3822d8
Fix the reported errors & most of the warnings
leanil Mar 12, 2023
1f560b1
Move source files to src/
leanil Mar 12, 2023
e0b1be1
Pass bot ids in match config file
leanil Mar 15, 2023
8fa71f1
Clean up maps
leanil Mar 15, 2023
9756905
Create score.json after match
leanil Apr 1, 2023
24b0429
Make package script executable
leanil Apr 2, 2023
44626da
Scale down cover image
leanil Apr 2, 2023
225644d
Clean up dependencies
leanil Apr 2, 2023
7906df2
Omit dev dependencies at non-dev install
leanil Apr 2, 2023
8f9673c
Use mv instead of rename to rename files
leanil Apr 3, 2023
7d8e0ff
Turn on strict null checks
leanil Apr 6, 2023
8b5e10d
Save & log server-bot communication
leanil Apr 7, 2023
c2e9f82
Save & log command errors
leanil Apr 7, 2023
72efa8c
Fix player id / name in match.log
leanil Apr 9, 2023
454a18e
Introduce player index & use string id
leanil Apr 10, 2023
4a960af
Add public demo bot for users
leanil Apr 10, 2023
cedc8a2
Change map config
leanil Apr 16, 2023
df1e772
Validate army size > 0
leanil Apr 17, 2023
acc7485
Update demo bot
leanil Apr 17, 2023
56f7034
Remove download link, it won't work
leanil Apr 19, 2023
a557b73
Add system bots
leanil Apr 25, 2023
2adecb4
Improve match logging
leanil Apr 25, 2023
c3dcbba
Fix: neutral wins the fight
leanil Apr 25, 2023
5d8cde0
Save bot log from stderr
leanil Apr 25, 2023
49d7fe4
Adjust planet sizes
leanil Apr 25, 2023
034a635
Invert the efficiencies
leanil Apr 26, 2023
55b9cc1
Add planet productions to the match log
leanil Apr 26, 2023
1165ab5
Fix the simulation order in the description
leanil Apr 26, 2023
fd44039
Improve error feedback
leanil Apr 29, 2023
a464bf8
Add more pre-packaged bots for easy testing
leanil Apr 30, 2023
432f287
Add limits and visualizer section to game description
leanil Apr 30, 2023
fdd6bf5
Invert the troop production logic (troop / round)
leanil May 19, 2023
514935f
Make the maps more interesting
leanil May 20, 2023
768147a
Fix playersAlive condition
leanil May 20, 2023
11363d9
Calculate scores from state after last tick
leanil May 21, 2023
3dfbf89
Add English game description
leanil Jun 8, 2023
5f5e0db
Support multiple description languages
leanil Jun 15, 2023
865d92b
Don't send planet coordinates to bots
leanil Jun 15, 2023
d311b99
Move BotConfig to common & cleanup
leanil Oct 12, 2023
1d83f68
Apply Quoridor improvements
leanil Nov 12, 2023
8532e29
Handle stream write errors
leanil Aug 23, 2024
33ab00b
Improve and fix game description
leanil Aug 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
coverage/
.eslintrc.cjs
10 changes: 10 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
ecmaVersion: "latest",
},
plugins: ["@typescript-eslint"],
root: true,
};
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.vscode
.idea

node_modules/
leanil marked this conversation as resolved.
Show resolved Hide resolved
a.out
dist/
planet-war-bot.zip
planet-war-server.zip
match.log
score.json

*.js
*.out
*.log
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"trailingComma": "all",
"printWidth": 100
}
5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# botWrapper

typescript node project to run and communicate with subprocesses
Binary file removed a.out
Binary file not shown.
45 changes: 45 additions & 0 deletions ai-arena.game.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "Planet War",
"shortDescription": "Conquer planets strategically to expand your empire over the whole galaxy.",
"picturePath": "./cover.png",
"fullDescription": {
"en": "game-description-en.md",
"hu": "game-description-hu.md"
},
"playerCount": {
"min": 2,
"max": 6
},
"maps": [
{
"name": "giant",
"path": "./maps/giant.json",
"playerCount": {
"min": 2,
"max": 2
}
},
{
"name": "face-to-face",
"path": "./maps/face-to-face.json",
"playerCount": {
"min": 2,
"max": 2
}
}
],
"bots": [
{
"name": "Test Bot (easy)",
"path": "bots/test-bot-easy.cpp"
},
{
"name": "Test Bot (hard)",
"path": "bots/test-bot-hard.zip"
}
],
"packageServer": {
"command": "chmod +x ./package_server.sh && ./package_server.sh",
"result": "./planet-war-server.zip"
}
}
5 changes: 5 additions & 0 deletions ai-arena.server.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"build": "npm install --omit=dev && npm run build && mv node_modules/ dist/node_modules/",
"programPath": "dist",
"run": "node %program/nanowar.js"
}
139 changes: 0 additions & 139 deletions app.ts

This file was deleted.

5 changes: 5 additions & 0 deletions bots/ai-arena.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"build": "g++ -O2 -std=c++17 -o bot *.cpp",
"programPath": "bot",
"run": "%program"
}
Binary file added bots/crash-bot.zip
Binary file not shown.
34 changes: 34 additions & 0 deletions bots/crash_bot.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <iostream>

#include "utility.hpp"
#include "data.hpp"

using namespace std;


void respond()
{
// Test some invalid moves
if (tick % 20 == 0) {
cerr << "Timing out..." << endl;
cerr << "in multiple lines" << endl;
return;
} else if (tick % 20 == 10) {
cout << 1 << endl;
cout << "-1 1 1\n";
} else {
cout << 0 << endl;
}
}


int main()
{
greeting();
initialize();
while (readTick())
{
if (tick == 20) return 1;
respond();
}
}
31 changes: 31 additions & 0 deletions bots/data.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once

#include <vector>

int playerID;

int P;

struct Planet
{
int production;
int playerID;
int population;
};

std::vector<Planet> planets;
std::vector<std::vector<int>> dist;

int tick;

int T;

struct Troop
{
int playerID;
int from, to;
int count;
int arrive;
};

std::vector<Troop> troops;
Binary file added bots/idle-bot.zip
Binary file not shown.
33 changes: 33 additions & 0 deletions bots/idle_bot.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <iostream>

#include "utility.hpp"
#include "data.hpp"

using namespace std;


void respond()
{
// Test some invalid moves
if (tick % 20 == 0) {
cerr << "Timing out..." << endl;
cerr << "in multiple lines" << endl;
return;
} else if (tick % 20 == 10) {
cout << 1 << endl;
cout << "-1 1 1\n";
} else {
cout << 0 << endl;
}
}


int main()
{
greeting();
initialize();
while (readTick())
{
respond();
}
}
Loading