Exemple #1
0
	def solvefor(self,given,desired):
		if given in reactants or given in products and desired in reactants or desired in products:

			reactant=unit(given) #initialize object
			product=unit(desired)
			if reactant.isgram():
				molreactant=float(reactant.prefix)/Total.returntotal(reactant.element)
				if product.isgram
					gramproduct=molreactant*Total.returntotal(desired)
				return gramproduct
			if reactant.ismole():
				molreactant=	
Exemple #2
0
def shift_right(cell_coords,N,O):
	cell_coords = unit(N,O) # return array of coordinates
	shift = np.array([[N,0]]*lC)
	total = cell_coords+shift
	new_tup = tuple(map(tuple,total))
	return new_tup
Exemple #3
0
#Initialize map and GUI
level = fe_map(20,20)
root=tk.Tk()

#Set the bottom right corner of the map to be filled with forest
for j in range(1,12):
    for i in range(j):
        level.grid[(20-j)+i][19-i].terrain = terrain('forest')

#Randomly place forest in the rest of the map
for i in range(50):
    level.grid[int(random.randint(0,19))][int(random.randint(0,19))].terrain = terrain('forest')

#Create player units
#Number is based on the number of units given to the player in Fire Emblem 7
eliwood = unit(world = level, space = level.get_space(0,0), name = "eliwood")
hector = unit(world = level, space = level.get_space(0,1), name="hector",hp=30)
lyn = unit(world = level, space = level.get_space(2,0), name = "lyn", hp = 15)
roy = unit(world = level, space = level.get_space(2,2), name = "roy", hp = 15)
erika = unit(world = level, space = level.get_space(1,1), name="erika",hp =18)
ephraim = unit(world = level, space=level.get_space(2,3),name="ephraim",hp=25)
player_units = [eliwood, hector, lyn, roy, erika, ephraim]

#Create enemy units
enemy_units = []
for i in range(8):
    grunt=unit(world=level,space=level.get_space(12+i,19-i),name="grunt"+str(i))
    enemy_units.append(grunt)

#make players
com = player()
Exemple #4
0
from Player import *
from unit import *
from feworld import *
import Tkinter as tk
from framework import *

# Initialize map and GUI
level = fe_map()
root = tk.Tk()

# Test terrain; make (1,1) a forest
level.grid[1][1].terrain = terrain("forest")

# Create player units
# Number is based on the number of units given to the player in Fire Emblem 7
eliwood = unit(world=level, space=level.get_space(0, 0), name="eliwood")
hector = unit(world=level, space=level.get_space(1, 0), name="hector", move=3)
lyn = unit(world=level, space=level.get_space(2, 0), name="lyn", hp=15, move=6)
player_units = [eliwood, hector, lyn]

# Create enemy units
sonia = unit(world=level, space=level.get_space(0, 8), name="sonia")
erik = unit(world=level, space=level.get_space(1, 8), attack=7, name="erik")
enemy_units = [sonia, erik]
for i in range(1):
    grunt = unit(world=level, space=level.get_space(2 + i, 8), name="grunt" + str(i))
    enemy_units.append(grunt)

# Create players
com = player()
# note: python lists are passed by reference, so the copy is necessary
Exemple #5
0
import math
import BattleField as BF
from Hero import*
from unit import*

root = tk.Tk()
fr = tk.Frame(root)
root.geometry('1200x700')
root.title("Final fantasy XVI")
canv = tk.Canvas(root, bg='white')
canv.pack(fill=tk.BOTH, expand=1)
all_units = []

turni = 0
fght = 0
unita = unit()

class Interface:
    def __init__(self, command1, command2, command3, command4):

        self.restart = tk.Button(text="reset battlefield", background="#555", foreground="#ccc", width="20", height="3",
                                 command=command1)
        self.restart.place(x=0, y=100)
        self.start = tk.Button(text="start battle", background="#555", foreground="#ccc", width="20", height="3",
                               command=command2)
        self.start.place(x=0, y=160)
        self.spell_book = tk.Button(text="spell book", background="#555", foreground="#ccc", width="20", height="3",
                                    command=command3)
        self.spell_book.place(x=0, y=220)

        self.create_hero = tk.Button(text="Create Hero", background="#555", foreground="#ccc", width="20", height="3",
Exemple #6
0
level = fe_map(20,20)
root=tk.Tk()

#Set the bottom right corner of the map to be filled with forest
for j in range(1,12):
    for i in range(j):
        level.grid[(20-j)+i][19-i].terrain = terrain('forest')

#Randomly place forest in the rest of the map
for i in range(50):
    level.grid[int(random.randint(0,19))][int(random.randint(0,19))].terrain = terrain('forest')

#Create units
enemy2_units = []
for i in range (8):
    hero = unit(world=level,space=level.get_space(i, 19-i),name="hero"+str(i))
    enemy2_units.append(hero)

enemy_units = []
for i in range(8):
    grunt = unit(world=level,space=level.get_space(12+i, 19-i),name="grunt"+str(i))
    enemy_units.append(grunt)

#create players
com = player()
com2 = player()
com.initialize(com2,list(enemy_units),"com", "com")
com2.initialize(com, list(enemy2_units), "com2", "com")

#start the game
play_game(root, level, com2, com, "t", "a")
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""Invoke the MyClass Class"""

from unit import *

# x=Complex(1.0, -4.5)

# print('x .r ',x.r,' x.i ',x.i)

# p1 = People('Brisk Zhang','23','man')

# print("I create an people instance,their attribute :")
# print("Name: ",p1.name)
# print("Age: ",p1.age)
# print("Sex: ",p1.sex)

# p2 = People('Artisan Zhang','23','man')

# print("I create another people instance,their attribute :")
# print("Name: ",p2.name)
# print("Age: ",p2.age)
# print("Sex: ",p2.sex)

u1 = unit()
print("I just create an object :", u1)
import numpy as np
import operator
import unit
import shift
import cell_plot

unit = unit.unit
shift = shift.shift
plot_cells = cell_plot.plot_cells

N = 2
O = 0

cell = unit(N, 1)

xmax = 6
ymax = 7
xmin = 1
ymin = 1

for i in range(xmin, xmax):
    cell = shift(cell, 'r', N, 1)
for i in range(ymin, ymax):
    cell = shift(cell, 'd', N, 1)
for i in range(xmin, xmax):
    cell = shift(cell, 'l', N, 1)
for i in range(xmin, xmax):
    cell = shift(cell, 'u', N, 1)

plot_cells(cell, N)