diff --git a/.travis.yml b/.travis.yml index 7642315..70c1ae5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ python: matrix: include: - name: "Python 3.7.1 on Xenial Linux" - python: 3.7 + python: 3.7 dist: xenial script: py.test --cov-report=xml --cov=./ after_success: diff --git a/README.md b/README.md index c4c1abc..46bdfcf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![Build Status](https://travis-ci.com/Anthex/LO53FP.svg?branch=master)](https://travis-ci.com/Anthex/LO53FP) [![codecov](https://codecov.io/gh/Anthex/LO53FP/branch/master/graph/badge.svg)](https://codecov.io/gh/Anthex/LO53FP) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Build Status](https://travis-ci.com/Anthex/LO53FP.svg?branch=master)](https://travis-ci.com/Anthex/LO53FP) [![codecov](https://codecov.io/gh/Anthex/LO53FP/branch/master/graph/badge.svg)](https://codecov.io/gh/Anthex/LO53FP) [![CodeFactor](https://www.codefactor.io/repository/github/anthex/lo53fp/badge)](https://www.codefactor.io/repository/github/anthex/lo53fp) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) diff --git a/main.py b/main.py index 07ea006..3a32c7a 100644 --- a/main.py +++ b/main.py @@ -54,8 +54,9 @@ def main(): print("\r\nPERCENTAGES : \r\n") MM.printPercentages() print("\r\ncurrent cell is \033[0;32;40m#" + str(MM.previousCell) + "\033[1;37;40m , most likely next cell is \033[1;32;40m#" + str(MM.getMostLikely()) + "\033[1;37;40m which is located at \033[1;32;40m" + str(Location.fromID(MM.getMostLikely()).toString()) + "\033[1;37;40m") - else: + else: print("invalid ID") + break if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/structure.py b/structure.py index 3f0d819..2a08e7d 100644 --- a/structure.py +++ b/structure.py @@ -26,10 +26,8 @@ class Location(): self.z = z def __eq__(self, loc2): - if self.x == loc2.x and self.y == loc2.y and self.z == loc2.z: - return True - else: - return False + return bool(self.x == loc2.x and self.y == loc2.y and self.z == loc2.z) + def __mul__(self, multiplier): returnValue = Location(self.x, self.y, self.z) @@ -72,15 +70,15 @@ class Location(): return floor((temp.x * arraySize + temp.y)/2) @staticmethod - def fromID(id, arraySize=3): + def fromID(origin_id, arraySize=3): ''' Returns the Location of a fingerprint of known ID :param: ID to resolve :param arraySize: (Optional) dimension of the array ''' - id -= 1 - y=id % 3 - x=floor((id - y) / 3) + origin_id -= 1 + y=origin_id % 3 + x=floor((origin_id - y) / 3) returnValue = Location(x, y) returnValue *= 2 returnValue += Location(1,1) @@ -204,11 +202,11 @@ class MarkovModel(): :param currentCell: ID of the last cell :return: ID of the most likely next location ''' - max=0 + max_value=0 max_id=0 for k in range(1,10): - if self.MarkovValues[k][currentCell].nb > max: - max = self.MarkovValues[k][currentCell].nb + if self.MarkovValues[k][currentCell].nb > max_value: + max_value = self.MarkovValues[k][currentCell].nb max_id = k return max_id diff --git a/test_structure.py b/test_structure.py index fdf4ce4..36c2596 100644 --- a/test_structure.py +++ b/test_structure.py @@ -118,4 +118,4 @@ class OutputBuffer(object): @property def err(self): - return self.stderr.getvalue() \ No newline at end of file + return self.stderr.getvalue() -- libgit2 0.21.4