Skip to content

Instantly share code, notes, and snippets.

@xcombelle
Created May 24, 2015 15:31
Show Gist options
  • Save xcombelle/c79378690a44c856efc4 to your computer and use it in GitHub Desktop.
Save xcombelle/c79378690a44c856efc4 to your computer and use it in GitHub Desktop.
import random
def f():
total_damage = 0
attack_score = 0
defence_score = 0
enemy_list = list(range(10))
power = 5
unit_size = 2000
enemy_defence = 5
enemy_unit_size = 2000
"""
for team in teams:
for unit in team:
if unit.team != self.team:
enemy_list.append(unit)
"""
for enemy in enemy_list:
if True:
for i in range(int(power*unit_size)):
attack_score += random.randint(0, power)
for i in range(int(enemy_defence*enemy_unit_size)):
defence_score += random.randint(0, enemy_defence)
if attack_score > defence_score:
total_damage = attack_score - defence_score
else:
total_damage = 0
import time
before = time.time()
f()
after = time.time()
print(after-before)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment