Permalink
Browse files

Fix bugs, update players styles and AI, better UI

  • Loading branch information...
1 parent 20106ed commit 7444c5ed4e0272e581683958693d504e3f40526f @javierbyte committed Feb 7, 2016
View
Oops, something went wrong.
View
Oops, something went wrong.
View
@@ -2,7 +2,11 @@
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'>
+
<title>ClashJS | AI Javascript Battle Game</title>
+ <meta name='description' content='Javascript artificial intelligence battle game. Create a spaceship AI and kill your enemies!'>
+ <meta property='og:image' content='https://github.com/javierbyte/clashjs/raw/master/spec_assets/screenshot.jpg'/>
+
<link rel='stylesheet' href='styles.css'>
<link href='favicon.ico' rel='icon' type='image/x-icon' />
</head>
View
@@ -25,16 +25,13 @@
"homepage": "https://github.com/javierbyte/clashjs",
"devDependencies": {
"babel-core": "^5.4.7",
- "babel-eslint": "^3.1.9",
"babel-loader": "^5.1.2",
- "eslint-plugin-react": "^2.3.0",
"react-hot-loader": "^1.2.7",
+ "standard": "^6.0.3",
"webpack": "^1.9.6",
"webpack-dev-server": "^1.8.2"
},
"dependencies": {
- "eslint": "^1.1.0",
- "eslint-plugin-react": "^2.7.1",
"lodash": "^3.10.0",
"react": "^0.13.0",
"seedrandom": "^2.4.2"
View
@@ -1,10 +1,11 @@
module.exports = {
- javierbyte: require('./players/javierbyte.js'),
+ codingpains: require('./players/codingpains.js'),
+ manuelmhtr: require('./players/manuelmhtr.js'),
+ // ericku: require('./players/ericku.js'),
+ // siegfried: require('./players/siegfried.js'),
horror: require('./players/horror.js'),
- jgroom33: require('./players/jgroom33.js'),
- will3: require('./players/will3.js'),
- tomachi: require('./players/tomachi.js'),
- mel: require('./players/mel.js'),
- merica: require('./players/merica.js'),
- astaroth: require('./players/astaroth.js')
-};
+ elperron: require('./players/elperron.js'),
+ yuno: require('./players/yuno.js'),
+ xmontoya: require('./players/xmontoya.js'),
+ margeux: require('./players/margeux.js')
+}
@@ -6,7 +6,7 @@ var DIRECTIONS = ['north', 'east', 'south', 'west'];
class ClashJS {
constructor(playerDefinitionArray, currentStats, evtCallback) {
- this._totalRounds = playerDefinitionArray.length * 5;
+ this._totalRounds = playerDefinitionArray.length * 2 + 5;
this._rounds = 0;
this._gameStats = currentStats || {};
this._evtCallback = evtCallback;
@@ -83,9 +83,8 @@ class ClashJS {
if (this._sudeenDeathCount > (250 * this._alivePlayerCount)) {
this._handleCoreAction('DRAW');
return this._evtCallback('DRAW');
- // return this.getState();
}
- let clonedStates = _.clone(this._playerStates, true);
+ let clonedStates = _.cloneDeep(this._playerStates, true);
if (this._alivePlayerCount <= 3) {
this._sudeenDeathCount++;
}
@@ -96,19 +95,12 @@ class ClashJS {
});
if (this._playerStates[this._currentPlayer].isAlive) {
-
- console.info({
- userState: clonedStates[this._currentPlayer],
- enemiesState: otherPlayers,
- gameEnv: _.clone(this._gameEnvironment, true)
- })
-
this._savePlayerAction(
this._currentPlayer,
this._playerInstances[this._currentPlayer].execute(
clonedStates[this._currentPlayer],
otherPlayers,
- _.clone(this._gameEnvironment, true)
+ _.cloneDeep(this._gameEnvironment, true)
)
);
}
@@ -152,7 +144,6 @@ class ClashJS {
let {wins, winrate} = playerStats;
playerStats.winrate = Math.round(wins * 100 / this._rounds);
});
- console.log(this._playerStates);
if (this._rounds >= this._totalRounds) {return this._evtCallback('END');}
}
}
Oops, something went wrong.

0 comments on commit 7444c5e

Please sign in to comment.