Historical battle simulation package for Python

Overview

Jomini v0.1.4

Jomini GitHub license Maintenance

ForTheBadge built-with-love

Jomini creates military simulations by using mathematical combat models. Designed to be helpful for game developers, students, history enthusiasts and -to some extent- scientists. You can mail me at [email protected] if you want to contribute.

To download: https://pypi.org/project/Jomini

Documentation will be available in the next update.

Lanchester Models 101

This package uses the combat models developed by Frederick William Lanchester, a.k.a one of the founding fathers of Operations Research.

  • Lanchester Models are deterministic, which means the model will always yield the same result for the same input parameters.
  • Lanchester Models view battles as an attrition model, therefore manuevers and sudden changes during the battle can not be represented.
  • You might need to do some manual fine-tuning if you are not able to get quality parameters (rho, beta, engagement_width) from a data set.
  • Despite the downsides, even the primitive models developed by Lanchester himself works wonders with the right parameters.

Code Sample: Lanchester's Linear Law

  • The Linear Law is based on force concentration
  • Good for modelling melee battles and unaimed fire (artillery, arquebus, handcannon etc.)
from jomini.Lanchester import Battle, LinearLaw

# Re-creating the Battle of Cerignola (AD 1503)
# In the actual battle, Spanish(red) lost 500 men while the French(blue) lost 4000 men
# Parameters rho, beta, engagement_width and time are manually fine_tuned
b = Battle(red=6_300, blue=9_000, rho=0.0800, beta=0.0100)
L = LinearLaw(b, engagement_width=100)
print(L.get_casualty_rates()) # Returns casualty rates 
print(L.get_casualties(time=7))
print(L.get_remaining(time=7))
print(L.simulate_battle(time=7))

Linear Law

Code Sample: Visiting models used in Jomini

  • Square Law: Given equal power coefficients, the fighting power is proportional to the square of army size.
    • Good for modelling aimed fire (e.g Napoleonic line-battles)
  • Logarithmic Law: Basically square law at a larger scale, used by Weiss to model the American Civil War
    • Good for modelling tank combat as well
from jomini.Lanchester import Battle, LinearLaw, SquareLaw, LogarithmicLaw, GeneralLaw

# Simulating a fictitious battle with each of the laws
b = Battle(red=20_000, blue=30_000, rho=0.0150, beta=0.0120)
Linear = LinearLaw(b, engagement_width=500)
Square = SquareLaw(b)
Log = LogarithmicLaw(b)
Generalized = GeneralLaw(b, engagement_width=500, p=0.450, q=0.600)

# If time is not specified, the battle goes on until one side is annihilated.
print(Linear.simulate_battle() + "\n")
print(Square.simulate_battle() + "\n")
print(Log.simulate_battle() + "\n")
print(Generalized.simulate_battle())

Model-1 Model-2

You might also like...
Wordle-Python - A simple low-key clone of the popular game WORDLE made with python and a 2D Graphics module Pygame
Wordle-Python - A simple low-key clone of the popular game WORDLE made with python and a 2D Graphics module Pygame

Wordle-Python A simple low-key clone of the popular game WORDLE made with python

Tekken-python-ml - A project of playing tekken game using python
Tekken-python-ml - A project of playing tekken game using python

Tekken Python Description Hi this is new project of playing tekken game using py

Minecraft clone using Python Ursina game engine!
Minecraft clone using Python Ursina game engine!

Minecraft clone using Python Ursina game engine!

Lutris desktop client in Python / PyGObject

Lutris Lutris is an open source gaming platform that makes gaming on Linux easier by managing, installing and providing optimal settings for games. Lu

Python fitting assistant, cross-platform fitting tool for EVE Online
Python fitting assistant, cross-platform fitting tool for EVE Online

pyfa What is it? Pyfa, short for python fitting assistant, allows you to create, experiment with, and save ship fittings without being in game. Open s

AI that plays Flappy Bird Game using the python module NEAT.
AI that plays Flappy Bird Game using the python module NEAT.

Flappy Bird AI [NEAT] AI that plays Flappy Bird Game using the python module NEAT. Instructions Install Python Modules: pip3 install -r requirements.t

Parkour game made in Python with Ursina Game Engine along with ano0002, Greeny127 and Someone-github Creates a landscape with more accurate river generation in Minecraft version 1.12 using python.
Creates a landscape with more accurate river generation in Minecraft version 1.12 using python.

MinecraftLandRiverGen View the following youtube video to set up a world that can interact with the python programs

a game of life implementation in python

gameoflife-py python implementation of game of life Installing As long as you have bash and curl installed and are on Linux the install script should

Comments
  • Added more errors to fix issues

    Added more errors to fix issues

    Added TypeErrors where a side has 0 soldiers in battle Added ValueError for the following case in pseudocode: (rate_red > size_red and rate_blue > size_blue) Closes #3 Closes #4

    opened by umitkaanusta 0
