DiplomacyBlabBotJohn Newbury 19 October 2008 |
AI in the Game of Diplomacy: the BlabBot Bot
BlabBot is a bot that I am developing, as an extension to David Norman's DAIDE AiClient Framework, initially just to deal with all types of press message (hence its name), but now much more besides. BlabBot, the bot and its phase within my overall Diplomacy project, are commonly abbreviated to BB. It is founded on the BlabBot Base (BBB).
The C++ source, tested under Microsoft Visual Studio version 6.0 in Windows XP Home Edition, will be released, free for non-profit purposes, when more fully debugged and documented.
You may download the binary version of BlabBot 2.1. See Acknowledgements and Conditions of Use.
It is identical to Version 1.0, except that it corrects various bugs. As of release, it beats all bots except KissMyBot 3.01 (in a suitable tournament; for example, Tournament #9).
This is now withdrawn, as Version 2.1 fully replaces it and more. Performance in Tournament #9 would have been identical..
This is now withdrawn, as a critical bug in its heuristic code left it insignificantly better than DumbBot 4.
See Roadmap for likely features.
The following optional command-line arguments may be used in addition to those of DumbBot:
-f[Prefix]
where [Prefix] is prepended to the error_log file name (to distinguish files
of multiple instances).
-n[Policy]
where Policy controls certain aspects of its play. See Heuristics
for details. [Policy] may currently be:
Joe – i.e., Honest Joe
It remains "honest" until the end of the game. It will offer a
DRW each turn when all remaining players have agreed PCE.
Mac – i.e., Mac the Knife
It stabs when all remaining players have agreed to PCE. It never
requests a DRW.
If [Policy] is omitted, -n is optional. Optimum "Tournament" play is then used, the details of which are (deliberately) undefined, possibly varying from game to game.
-v[PlayLevel]
where [PlayLevel] is the maximum playing level allowed (used to reduce
ability below maximum allowed by server). If specified, the -v argument is
appended to the announced bot-name.
-w[WindowSize]
where [WindowSize] is 0 (no window), 1 (minimised window) or 2 (normal
window). 2 is the default; 0 currently only minimises (until I find how to
eliminate it.)
The heuristics of version 2.1 are as follows (later versions being very similar, as will be explained on release):
BlabBot is basically David Norman's DumbBot, but with very simple press enabled, as follows, where x is our own power:
Send PRP(PCE(x y)) separately to every power y.
If we receive YES(PRP(PCE(x y))) from power y, then consider y to be our "friend".
If we receive PRP(PCE(x y)) from power y, then send YES(PRP(PCE(x y))) to y.
If we receive confirmation to our YES from the server, before we receive a cancellation from y to the PRP from y, then consider y to be our "friend".
If all remaining powers are our friends, action depends on Policy:
Joe: issue DRW (no arguments) each turn.
Mac: use normal DumbBot strategy; that is, ignore friendship.
<default>: undefined.
If at least one remaining power is not a friend, then make the DumbBot strategy use "friendly" weighting factors for friendly powers. Basically, friends are treated more like we treat our own power. We assign low weights to attack their supply centres and low weights to defend against attacks from them. Friends are ignored when considering strength of the worst potential attack, and for strength of our own attack or defence. (See source, when released, for details.)
Wait one second in the first turn before submitting orders, to allow time for peace to be negotiated, without delaying the game too much.
If a peace agreement is reached after we have submitted our orders, send revised orders.
No press is sent of accepted if BlabBot is restricted to Level < 10.
Friendship may be noted in [2] and/or [4]. If both sides use the same strategy, both events occur.
The complexity of waiting until [4] before noting friendship, rather than doing so in [3], is in anticipation of a CANCEL statement being defined.
If we are friends with everyone [5], we ignore friendship to help get a game resolution (otherwise no one tends to attack anyone).
In [5] there is code to send a DRW (no arguments); that is, agree to draw between all remaining players. This saves time in the final stages, especially when only BlabBots are left, as the net result would be the same no matter which bot soloed or was eliminated. Interestingly, if only BlabBots are entered in a game, they immediately agree not to compete. However, this feature is temporarily withdrawn, as the DTDT (tournament director) cannot cope with the game summary message from server (as it does not include year of termination). (If David does not add the year here, an Observer will be needed to report it to DTDT.)
I do not claim that my heuristic in [6] is optimum (or even that I fully understand the DumbBot method).
GOF is (left) set, so without the small delay in [7], the turn might finish before all possible peace had been negotiated – wasting some potential cooperation in the first turn. However, slow players; for example, humans, still get a chance to be treated as friends (as long as they do not all submit their orders too quickly after sending their agreement – impossibly quick for humans).
Peace agreements in the above form are accepted in any turn; once made they are never rescinded. (Strictly speaking, this would need to be changed if PRPs are redefined to be cancelled at the end of a turn, but this would not alter the effectiveness for communication between existing bots.)
The order of powers x and y is immaterial, except that we retain the order when sending replies. (We tolerate either order on replies received.)
A BWX reply is sent for any other recognised and valid press that requires a reply (even including a proposal for NOT(PCE(x y)), PCE that specifies other powers, or use of INS instead of PRP).
A HUH reply is sent for press; that is, too high a level, followed by a TRY if not previously sent to that power.
The same should apply if received press appears to be syntactically or semantically invalid (though the former ought to be eliminated by the server). However, this currently often (perhaps always) crashes the bot.
A similar approach could probably be applied to most other bots, so BlabBot's high rating and ranking (in suitable tournaments) is likely to be temporary. Furthermore, the strategy is extremely fragile: it relies on total trust between bots with a peace agreement. It would presumably fare much worse than DumbBot against any bot that negotiated peace but did not honour it. Against such a liar, BlabBot would leave itself defenceless, never attempt to exploit the apparent friend, nor even attempt to detect the lie.
Like any other press strategy, its effect will be neutral if too few other bots can understand it, and will be ineffective if too many use the same strategy. Its effect will only be significant in certain types of tournament, where there tend to be many clones in any game.
The name BlabBot (BB) not only indicates an ability and propensity to talk (use press) – albeit it does so much more than when originally conceived – but also indicates that it gives away full details many parts of my bot code that I could well have chosen to keep secret. Note the colours representing land and sea, and conflict between the two bloody red Bs (belligerent b*st*rds) that confront one another in the BlabBot icon.
BlabBot is based on DumbBot, produced by David Norman, and which incorporates components produced by Andrew Rose. It also uses a random number generator by Takuji Nishimura and Makoto Matsumoto.
BlabBot and its documentation, may be freely used for non-commercial purposes. All rights reserved. No warranty or liability is expressed or implied. Please contact me if you may wish to use it for commercial purposes. See BlabBot Conditions of Use.doc in the corresponding blabbot zip file for details.