Description
This is a mixed try to make variation of Iterated prisoner's dilemma and simulator of PPM with tactics, antitactics, chemistry and so on.
Not very good try, of course. Very not good. At this moment I stuck at what is shown here.
Next files can be checked here:
- /js/strategies.js
- /js/sport.js (all functions named below are from this file if other is not specified)
- /js/controls.js
- We have a world where 6 tactics exist (named "0" to "5"). Each of them has one antitactic (var antiTactics).
- Then there are strategies that can be used by teams for selecting the tactic for the next game. Each team uses one strategy (at least for a some time).
- Then there are teams — see function createTeamList
- Then there is League which is array of leagues [League 1, League 2, ..., League leagueLevelQ]. Each league has leagueTeamQ teams. exchangeTeamQ teams from each league will be promoted to upper league (League[lower index] if such exists) in the end of each season, and same number of teams will relegate accordingly. Check function makeLeagueStructure, makeLeagueSchedule, playLeagueGames, makeLeagueStandings.
- Each league (as League[i]) has league.teams (list of teams which play there in the given season), league.games (list of games in the given season), league.standings (calculated in the end of season). For example, check League[0] object in browser console.
- Each game stores teams (host is first), round (gameday), score, strengths, used tactics. Check function runGame and objects like League[0].games[0]
- Simulation is strated with function initWorld and continued with function runSeason (called by the buttons "Create new world" and "Run next season")
Note: Objects in other objects are stored as pointers. Thus, for example, League[0].games[0].team[0] and League[0].standings[0].team do not store separate copies of items from teams array.
Just in case if somebody wanted to do something like this, but was lazy to start own work: everything here is in html and javascript (jquery) (php could be used — but wasn't — for multilingual interface), thus this page and it's js-files can be saved, modified and run locally.
Note: Regular page save may not store <template> elements in a local copy of html-file, so it's better to check and copy-paste (if needed) them manually.
Simulation
Teams
(Team name, strategy, and strength.)