{"id":13658436,"url":"https://github.com/daed/mathhammer","last_synced_at":"2026-01-17T14:12:02.457Z","repository":{"id":106010028,"uuid":"94270061","full_name":"daed/mathhammer","owner":"daed","description":"A python script for modelling warhammer 40k damage probability","archived":false,"fork":false,"pushed_at":"2018-05-25T20:34:03.000Z","size":18,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-02T05:08:49.550Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-14T00:17:39.000Z","updated_at":"2022-03-03T11:51:46.000Z","dependencies_parsed_at":"2024-01-22T03:50:50.416Z","dependency_job_id":"27b02c58-5cd5-4819-b8ca-9b2e0cb00e8b","html_url":"https://github.com/daed/mathhammer","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/daed%2Fmathhammer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daed%2Fmathhammer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daed%2Fmathhammer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daed%2Fmathhammer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daed","download_url":"https://codeload.github.com/daed/mathhammer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223947427,"owners_count":17230021,"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-08-02T05:00:59.550Z","updated_at":"2026-01-17T14:12:02.451Z","avatar_url":"https://github.com/daed.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# mathhammer\nA python script for modelling warhammer 40k 8th edition damage probability.\n\nRequres Python 3.6+ for the secrets library\n\n```Syntax:  mathhammer.py \u003cnum shots\u003e \u003cbs/ws\u003e \u003cs\u003e \u003cap\u003e \u003ct\u003e \u003csv\u003e \u003cd\u003e```\n\nTo calculate 20 bolter shots from a space marine into other space marines:\n```mathhammer.py 20 3+ 4 0 4 3+ 1```\n\nThe result is the following chart:\n```\nDamage   Outcomes        percent\n     0       9489         9.5%\n     1      23751        23.8%\n     2      28360        28.4%\n     3      20966        21.0%\n     4      11213        11.2%\n     5       4466         4.5%\n     6       1339         1.3%\n     7        338         0.3%\n     8         68         0.1%\n     9         10         0.0%\n```\n\nThis chart means that, of all the hypothetical die rolls involved in trying these 20 attacks 100000 times, 28.4% of the time, 2 damage is dealt to the opposing squad of space marines.\n\nThe script is aware of damage and number of attacks.  Damage can be in integer values, or die notation (2d6, d6, d3, etc).  Ballistic skill and Saves can be expressed as integers or in 40k stat notation (3+, 2+, etc)\n\nRerolls to hit are implemented now.  After the end of the list of stats you provide, include -r if you want to reroll all failing to hits or -r1 if you only want to reroll 1s to hit.  Rerolling to wound is still not yet implemented.\n\nFor example:\n```mathhammer.py 20 3+ 4 0 4 3+ 1 -r1```\nThis will calculate the same bolter shots as above, but rerolling 1s to hit.\n\nFuture functionality may include providing invulnerable saves, but they are not implemented at this time.\n\nNote that since this script uses psuedorandom data to generate its result, each execution with the same parameters may provide a different result.  \n\nAlso note that it depends on the secrets module's number generator, which is supposedly better than the random module.  I think it still depends on the underlying OS's RNG system, which is said to be lackluster in Windows.  I've not tested it on other OSs yet, though I can think no reasons why it wouldn't be compatible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaed%2Fmathhammer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaed%2Fmathhammer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaed%2Fmathhammer/lists"}