FINALLY!

This commit is contained in:
沈瑗杰 2020-12-21 22:48:43 +08:00
parent 96cf2ba3f1
commit 61a80c5e24
4 changed files with 47 additions and 4 deletions

View File

@ -5,4 +5,3 @@ mail: 3695888@qq.com
# import folders # import folders
# import in this forder # import in this forder
from libs.Game_threads import calculations

View File

@ -24,14 +24,16 @@ def P_C_M(A, B): # stand for Physics Calculation multiple
else: else:
Float = float(Float) Float = float(Float)
Int = int(Int) Int = int(Int)
Unit1 = A[2].extend(B[2]) Unit1 = [].append(A[2].extend(B[2]))
Unit2 = [] Unit2 = []
for unit in B[3]: for unit in B[3]:
if unit in Unit1: if unit in [Unit1]:
n = Unit1.index(unit) n = Unit1.index(unit)
Unit1.pop(n) Unit1.pop(n)
else: else:
Unit2.append(unit) Unit2.append(unit)
if Unit1 == None:
Unit1 = []
C = [Float, Int, Unit1, Unit2] C = [Float, Int, Unit1, Unit2]
return C return C
@ -42,4 +44,26 @@ def P_C_D(A, B): # stand for Physics Calculation divide
A & B list format:docs.basic_config.json:basic_number A & B list format:docs.basic_config.json:basic_number
""" """
C = [0.0, 1, [], []] C = [0.0, 1, [], []]
Float = A[0] / B[0]
Int = A[1] - B[1]
if Float >= 10:
Float /= 10
Int += 1
elif Float <= 0.01:
Float *= 10
Int -= 1
else:
Float = float(Float)
Int = int(Int)
Unit1 = A[2].extend(B[3])
Unit2 = []
for unit in B[2]:
if unit in [Unit1]:
n = Unit1.index(unit)
Unit1.pop(n)
else:
Unit2.append(unit)
if Unit1 == None:
Unit1 = []
C = [Float, Int, Unit1, Unit2]
return C return C

View File

@ -6,8 +6,9 @@ mail: 3695888@qq.com
import libs.Game_threads import libs.Game_threads
# import in this forder # import in this forder
import libs.P_C
import libs.main import libs.main
import libs.loads import libs.loads
import libs.setup import libs.setup
import libs.render_thread
import libs.delivery import libs.delivery
import libs.render_thread

19
test.py Normal file
View File

@ -0,0 +1,19 @@
"""
writen by shenjackyuanjie
mail: 3695888@qq.com
"""
import libs
A = [2.573, 3, ["m", "kg"], ["N", "s"]]
B = [0.245, -7, ["N", "kg"], ["m", "s"]]
print("A = " , A)
print("B = " , B)
C = libs.P_C.P_C_M(A, B)
D = libs.P_C.P_C_D(A, B)
print("A × B = " , C)
print("A ÷ B = " , D)