From 8f64a538ae8641ce7310c7054f3408eedc64f133 Mon Sep 17 00:00:00 2001 From: Maximilian Wagner Date: Mon, 5 Jun 2023 10:36:36 +0200 Subject: [PATCH] =?UTF-8?q?Simulation=20von=20Kampfausg=C3=A4ngen=20in=20P?= =?UTF-8?q?ython=20mit=20Prolog=20Bridge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hpCalcSim.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 hpCalcSim.py diff --git a/hpCalcSim.py b/hpCalcSim.py new file mode 100644 index 0000000..ee9e9be --- /dev/null +++ b/hpCalcSim.py @@ -0,0 +1,43 @@ +import random +from pyswip import Prolog as pl +import itertools as it + +print("Consulting") +pl.consult("main.pl") + +HP = [1,2,3,5] +AP = [2,3,4,5] + +HPmult = 2 +APmult = 2 + +print("AP:HP:HPnew\n") + +for i in range(0,4): + match i: + case 0: + print("Calculating without Multipliers") + + case 1: + print("\nCalculating with Attack Multipliers") + AP = [point * 2 for point in AP] + + case 2: + print("\nCalculating with Defense Multipliers") + HP = [point * 2 for point in HP] + + + case 3: + print("\nCalculating with Attack and Defense Multipliers") + AP = [point * 2 for point in AP] + HP = [point * 2 for point in HP] + + + + liste = [AP, HP] + combinations = [p for p in it.product(*liste)] + + for comb in combinations : + for soln in pl.query("einheit_alive("+str(comb[0])+","+str(comb[1])+", HPnew)"): + print(str(comb[0]) + ":" + str(comb[1]) + ":" + str(soln["HPnew"])) +