{"id":21406124,"url":"https://github.com/jes/blotto","last_synced_at":"2026-01-03T06:17:15.809Z","repository":{"id":976989,"uuid":"776590","full_name":"jes/blotto","owner":"jes","description":"A program to run round-robin Colonel Blotto tournaments, and one to generate random teams.","archived":false,"fork":false,"pushed_at":"2010-09-03T12:37:04.000Z","size":104,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-23T03:44:22.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-07-15T12:44:30.000Z","updated_at":"2019-01-13T00:07:47.000Z","dependencies_parsed_at":"2022-08-16T11:40:36.684Z","dependency_job_id":null,"html_url":"https://github.com/jes/blotto","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jes%2Fblotto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jes%2Fblotto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jes%2Fblotto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jes%2Fblotto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jes","download_url":"https://codeload.github.com/jes/blotto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243902297,"owners_count":20366260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T16:31:24.287Z","updated_at":"2026-01-03T06:17:15.782Z","avatar_url":"https://github.com/jes.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Colonel Blotto\n\nColonel Blotto is a game in which a number of colonels are to arrange their\nsoldiers over a number of battlefields. Each colonel has equally many soldiers\nand the number of battlefields is the same for each battle.\n\nThere is a git repository at [github](http://github.com/jes/blotto).\n\n  1. The game\n  2. Compiling\n  3. Usage of blotto\n  4. Usage of genteam\n  5. Elastic tabstops\n  6. Contact\n\n## 1. The game\n\nA rather excellent description of the game can be found on Jonathan Partington's\n[site](http://www.amsta.leeds.ac.uk/~pmt6jrp/personal/blotto.html).\n\nFor the common configuration of the game, in which there are 10 battlefields and\n100 soldiers, each colonel assigns a number of soldiers to each battlefield. For\nexample, consider a game between Alice and Bob, who assign their soldiers as\nfollows:  \n  `Alice: 10 10 10 10 10 10 10 10 10 10`  \n  `Bob:   12  8 12  8 12  8 12  8 12  8`  \nWe can see that Bob wins on the first battlefield by having 12 soldiers against\nAlice's 10. On the second field, Alice wins by having 10 against Bob's 8. In\nall, the two colonels draw the game because each wins on 5 battlefields.\n\n## 2. Compiling\n\nCompiling the programs is very simple, just run  \n  `$ make`  \nand the files `blotto` and `genteam` will be created. You can use these programs\nwhere they are if you wish, or you can install them with  \n  `$ make install`  \n\nIf you wish to install in to a different prefix, use, for example:  \n  `$ make PREFIX=/usr/local install`  \n\nYou can also set DESTDIR, for example to install somewhere under /opt.\n\n## 3. Usage of blotto\n\nThe `blotto` program runs a round-robin tournament between a number of colonels,\nand outputs a nice table of results at the end. The program assigns 2 points for\na win and 1 for a draw.\n\nRunning the game described above between Alice and Bob could go as follows.  \n  `$ blotto 10 100`  \nto start the program with 10 battlefields and 100 soldiers per colonel. Next,\ninstructions to the operator will be printed because stdin is an interactive\nterminal. The armies would be input, as  \n  `alice 10 10 10 10 10 10 10 10 10 10`  \nand  \n  `bob 12 8 12 8 12 8 12 8 12 8`  \nAfter the armies are input, the user must generate an EOF, which is usually\nachieved by typing Ctrl-D.\n\n`blotto` will run the tournament (which for two armies involves only one game),\nand then print out a nicely-formatted table of results.\n\n## 4. Usage of genteam\n\nThe `genteam` program generates a number of randomly-generated teams and outputs\nin a format suitable for piping directly to the input of `blotto`.\n\nTo generate one random team for the usual 10/100 configuration, run  \n  `$ genteam 10 100`  \nand you will get something like  \n  `team1 10 9 11 13 11 13 4 14 8 7`  \n\nIf you want a lot more teams, append the number of teams you want to the command\nline arguments, for example  \n  `$ genteam 10 100 5`  \nwould generate 5 random teams.\n\nIf you want to run a tournament between 5 teams, you can run  \n  `$ genteam 10 100 5 | blotto 10 100`\n\n## 5. Elastic tabstops\n\nIf you read some of the source code for these programs you may notice that the\nindentation looks very strange in your editor. This is because I use\n[elastic tabstops](http://nickgravgaard.com/elastictabstops/) to have blocks of\nrelated code automatically align. There is a nice java applet demonstrating the\nsystem in the page linked.\n\n## 6. Contact\n\nIf you find a bug or just want to contact me for any reason, send an email to  \n  James Stanley \u003cjames@incoherency.co.uk\u003e  \nor find me on IRC as the user `jamesstanley` on `irc.freenode.net`. I am\nusually in the channel `#maximilian`, so you'll probably find me in there.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjes%2Fblotto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjes%2Fblotto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjes%2Fblotto/lists"}