def test_itter(self):

        l1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        l2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

        m4 = Matrix("m0", 10, 10, 0.5, 0.01, [], l1, l2)
        m4.makeMatrix()

        updater3 = MatrixUpdater(10, [])

        updater3.itter(m4)
Пример #2
0
    def test_place_avatar(self):

        m1 = Matrix("m1", 2, 2, 0, 0)
        m3 = Matrix("m3", 2, 2, 0, 0)
        c1 = Cell(0, 0, 0, 0, 0, 0)
        print(m1)

        cellLis = [c1, c1]
        finalLis = [cellLis, cellLis]

        m1.makeMatrix()
        m3.makeMatrix()
Пример #3
0
    def test_probabilities(self):

        m2 = Matrix("m2", 2, 2, 1, 0.99, [], [5, 3], [5, 3])
        m2.makeMatrix()
        m2.initiateProbs()

        cell1 = m2.getL2()[0][0]

        self.assertEqual(cell1.getProb(), 0.25)
Пример #4
0
    def test_place_wrong_avatar_tile(self):
        m2 = Matrix("m2", 2, 2, 0, 0)
        print(m2)
        m2.makeMatrix()
        m2.initiateProbs()

        cell1 = m2.getL2()[0][0]

        self.assertEqual(cell1.getProb(), 0.25)
Пример #5
0
    def import_excel(self, import_path: str):

        df = pandas.read_excel(import_path)

        cols = df["columns"].tolist()
        col = int(cols[0])
        rows = df["rows"].tolist()
        row = int(rows[0])
        epsilon = df["epsilon"].tolist()
        eps = float(epsilon[0])
        delts = df["delta"].tolist()
        delt = float(delts[0])
        its = df["iterations"].tolist()
        iters = int(its[0])

        p1 = df["p1weights"].tolist()
        p2 = df["p2weights"].tolist()

        pays = df["payoffs"].tolist()
        #print(pays)

        x = 0
        y = 0

        l2 = []
        while x < row:
            z = 0
            rs = []
            while z < col:
                strs = str(pays[y]).split(",")
                p1s = float(strs[0])
                p2s = float(strs[1])
                print(strs)
                print(p1s)
                print(p2s)

                rs.append(Cell(p1s, p2s, 0, 0, 0))
                y += 1
                z += 1
            l2.append(rs)

            x += 1

        m1 = Matrix("M1", col, row, eps, delt, l2, p1, p2)

        updater = MatrixUpdater(iters, [])
        updater.itter(m1)

        return updater
Пример #6
0
    def test_initialize(self):

        m1 = Matrix("m1", 2, 2, 0, 0, [], [5, 3], [5, 3])
        print(m1)

        m1.makeMatrix()
Пример #7
0
from tkinter import filedialog, CENTER, NW, HORIZONTAL
from tkinter.ttk import Progressbar

from PIL import ImageTk, Image

from colour import Color
from Controler.ExcelController import ExcelController
from model.MatrixUpdater import MatrixUpdater
from model.Matrix import Matrix
from model.Cell import Cell

# Some important variables
l1 = []
l2 = []
updaterList = []
m4 = Matrix("m0", 0, 0, 0, 0, [], l1, l2)
mUpdater = MatrixUpdater(10, updaterList)

root = tk.Tk()
height = 1500
width = 1500
heightMap = 500
widthMap = 500

canvas = tk.Canvas(root, height=height, width=width)

# legend for heat map
global img
scalePath = "/Users/shefalisingh/Desktop/phil_2001_python/Roth-Reinfocement-Project-Alex-and" \
            "-Shefali/view/scalelegend.jpeg"
img = Image.open(scalePath)