diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..26d33521af10bcc7fd8cea344038eaaeb78d0ef5 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000000000000000000000000000000000000..03438df37e901f3dd8601cfa158a79665f971263 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +util.py \ No newline at end of file diff --git a/.idea/Project1.iml b/.idea/Project1.iml new file mode 100644 index 0000000000000000000000000000000000000000..2968bc278e82bfb9686fa3b9b42bcb3d2880ef37 --- /dev/null +++ b/.idea/Project1.iml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="FacetManager"> + <facet type="Python" name="Python"> + <configuration sdkName="Python 3.6" /> + </facet> + </component> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$" /> + <orderEntry type="jdk" jdkName="Python 3.6" jdkType="Python SDK" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="library" name="Python 3.6 interpreter library" level="application" /> + </component> +</module> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..1763e153b6f24f136d4d5567320e74f68b248b87 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK"> + <output url="file://$PROJECT_DIR$/out" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..3db647aa02b73db81b98a595bedaeafad2e9731f --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/Project1.iml" filepath="$PROJECT_DIR$/.idea/Project1.iml" /> + </modules> + </component> +</project> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..35eb1ddfbbc029bcab630581847471d7f238ec53 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/search/main.py b/search/main.py index 8da7a40cbb6de32eaf8dce13c3d647f4d2708f4f..f2c7e88873d1829140448723b50b7275a6925eba 100644 --- a/search/main.py +++ b/search/main.py @@ -14,6 +14,7 @@ import json # then import from them like this: from search.util import print_board, print_slide, print_swing + def main(): try: with open(sys.argv[1]) as file: @@ -28,3 +29,43 @@ def main(): # Why not start by trying to print this configuration out using the # `print_board` helper function? (See the `util.py` source code for # usage information). + + +# Our upper pieces are R, P and S, lower pieces are r, p and s +# We will convert both to lower case letters and check each case +# Would be nice to use comparator but can't have r>s>p>r using it +# Return 1 if piecea wins, 2 if pieceb wins and 0 if neither win +def piece_collision(piecea, pieceb) -> int: + piecea = piecea.lower() + pieceb = pieceb.lower() + if (piecea == "r"): + if (pieceb == "s"): + return 1 + elif (pieceb == "p"): + return 2 + elif (piecea == "s"): + if (pieceb == "p"): + return 1 + elif (pieceb == "r"): + return 2 + elif (piecea == "p"): + if (pieceb == "r"): + return 1 + elif (pieceb == "s"): + return 2 + return 0 +# We may have to edit this to strip numbers later + + +# We will have dictionary containing pieces +# This is so we don't have to search the entire board every time +# we need to find pieces +# Blocks can be stored in a separate list +# Other option is to have dictionary of entire board + +#Sample dictionary +sample_dict = { + "R": (0, -2), + "s": (-1, 1) +} + diff --git a/search/method.py b/search/method.py index f17fa2eab4b4efcda915e63d9a303f23ef0add59..fdf65b3303c3bb71c97144fd9e1f69f3fc249be2 100644 --- a/search/method.py +++ b/search/method.py @@ -57,19 +57,19 @@ def distance_between(Upper_token, Lower_token): movement logic """ row = 1 -collumn = 2 +column = 2 def move_left(coordinate): if coordinate: - coordinate[collumn] -= 1 + coordinate[column] -= 1 def move_right(coordinate): if coordinate: - coordinate[collumn] += 1 + coordinate[column] += 1 def move_up_left(coordinate): if coordinate: - coordinate[collumn] -= 1 + coordinate[column] -= 1 coordinate[row] += 1 def move_up_right(coordinate): @@ -84,9 +84,10 @@ def move_down_left(coordinate): def move_down_right(coordinate): if coordinate: coordinate[row] -= 1 - coordinate[collumn] += 1 + coordinate[column] += 1 def transfer_move_to_board(, coordinate, new_coordinate): if not board[new_coordinate] print(distance_between([-3, 0], [1, 0])) +