Releases(v0.1.4)
Owner
Ümit Kaan Usta
Marmara University - CSE
Ümit Kaan Usta
Creates a landscape with more accurate river generation in Minecraft version 1.12 using python.

MinecraftLandRiverGen View the following youtube video to set up a world that can interact with the python programs

23 Dec 25, 2022
Editing tool (read/write) .sc files (*_tes.sc , *.sc, *_dl.sc ) from Supercell games (Brawl Stars, Clash Royale, Clash of Clans and others).

SupercellSWF Version 0.1.0.2 About Editing tool (read/write) .sc files (*_tes.sc , *.sc, *_dl.sc ) from Supercell games (Brawl Stars, Clash Royale, Cl

Fred31 11 Jun 23, 2022
Python module providing simple game networking

nethelper Python module providing simple game networking This module was originally created to facilitate a class on creating multiplayer games in Pyg

Cort 3 Jan 11, 2022
A visualization of how much Manchester United fans enjoyed each game from the first half of the 21/22 Premier League season.

Man-Utd-Fan-Satisfaction-Levels-First-19-games A visualization of how much Manchester United fans enjoyed each game from the first half of the 21/22 P

1 Jan 19, 2022
Dota2 AI bot - Last Order Dota2 Solo AI

Last Order Dota2 Solo AI 该库提供一个由强化学习训练出的Dota2影魔solo智能体。该智能体通过自我对战的训练方式训练,从随机动作开始学习复杂的策略。玩家可以与该智能体进行影魔solo对战。 对战规则 1.物品方面不可以出凝魂之露,灵魂之戒,魔瓶,真眼。 2.不可以吃符,或

bilibili 365 Jan 05, 2023
A didactic GUI chess game made in Python3 using pygame.

Chess A didactic GUI chess game made in Python3 using pygame. At the moment, there is no AI. The only way you can test the game is by playing against

Leonardo Delfino 1 Dec 22, 2021
Cricket game using PYQT

Cricket-game-using-PYQT This is a Fantasy cricket Desktop application build in p

Sanket Mane 1 Jan 03, 2022
The game company we work for has two events that we want to track: buy an item and join a guild. Each of them has metadata characteristic of such events.

The game company we work for has two events that we want to track: buy an item and join a guild. Each of them has metadata characteristic of such events.

Caro Arriaga 1 Feb 04, 2022
Running Chess Night results tabulation

Running Chess Night results tabulation

Mitch LeBlanc 2 Nov 20, 2021
A networking library for multiplayer games.

Aerics A networking library for multiplayer games. Getting Started Install Python Open cmd/terminal and type: pip install Aerics Examples Creating a

Yusuf Rençber 3 Jan 04, 2023
This repository contains algorithm and solver for the game WORDLE

Wordle-Cracker This repository contains algorithm and solver for the game WORDLE How to use Run the program: python main.py Type in the guess word in

YiHsin Chen 3 May 14, 2022
🍦 Cheat for cs:go written in Python.

Cs::Fuck 🍦 Cheat for cs:go written in Python. You can show a video here: https://vimeo.com/642730650 Feature. TriggerBot Glow Esp NoFlash Setup. 0. p

Ѵιcнч 10 Sep 23, 2022
Allows you to email people wordle spoilers. Very beta, not as many features

wordlespoiler Allows you to email people wordle spoilers. Very beta, not as many features How to Use 1.) Make a new gmail account. Go to settings (Man

0 Jan 04, 2023
Frets on Fire X: a fork of Frets on Fire with many added features and capabilities

Frets on Fire X - FoFiX This is Frets on Fire X, a highly customizable rhythm game supporting many modes of guitar, bass, drum, and vocal gameplay for

FoFiX 377 Jan 02, 2023
Flappy Bird Game using Pygame in Python

Flappy Bird Game using Pygame in Python Demo Pages Hello dear, hope you are very well! I created Flappy Bird Game using Pygame ( Pygame is a cross-pla

Datt Panchal 3 Feb 05, 2022
DOTD - A murder mystery game made in Python

DOTD This repo holds the files for my video game project from ENG101, Disaster o

Ben Bruzewski 1 Jan 13, 2022
Just a copied of flappy bird game made by Thuongton999

flappy-bird Just a copied of flappy bird game made by Thuongton999 Installation and Usage Using terminal (on Window) Make sure you installed Python an

ThuongTon 9 Aug 08, 2021
Pyout - A little Krakout clone called Pyout written in Python 3

Pyout My little Krakout clone called Pyout written in Python 3

Jan Karger ツ ☀ 4 Feb 20, 2022
General Crossy Road Game using Python code

Python-Game General Crossy Road Game using Python code Using code such as function and while using turtle, I was able to recreate a beginner version o

Jacob Paquette 1 Dec 19, 2021
A minimal open source mtg-like tcg game made in python that can be played on a terminal emulator using a keyboard.

A minimal open source mtg-like tcg game made in python that can be played on a terminal emulator using a keyboard.

Amos 3 Aug 29, 2021