hexsha
stringlengths 40
40
| size
int64 24
287k
| ext
stringclasses 2
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 7
126
| max_stars_repo_name
stringlengths 8
97
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
sequence | max_stars_count
float64 1
15.9k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 7
126
| max_issues_repo_name
stringlengths 8
97
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
sequence | max_issues_count
float64 1
14.6k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 7
126
| max_forks_repo_name
stringlengths 8
97
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
sequence | max_forks_count
float64 1
8.43k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 24
287k
| avg_line_length
float64 12.3
530
| max_line_length
int64 24
10.2k
| alphanum_fraction
float64 0.41
0.88
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4f49aa977ab9bbd0f8065ca2b090584768f9022c | 1,736 | py | Python | color/color2.py | nebiutadele/2022-02-28-Alta3-Python | 9c065540bfdf432103bfffac6eae4972c9f9061a | [
"MIT"
] | null | null | null | color/color2.py | nebiutadele/2022-02-28-Alta3-Python | 9c065540bfdf432103bfffac6eae4972c9f9061a | [
"MIT"
] | null | null | null | color/color2.py | nebiutadele/2022-02-28-Alta3-Python | 9c065540bfdf432103bfffac6eae4972c9f9061a | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""Alta3 Research || Author RZFeeser@alta3.com
Learning how to use functions"""
## Installs the crayons package.
## python3 -m pip install crayons
## import statements ALWAYS go up top
import crayons
def main():
"""run time code. Always indent under function"""
# print 'red string' in red
print(crayons.red('red string'))
# Red White and Blue text
#print('{} white {}'.format(crayons.red('red'), crayons.blue('blue'))) # format string (old ver of str templating)
print(f"{crayons.red('red')} white {crayons.blue('blue')}") # f-string (newest version of str templating)
crayons.disable() # disables the crayons package
# this line should NOT have color as crayons is disabled
print(f"{crayons.red('red')} white {crayons.blue('blue')}") # f-string (newest version of string templating)
crayons.DISABLE_COLOR = False # enable the crayons package
# This line will print in color because color is enabled
print(f"{crayons.red('red')} white {crayons.blue('blue')}") # f-string (newest version of string templating)
# print 'red string' in red
print(crayons.red('red string', bold=True))
# print 'yellow string' in yellow
print(crayons.yellow('yellow string', bold=True))
# print 'magenta string' in magenta
print(crayons.magenta('magenta string', bold=True))
# print 'white string' in white
print(crayons.white('white string', bold=True))
print(crayons.green('Nebiu Tadele in green'))
print(crayons.blue('Nebiu Tadele in blue and in bold', bold=True))
# this condition is only true if our script is run directly
# it is NOT true if our code is imported into another script
if __name__ == "__main__":
main()
| 34.039216 | 118 | 0.68894 |
4f4aa9f6cde34245c22f658c223f7f879a4f102e | 30,096 | py | Python | src/paql/package_query.py | mattfeel/Scalable-PaQL-Queries | 993733f6d8afb607e2789d7b5ffb6535e0b5c8ce | [
"MIT"
] | 6 | 2016-10-04T05:35:24.000Z | 2020-11-12T09:31:42.000Z | src/paql/package_query.py | matteo-brucato/Scalable-PaQL-Queries | 993733f6d8afb607e2789d7b5ffb6535e0b5c8ce | [
"MIT"
] | null | null | null | src/paql/package_query.py | matteo-brucato/Scalable-PaQL-Queries | 993733f6d8afb607e2789d7b5ffb6535e0b5c8ce | [
"MIT"
] | 3 | 2017-08-02T23:55:23.000Z | 2020-05-17T19:46:04.000Z | import gc
import hashlib
import itertools
import logging
import math
import sys
import traceback
from logging import warning, debug
import numpy as np
from pulp import LpProblem, LpMinimize, LpVariable, LpInteger, CPLEX, LpStatus
from src.dbms.utils import sql_get_all_attributes, sql_table_column_data_type
from src.paql.constraints import *
from src.paql.expression_trees.expression_trees import ArithmeticExpression
from src.paql.expression_trees.syntax_tree import Expression
from src.paql.objectives import *
from src.utils.utils import op_to_opstr
class NotPackageQueryException(Exception):
pass
class PaQLParserError(Exception):
pass
class PackageQuery(object):
allowed_dbms_data_types = {
"integer",
"bigint",
"double precision",
# "numeric",
# "numeric(15,2)"
}
@property
def table_name(self):
assert len(self.rel_namespace.values()) == 1
return self.rel_namespace.itervalues().next()
@table_name.setter
def table_name(self, table_name):
assert len(self.rel_namespace.values()) == 1
if self.table_name is not None and self.rel_namespace is not None:
for rel, relname in self.rel_namespace.iteritems():
if relname.lower() == self.table_name.lower():
self.rel_namespace[rel] = table_name
self._paql_query_str_stale = True
@property
def bc_query(self):
bc_query = "SELECT * FROM {}".format(
','.join([
rel_name + " " + rel_alias for rel_alias, rel_name in self.rel_namespace.iteritems()
]))
where_clause_str = self.where_expr.get_str()
if where_clause_str:
bc_query += " WHERE {}".format(where_clause_str)
if self.limit is not None and self.limit["TYPE"] =="INPUT":
bc_query += " LIMIT {}".format(self.limit["LIMIT"])
return bc_query
def __init__(self, d):
assert isinstance(d, dict)
self._paql_query_str = None
self._paql_query_str_stale = True
# self.package_rel_names = d["package rel names"]
self.rel_namespace = d["namespace"]
self.rel_repeats = d["repeats"]
self.where_expr = d["where expr"]
self.such_that_expr = d["such that expr"]
if d["objective expr"] is not None:
self.objective = PackageQueryObjective(
sqlquery_expr=d["objective expr"].get_sql_arithmetic_expression(),
sense=d["objective sense"])
else:
self.objective = None
self.limit = d["limit"]
# NOTE: For now, assuming that the query is single-table.
# TODO: We need to take into account REPEAT! It's not implemented yet!
# rel_names = self.rel_namespace.values()
assert len(self.rel_namespace.values()) == 1, "Not a single-table package query!"
# self.table_name = self.bc_query.lower().split("from")[1].split("where")[0].split()[0].strip()
# self.table_name = rel_names[0]
def __str__(self):
raise NotImplementedError
def md5(self):
return hashlib.md5(str(self)).hexdigest()
@classmethod
def get_json_from_paql(cls, paql_str):
from subprocess import Popen, PIPE
p = Popen(["PaQL_Parser"], stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
json_str, err = p.communicate(input=paql_str)
p.wait()
if err != "":
raise PaQLParserError(err)
return json_str
@classmethod
def from_paql(cls, paql_str):
"""
Returns a new PackageQuery object from a PaQL query string. This is the method that you would call more often.
:param paql_str: A string containing a PaQL query
:rtype : PackageQuery
"""
json_str = PackageQuery.get_json_from_paql(paql_str)
try:
package_query = cls.from_json(json_str)
except ValueError as e:
traceback.print_exc(file=sys.stdout)
raise PaQLParserError(e)
else:
package_query._paql_query_str = paql_str
package_query._paql_query_str_stale = False
return package_query
finally:
gc.collect()
@classmethod
def from_json(cls, json_str):
"""
Returns a new PackageQuery object from a JSON string. This method is usually called by from_PaQL() to
transform the paql parser output (which is a JSON) into a PackageQuery object.
This is the main entry point from the direct output of the paql parser.
:param json_str: A string containing a JSON structure for a parsed PaQL query
"""
import json
q = json.loads(json_str)
# The namespace of relations defined by the query. A dictionary alias -> relation-name.
# This way, all references to relations can be just made based on the alias names, and we can avoid confusion
# when nested queries contain the same relation names, etc.
rel_namespace = { }
# The mapping from relation aliases into their corresponding REPEAT values.
rel_repeats = { }
# The list of relation aliases which form the PACKAGE.
package_rel_names = []
# TODO: Ideally, if the query is not a package query we may want to just execute it as it is...
# TODO: If it doesn't contain the PACKAGE clause, we should make sure it does not contain SUCH THAT either.
# Check if it's package query and store reference to relation names
for select_item in q["SELECT"]:
assert type(select_item) == dict
if select_item["NODE_TYPE"] == "*":
raise NotPackageQueryException()
elif select_item["NODE_TYPE"] == "COL_REF":
raise NotPackageQueryException()
elif select_item["NODE_TYPE"] == "PACKAGE":
package_rel_names.extend(r["REL_NAME"] for r in select_item["PACKAGE_RELS"])
else:
raise Exception("Problem in SELECT clause, NODE_TYPE non recognized: " + select_item["NODE_TYPE"])
# Store relation names and aliases, and repeat constraint for each of them
# These are stored in a dictionary rel_namespace(key=rel_alias, val=rel_names)
for from_ in q["FROM"]:
assert type(from_) == dict
rel_name = from_["REL_NAME"]
rel_alias = from_.get("REL_ALIAS", rel_name)
repeat = from_.get("REPEAT", -1)
rel_namespace[rel_alias] = rel_name
rel_repeats[rel_alias] = repeat
# Make sure that all relation aliases referred in PACKAGE(...) are in the FROM clause as well
assert all(p_rel_name in rel_namespace for p_rel_name in package_rel_names)
# Stricter (for now): Make sure that they are exactly the same relation references
assert set(package_rel_names) == set(rel_namespace.iterkeys())
# Create WHERE clause expression tree
where_clause = Expression(q["WHERE"])
# Create SUCH THAT clause expression tree
such_that_clause = Expression(q["SUCH-THAT"])
# Create objective clause expression tree
if q["OBJECTIVE"] is not None:
objective_expr = Expression(q["OBJECTIVE"]["EXPR"])
if q["OBJECTIVE"]["TYPE"] == "MAXIMIZE":
# objective = { "type": "maximize", "expr": objective_expr }
objective_sense = ObjectiveSenseMAX()
elif q["OBJECTIVE"]["TYPE"] == "MINIMIZE":
# objective = { "type": "minimize", "expr": objective_expr }
objective_sense = ObjectiveSenseMIN()
else:
raise Exception("Unsupported objective type: `{}'".format(q["OBJECTIVE"]["TYPE"]))
else:
objective_expr = objective_sense = None
query_dict = {
# "package rel names": package_rel_names,
"where expr": where_clause,
"such that expr": such_that_clause,
"objective expr": objective_expr,
"objective sense": objective_sense,
"namespace": rel_namespace,
"repeats": rel_repeats,
"limit": q["LIMIT"],
}
if such_that_clause.is_conjunctive() and where_clause.is_conjunctive():
return ConjunctivePackageQuery(query_dict)
else:
return cls(query_dict)
@staticmethod
def from_uncoalesced_constraints(table_name, unc_bcs, unc_gcs, objective):
"""
This method creates a new PackageQuery from sets of uncoalesced constraints and an objective.
"""
bc_query = "SELECT * FROM {} {}".format(table_name, "WHERE true" if len(unc_bcs) > 0 else "")
for attr, op, n in unc_bcs:
bc_query += " AND {a} {o} {b}".format(a=attr, o=op_to_opstr(op), b=n)
gc_queries = []
gc_ranges = []
for (aggr, attr), op, n in unc_gcs:
gc_query = "SELECT {aggr}({attr}) FROM memory_representations".format(aggr=aggr, attr=attr)
if op == operator.le:
# gc_range = (-sys.maxint, n)
gc_range = (-float("inf"), n)
elif op == operator.ge:
# gc_range = (n, sys.maxint)
gc_range = (n, float("inf"))
elif op == operator.eq:
gc_range = (n, n)
else:
raise Exception("Operator '{}' not supported yet.".format(op))
gc_queries.append(gc_query)
gc_ranges.append(gc_range)
return PackageQuery({
"bc": bc_query,
"gc": map(lambda x: (x[0], x[1][0], x[1][1]), zip(gc_queries, gc_ranges)),
"objective": objective,
})
def get_objective_attributes(self):
attrs = set()
if self.objective is not None:
for attr in self.objective.get_attributes():
if attr != "*":
attrs.add(attr)
return attrs
def get_bcs_attributes(self):
return set(attr for attr in self.coalesced_bcs) - {"*"}
def get_gcs_attributes(self):
gcs_attrs = set()
for gc in self.coalesced_gcs:
assert isinstance(gc, CGlobalConstraint)
gcs_attrs.update(gc.get_attributes())
return gcs_attrs
def get_attributes(self):
# FIXME: If this is a relaxed query, you should return all attributes including those of the original query.
return self.get_bcs_attributes() | self.get_gcs_attributes() | self.get_objective_attributes()
def get_data_attributes(self, db):
all_data_attributes = sql_get_all_attributes(db, self.table_name)
# Only pick the data attributes of the allowed data type
data_attributes = set()
for data_attr in all_data_attributes:
attribute_type = sql_table_column_data_type(db, self.table_name, data_attr)
if attribute_type in self.allowed_dbms_data_types:
data_attributes.add(data_attr)
return sorted(data_attributes)
def get_paql_str(self, redo=False, recompute_gcs=True, coalesced=False):
raise NotImplementedError
def abs_ugc_errors(self, gc_scores, attrs=None):
"""
Returns absolute errors for each (uncoalesced) global constraint.
"""
if attrs is None:
use_attrs = self.get_attributes()
else:
use_attrs = set(attrs)
return {
(aggr, attr): max(0, c - gc_scores[aggr, attr] if op == operator.ge else gc_scores[aggr, attr] - c)
for (aggr, attr), op, c in self.uncoalesced_gcs if attr == "*" or attr in use_attrs
}
def error_mape(self, u_gc_scores, u_bc_scores):
errorsum = .0
n_gcs = 0
n_bcs = 0
for i, ((aggr, attr), op, c) in enumerate(self.uncoalesced_gcs):
score = u_gc_scores[i]
if not op(score, c):
errorsum += abs((c - score) / c)
n_gcs += 1
for bscores in u_bc_scores:
for i, (attr, op, c) in enumerate(self.uncoalesced_bcs):
score = bscores[i]
if not op(score, c):
errorsum += abs((c - score) / c)
n_bcs += 1
if n_gcs + n_bcs > 0:
return errorsum / (n_gcs + n_bcs)
else:
assert errorsum == 0
return 0
def generate_data_for_selectivity(self, selectivity, n_tuples):
"""
NOTE: This is currently unused. Not even sure if I completed it. But give a look at it again because
there were some interesting ideas.
"""
def generate_valid_and_invalid_subsets(n_vars, n_subsets, n_valid):
# TODO: Read again this function. There's some interesting logic
n_subsets = int(math.ceil(n_subsets))
n_valid = int(math.ceil(n_valid))
assert n_valid <= n_subsets == 2**n_vars
valid = []
invalid = []
# This must be always valid (it is the sum of no tuples)
# valid.append( (0,)*n_vars )
valid.append(0)
# Generate half of vars valid and half invalid
for i in range(n_vars):
if len(valid) < n_valid/2.:
# valid.append(tuple( bit for bit in ('{:0%dbms}' % n_tuples).format(2**i) ))
valid.append(2**i)
elif len(invalid) < (n_subsets - n_valid)/2.:
# invalid.append(tuple( bit for bit in ('{:0%dbms}' % n_tuples).format(2**i) ))
invalid.append(2**i)
else:
valid.append(2**i)
# Generate more invalid (up to n_subsets-n_valid) by combining invalid + invalid
while len(invalid) < n_subsets-n_valid:
found = False
for i in range(len(invalid)):
for j in range(len(invalid)):
new_invalid = invalid[i] | invalid[j]
if new_invalid not in invalid:
invalid.append(new_invalid)
found = True
break
if found:
break
if not found:
break
# If more invalid are needed, generate them by combining invalid + valid
while len(invalid) < n_subsets-n_valid:
found = False
for i in range(len(invalid)):
for j in range(len(valid)):
new_invalid = invalid[i] | valid[j]
if new_invalid not in invalid:
invalid.append(new_invalid)
found = True
break
if found:
break
if not found:
raise Exception
# All the remaining ones are valid
valid = set(range(n_subsets)) - set(invalid)
assert len(valid) == n_valid
assert len(valid) + len(invalid) == n_subsets
if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
debug("n invalid = {}".format(n_subsets - n_valid))
debug("{}".format(valid))
debug("{}".format(invalid))
debug("{}".format([ tuple( bit for bit in ('{:0%dbms}' % n_tuples).format(i) ) for i in valid ]))
debug("{}".format([ tuple( bit for bit in ('{:0%dbms}' % n_tuples).format(i) ) for i in invalid ]))
return valid, invalid
def generate_set_of_problems(base_prob, vars, total_n_constraints, n_valid_constraints, a, b):
problems = []
for valid in itertools.combinations(range(total_n_constraints), int(math.ceil(n_valid_constraints))):
valid = set(valid)
invalid = set(range(total_n_constraints)) - valid
assert set(valid) | invalid == set(range(total_n_constraints))
# The empty package must always be valid. TODO: Really?
# valid = [0] + list(valid)
prob = base_prob.copy()
# valid = generate_valid_and_invalid_subsets(n_tuples, total_n_constraints, n_valid_constraints)[0]
# valid = np.random.choice(range(total_n_constraints), size=n_valid_constraints, replace=False)
if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
debug("VALID: {}".format(valid))
debug("INVALID: {}".format(sorted(set(range(total_n_constraints)) - set(valid))))
# Add valid constraints to the problem
n_valid_added = 0
for i in valid:
package_bitmap = [ int(bit) for bit in ('{:0%dbms}' % n_tuples).format(i) ]
assert len(package_bitmap) == len(vars)
# Add a VALID constraint for this combination of tuples
prob += np.dot(vars, package_bitmap) >= a
prob += np.dot(vars, package_bitmap) <= b
n_valid_added += 1
assert n_valid_added == len(valid)
# Add invalid constraints to the problem
n_invalid_added = 0
if float(a) > -float("inf") and float(b) < float("inf"):
# In this case, we produce 2**(len(invalid)) new sub-problems, each for a different set of ways
# to break the constraints a <= sum() <= b
pairs_of_invalid_constraints = []
for i in invalid:
package_bitmap = [ int(bit) for bit in ('{:0%dbms}' % n_tuples).format(i) ]
pairs_of_invalid_constraints.append((
(package_bitmap, operator.le, a-1),
(package_bitmap, operator.ge, b+1),
))
orig_prob = prob.copy()
for set_of_invalid in itertools.product(*pairs_of_invalid_constraints):
new_prob = orig_prob.copy()
for invalid_bitmap, op, c in set_of_invalid:
new_prob += op(np.dot(vars, invalid_bitmap), c)
problems.append(new_prob)
else:
# In this case, we only generate one sub-problem by adding all invalid constraints
for i in invalid:
package_bitmap = [ int(bit) for bit in ('{:0%dbms}' % n_tuples).format(i) ]
assert len(package_bitmap) == len(vars)
# Add an INVALID (out of range) constraint for this combination of tuples
if float(a) > -float("inf") and float(b) < float("inf"):
raise Exception("Should never happen!")
# prob += np.dot(vars, package_bitmap) <= a-1
elif float(a) > -float("inf"):
prob += np.dot(vars, package_bitmap) <= a-1
elif float(b) < float("inf"):
prob += np.dot(vars, package_bitmap) >= b+1
else:
raise Exception
assert n_invalid_added == len(invalid)
problems.append(prob)
return problems
assert 0 <= selectivity <= 1
assert n_tuples >= 0
table_name_start = self.bc_query.lower().find("from ")
table_name_end = self.bc_query[table_name_start+5:].lower().find(" ")
table_name = self.bc_query[table_name_start+5:table_name_start+5+table_name_end]
attribute_names = []
ranges = []
for j in range(len(self.gc_queries)):
if 'sum(' in self.gc_queries[j].lower():
attr_start = self.gc_queries[j].lower().find('sum(')
attr_end = self.gc_queries[j][attr_start+4:].lower().find(')')
attribute_names.append(self.gc_queries[j][attr_start+4:attr_start+4+attr_end])
ranges.append(self.gc_ranges[j])
debug("{} {}".format(attribute_names, ranges))
assert len(attribute_names) == len(ranges)
# Generate the data via CPLEX
data_columns = []
# Generate one column at a time. Each column is generated with a CPLEX problem
for j in range(len(attribute_names)):
a, b = ranges[j]
total_n_constraints = 2**n_tuples
n_valid_constraints = (1-selectivity) * total_n_constraints
# Check satisfiability of requirements
if n_valid_constraints == 0 and a <= 0 <= b:
warning("Since a<=0<=b there is always at least one valid package, i.e. the empty package, "
"therefore selectivity=1 (where no package is valid) is impossible.")
return None
if n_valid_constraints == total_n_constraints and not a <= 0 <= b:
warning("Since not a<=0<=b, the empty package may never be a valid package, "
"therefore selectivity=0 (where all packages are valid) is impossible.")
return None
# Create the base problem
base_prob = LpProblem("package-builder", LpMinimize)
base_prob += 0 # no objective
# Add constraints to the problem
vars = [
LpVariable("{}_{}".format(attribute_names[j], i), -float("inf"), float("inf"), LpInteger)
for i in range(n_tuples)
]
# Generate all possible combination of problem constraints
# One of them will be feasible and will give us the dataset
problems = generate_set_of_problems(base_prob, vars, total_n_constraints, n_valid_constraints, a, b)
# Now try to find one feasible problem
for prob in problems:
# Solve the problem
debug("{}".format(prob))
solver = CPLEX(msg=True, timeLimit=None)
solver.solve(prob)
# Check the problem status
if LpStatus[prob.status]=='Infeasible':
debug("@@@@@@@@@@@@@@@@@ INFEASIBLE: CONTINUE")
continue
elif LpStatus[prob.status]=='Undefined':
raise Exception("Problem is undefined.")
elif LpStatus[prob.status]=='Optimal':
debug("################## OPTIMAL")
prob.roundSolution()
sol = [ v.varValue for v in prob.tuple_variables() if type(v.varValue) is float ]
data_columns.append(sol)
break
else:
raise Exception("LP status: {}".format(LpStatus[prob.status]))
else:
raise Exception("Could not find feasible combination of constraints "
"for selectivity {} and {} tuples.".format(selectivity, n_tuples))
tuples = np.array(data_columns).transpose()
return table_name, attribute_names, tuples
class ConjunctivePackageQuery(PackageQuery):
# TODO: later on, move the two staticmethods from_... outside. Make them just functions.
# TODO: IMPORTANT! All base and gc queries MUST be instance of some class SQL_Query instead of just strings
def __init__(self, query_dict):
super(ConjunctivePackageQuery, self).__init__(query_dict)
# Store the base and global constraints as coalesced and un-coalesced constraints
gc_constraint_trees = []
gc_ranges = []
gcs = self.such_that_expr.get_ANDed_gc_list()
for sqlquery_expr, gc_range_a, gc_range_b in gcs:
if isinstance(sqlquery_expr, SQLQueryExpression):
# Note: Technically, you'll get an expression tree of "constraint trees" (query plans). So you
# should actually try to combine them into one single constraint tree. Right now I'm simplifying
# by assuming that the expression tree is always a simple leaf (so directly a constraint tree).
operator_tree_expr = sqlquery_expr.traverse_leaf_func(leaf_func="get_constraint_tree")
assert isinstance(operator_tree_expr, ArithmeticExpression)
else:
raise Exception
gc_constraint_trees.append(operator_tree_expr)
gc_ranges.append((np.float64(gc_range_a), np.float64(gc_range_b)))
self.coalesced_gcs = get_coalesced_global_constraints(gc_constraint_trees, gc_ranges)
self.uncoalesced_gcs = get_uncoalesced_global_constraints(self.coalesced_gcs)
self.coalesced_bcs = get_coalesced_base_constraints(self.bc_query)
self.uncoalesced_bcs = get_uncoalesced_base_constraints(self.coalesced_bcs)
def __str__(self):
return (
"/-------------------------------------------- PaQL Query ---------------------------------------------\\\n"
"| PaQL query:\n"
"| " + str(self._paql_query_str) + "\n"
"| Base SQL query:\n"
"| " + str(self.bc_query) + "\n"
"| Global SQL queries:\n"
"| " + ("| ".join([ str(q) + "\n" for q in self.gc_queries ]) if self.gc_queries else "None\n") + ""
"| Glogal constraint ranges:\n"
"| " + ("| ".join([ str(q) + "\n" for q in self.gc_ranges ]) if self.gc_ranges else "None\n") + ""
"| Optimization objective:\n"
"| " + (str(self.objective) if self.objective else "None") + "\n"
"\-----------------------------------------------------------------------------------------------------/"
)
def get_paql_str(self, redo=False, recompute_gcs=True, coalesced=False):
if redo or self._paql_query_str is None or self._paql_query_str_stale:
if recompute_gcs:
self.coalesced_gcs = get_coalesced_global_constraints(self.gc_queries, self.gc_ranges)
self.uncoalesced_gcs = get_uncoalesced_global_constraints(self.coalesced_gcs)
self.coalesced_bcs = get_coalesced_base_constraints(self.bc_query)
self.uncoalesced_bcs = get_uncoalesced_base_constraints(self.coalesced_bcs)
if self.rel_namespace is None:
# raise Exception("rel_namespace is None")
# return ""
self.rel_namespace = { "R": self.table_name }
bcs_str = []
gcs_str = []
obj_str = None
if not coalesced:
if len(self.uncoalesced_bcs) > 0:
for attr, op, n in self.uncoalesced_bcs:
bcs_str.append("{} {} {}".format(attr, op_to_opstr(op), n))
if len(self.uncoalesced_gcs) > 0:
for (aggr, attr), op, n in self.uncoalesced_gcs:
gcs_str.append("{}({}) {} {}".format(aggr, attr, op_to_opstr(op), n))
else:
if len(self.coalesced_bcs) > 0:
for attr, (lb, ub) in self.coalesced_bcs.iteritems():
if float(lb) == -float("inf") and float(ub) == float("inf"):
continue
elif float(ub) == float("inf"):
bcs_str.append("{} {} {}".format(attr, op_to_opstr(operator.ge), lb))
elif float(lb) == -float("inf"):
bcs_str.append("{} {} {}".format(attr, op_to_opstr(operator.le), ub))
elif lb == ub:
bcs_str.append("{} {} {}".format(attr, op_to_opstr(operator.eq), ub))
else:
bcs_str.append("{} BETWEEN {} AND {}".format(attr, lb, ub))
if len(self.coalesced_gcs) > 0:
for (aggr, attr), (lb, ub) in self.coalesced_gcs.iteritems():
if aggr.lower() == "count":
lb, ub = int(lb), int(ub)
uaggr = aggr.upper()
if float(lb) == -float("inf") and float(ub) == float("inf"):
continue
elif float(ub) == float("inf"):
gcs_str.append("{}({}) {} {}".format(uaggr, attr, op_to_opstr(operator.ge), lb))
elif float(lb) == -float("inf"):
gcs_str.append("{}({}) {} {}".format(uaggr, attr, op_to_opstr(operator.le), ub))
elif lb == ub:
gcs_str.append("{}({}) {} {}".format(uaggr, attr, op_to_opstr(operator.eq), ub))
else:
gcs_str.append("{}({}) BETWEEN {} AND {}".format(uaggr, attr, lb, ub))
if self.objective is not None:
if self.objective["type"] == "maximize":
obj_str = "MAXIMIZE "
elif self.objective["type"] == "minimize":
obj_str = "MINIMIZE "
else:
raise
obj_str += self.objective["func"].get_str()
self._paql_query_str = \
"SELECT \n\tPACKAGE({pack}) \n" \
"FROM \n\t{tables} {bcs}{gcs}{obj};".format(
pack=", ".join(self.rel_namespace.keys()),
tables=", ".join("{} {}".format(name, alias) for alias, name in self.rel_namespace.iteritems()),
bcs="\nWHERE \n\t{} ".format(" AND\n\t".join(bcs_str)) if bcs_str else "",
gcs="\nSUCH THAT \n\t{} ".format(" AND\n\t".join(gcs_str)) if gcs_str else "",
obj="\n{}".format(obj_str) if obj_str is not None else "")
self._paql_query_str_stale = False
return self._paql_query_str
| 41.283951 | 120 | 0.554326 |
4f4a97e35757ebe49c3484c56a9ee824088c0411 | 116,081 | py | Python | plotting.py | jfoley-yw/scrabble | 049a69572138b06341af163ec69e18a1eb20b737 | [
"MIT"
] | 1 | 2021-04-01T14:24:17.000Z | 2021-04-01T14:24:17.000Z | plotting.py | jfoley-yw/scrabble | 049a69572138b06341af163ec69e18a1eb20b737 | [
"MIT"
] | 3 | 2021-04-05T01:09:16.000Z | 2021-04-19T20:19:30.000Z | plotting.py | jfoley-yw/scrabble | 049a69572138b06341af163ec69e18a1eb20b737 | [
"MIT"
] | null | null | null | import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import statistics
# Scores for ABPruning Depth 2 on rack size 5
# nodes = [5, 101, 56, 64, 100, 71, 135, 55, 39, 14, 85, 12, 21, 48, 17, 21, 64, 214, 93, 9, 14, 6, 16, 12, 42, 17, 25, 117, 35, 37, 35, 89, 6, 70, 22, 80, 16, 64, 70, 51, 21, 39, 46, 31, 30, 82, 18, 32, 71, 9, 59, 4, 74, 49, 1, 55, 30, 2, 50, 61, 62, 86, 26, 116, 75, 21, 52, 19, 146, 83, 57, 65, 3, 74, 14, 59, 24, 3, 23, 62, 53, 57, 69, 90, 9, 26, 72, 59, 19, 35, 17, 31, 68, 16, 26, 13, 130, 78, 13, 29, 17, 44, 54, 14, 50, 43, 60, 1, 7, 5, 10, 9, 42, 22, 97, 11, 89, 40, 134, 7, 49, 140, 190, 42, 52, 12, 72, 27, 16, 48, 21, 30, 14, 31, 92, 42, 26, 59, 15, 87, 42, 101, 67, 49, 22, 15, 222, 66, 26, 72, 12, 14, 42, 15, 36, 10, 1, 43, 8, 64, 89, 74, 19, 21, 12, 10, 9, 39, 98, 14, 24, 45, 49, 3, 13, 55, 18, 103, 10, 7, 54]
# p1scores = [204, 167, 283, 162, 240, 250, 301, 167, 221, 193, 307, 199, 208, 187, 146, 219, 197, 149, 229, 187, 262, 15, 183, 294, 139, 249, 230, 178, 198, 237, 281, 198, 201, 307, 188, 253, 257, 239, 315, 249, 154, 231, 222, 226, 250, 248, 200, 175, 234, 261, 227, 154, 290, 250, 190, 270, 227, 208, 155, 232, 271, 285, 168, 242, 226, 181, 217, 248, 192, 179, 237, 238, 215, 191, 252, 293, 248, 232, 190, 193, 255, 164, 252, 221, 220, 153, 239, 0, 205, 0, 190, 149, 238, 284, 194, 52, 249, 227, 264, 195, 200, 246, 207, 0, 253, 271, 176, 246, 189, 216, 210, 169, 273, 190, 285, 281, 179, 207, 255, 248, 283, 173, 210, 261, 196, 241, 0, 217, 212, 205, 200, 208, 205, 267, 206, 230, 138, 231, 181, 109, 0, 255, 259, 229, 175, 234, 356, 275, 280, 273, 255, 27, 199, 220, 289, 188, 299, 291, 211, 246, 267, 192, 206, 278, 242, 253, 266, 182, 162, 230, 225, 250, 199, 0, 243, 337, 170, 175, 260, 145, 207, 231, 203, 235, 169, 232, 194, 177, 258, 194, 216, 267, 14, 186, 221, 199, 281, 293, 121, 0]
# p2scores =[219, 293, 237, 328, 267, 275, 235, 305, 265, 237, 276, 165, 247, 262, 154, 174, 163, 288, 199, 288, 206, 49, 362, 195, 262, 265, 265, 215, 206, 195, 262, 240, 310, 173, 194, 256, 251, 166, 226, 231, 295, 309, 226, 260, 201, 259, 266, 252, 305, 164, 293, 211, 269, 177, 274, 180, 161, 242, 264, 142, 229, 276, 226, 281, 196, 169, 185, 202, 249, 329, 208, 178, 225, 183, 265, 185, 292, 224, 284, 223, 201, 331, 158, 296, 118, 318, 239, 0, 208, 0, 197, 283, 237, 277, 229, 81, 271, 274, 206, 281, 138, 209, 290, 0, 255, 205, 180, 181, 271, 227, 201, 268, 151, 283, 232, 202, 165, 165, 213, 234, 227, 267, 181, 213, 226, 240, 0, 278, 214, 260, 185, 286, 235, 236, 223, 278, 235, 210, 156, 215, 0, 249, 309, 249, 155, 215, 197, 205, 211, 263, 240, 18, 303, 301, 247, 282, 206, 191, 246, 284, 195, 191, 246, 300, 216, 220, 201, 364, 183, 223, 273, 212, 183, 0, 275, 179, 294, 241, 138, 91, 202, 188, 273, 211, 299, 207, 282, 252, 238, 153, 221, 176, 21, 330, 221, 198, 233, 256, 67, 0]
# p1endgamescores = [204, 155, 268, 103, 193, 240, 232, 151, 162, 179, 281, 199, 190, 127, 136, 207, 175, 149, 206, 163, 258, None, 153, 251, 139, 204, 185, 168, 180, 237, 239, 184, 165, 293, 155, 193, 230, 199, 236, 196, 139, 204, 207, 215, 185, 186, 189, 163, 212, 220, 215, 136, 278, 234, 190, 254, 209, 208, 131, 232, 234, 271, 151, 174, 174, 161, 193, 177, 178, 129, 187, 196, 184, 179, 174, 248, 224, 222, 165, 171, 210, 153, 210, 188, None, 136, 158, None, 188, None, 190, 137, 193, 256, 182, None, 236, 212, 224, 174, 200, 233, 207, None, 207, 185, 176, 179, 181, 197, 186, 163, 209, 173, 251, 281, 179, 202, 209, 206, 233, 160, 171, 213, 166, 136, None, 160, 167, 185, 182, 164, 157, 198, 153, 170, 131, 231, None, 100, None, 231, 210, 185, None, 192, 284, 259, 223, 222, 203, None, 188, 200, 267, 165, 228, 219, 203, 206, 198, 164, 188, 264, 189, 253, 213, 175, 118, 230, 225, 212, 199, None, 223, 226, 143, 165, 248, None, 202, 190, 162, 224, 160, 191, 186, 166, 173, 192, 164, 203, None, 184, 204, 194, 226, 245, None, None]
# p2endgamescores = [197, 237, 197, 281, 254, 202, 223, 292, 252, 133, 223, 147, 188, 244, 141, 167, 156, 170, 143, 249, 184, None, 279, 177, 262, 235, 242, 156, 195, 195, 219, 164, 160, 168, 176, 204, 210, 148, 217, 201, 229, 258, 197, 216, 185, 234, 194, 205, 205, 149, 233, 166, 255, 171, 253, 170, 134, 203, 211, 142, 224, 185, 140, 247, 174, 152, 170, 197, 208, 304, 197, 156, 171, 123, 244, 172, 220, 171, 262, 216, 173, 283, 128, 219, None, 250, 201, None, 185, None, 180, 240, 188, 189, 157, None, 196, 211, 149, 198, 138, 145, 224, None, 224, 205, 180, 167, 185, 210, 194, 196, 103, 223, 170, 190, 165, 148, 188, 220, 202, 251, 165, 187, 167, 197, None, 235, 181, 190, 178, 232, 188, 222, 180, 242, 223, 147, None, 203, None, 174, 286, 230, None, 181, 158, 181, 161, 243, 180, None, 228, 253, 171, 205, 191, 179, 214, 258, 193, 173, 190, 237, 196, 204, 181, 336, 169, 193, 254, 156, 181, None, 204, 168, 285, 207, 106, None, 195, 180, 259, 168, 258, 186, 193, 200, 233, 146, 187, 148, None, 242, 221, 175, 206, 207, None, None]
# times =[0.392374, 1.087435, 0.7119709999999997, 0.810673, 1.126067, 0.7669739999999994, 1.994154, 0.6895319999999998, 0.6009550000000008, 0.3275289999999984, 0.9863210000000002, 0.2606470000000005, 0.34875400000000134, 0.7456220000000009, 0.32181700000000113, 0.4138010000000012, 0.8067349999999998, 0.15606599999999915, 2.6905530000000013, 0.9456589999999991, 0.31708599999999976, 0.02612799999999993, 0.3128700000000002, 0.18505099999999786, 0.30555900000000236, 0.2620560000000012, 0.6745239999999981, 0.3066670000000009, 0.47260400000000047, 0.17609900000000067, 1.093862999999999, 0.45542199999999866, 0.7054580000000001, 0.5520420000000001, 1.0170379999999994, 0.2309340000000013, 0.733039999999999, 0.3513699999999993, 1.010028000000002, 0.29272900000000135, 0.8606179999999988, 0.7247850000000007, 0.6421530000000004, 0.2927980000000012, 0.7698590000000003, 0.6178729999999995, 0.3698689999999978, 0.43626899999999935, 0.8837449999999976, 0.3141510000000025, 0.4212889999999945, 0.7093589999999992, 0.2769800000000018, 0.7990300000000019, 0.21445099999999684, 0.8646510000000021, 0.6168930000000046, 0.1808240000000012, 0.6278900000000007, 0.4272070000000028, 0.21817000000000064, 0.7489089999999976, 0.6385280000000009, 0.9075630000000032, 0.8847120000000004, 0.5543809999999993, 1.1678890000000024, 0.9268649999999994, 0.32570499999999925, 0.7548699999999968, 0.3216419999999971, 1.9017319999999955, 1.4462270000000004, 0.6572630000000004, 1.060724999999998, 0.20168500000000478, 0.8210849999999965, 0.44043299999999874, 0.7265659999999983, 0.46925099999999986, 0.19774300000000267, 0.4200649999999939, 0.7009690000000006, 0.6478700000000046, 0.11564000000000618, 0.8002919999999989, 0.8857590000000002, 0.00432199999999483, 1.0995959999999982, 0.002073000000002878, 0.251300999999998, 0.39348400000000083, 0.8867929999999973, 0.9020439999999965, 0.33812700000000007, 0.07212599999999725, 0.48321200000000175, 0.3076520000000045, 0.5212119999999985, 0.7779639999999972, 0.3196629999999985, 0.37090200000000095, 0.2648180000000053, 0.0021559999999993806, 1.3325860000000063, 0.9182589999999919, 0.26353699999999947, 0.6415129999999891, 0.30544600000000344, 0.4823680000000081, 0.7752869999999916, 0.28730600000000095, 0.5652749999999997, 0.7506249999999994, 0.8220110000000034, 0.2295310000000086, 0.20372600000000318, 0.1945779999999928, 0.32604299999999853, 0.24623400000000117, 0.5504200000000026, 0.39636099999999885, 1.0773339999999934, 0.30486299999999744, 0.9997989999999959, 0.6598670000000055, 0.00277499999999975, 1.401699999999991, 0.24062299999999937, 0.612363000000002, 1.5137590000000074, 2.308454999999995, 0.5395869999999974, 1.1261659999999978, 0.3013700000000057, 0.8219319999999897, 0.46814299999999776, 0.19157900000000438, 0.15418999999999983, 0.2853580000000022, 0.0024219999999957054, 0.5605540000000104, 0.43711700000000064, 0.47679000000000826, 0.13257300000000782, 0.3474680000000063, 0.45118300000000033, 0.9176939999999973, 0.6302490000000063, 0.44485699999999895, 0.6749839999999949, 0.02986500000000092, 0.3542879999999968, 1.1250870000000077, 0.48420600000000036, 1.1846189999999979, 0.9359439999999921, 0.9131380000000036, 0.35106799999999794, 0.36182700000000523, 2.052135000000007, 0.8193789999999979, 0.3867840000000058, 0.8020479999999992, 0.3208309999999983, 0.351657000000003, 0.6312570000000051, 0.36063900000000615, 0.5858340000000055, 0.3393300000000039, 0.23335600000000056, 0.545345999999995, 0.263898999999995, 0.002562999999994986, 0.7251380000000012, 1.133899999999997, 0.8232259999999911, 0.38127900000000636, 0.40733799999999576, 0.08812200000001269, 0.2706400000000002, 0.29463900000000365, 0.28798100000000204, 0.5042630000000088, 0.9467050000000086, 0.3245540000000062, 0.35645500000001107, 0.4888389999999987, 0.5706250000000068, 0.1804039999999958, 0.40680500000000563, 0.709456000000003, 0.015135000000000787, 0.2789380000000108, 1.0135240000000039, 0.2699709999999982, 0.32936300000000074, 0.7083930000000009, 0.059475999999989426, 0.00197799999999404]
# AB Pruning Depth 3
# nodes = [86, 5, 16, 5, 24, 1001, 55, 221, 4, 1027, 124, 77, 335, 137, 211, 403, 4, 11, 41, 27, 21, 1486, 654, 65, 49, 772, 22, 63, 216, 48, 364, 11605, 537, 23, 42, 14, 147, 146, 61, 95, 458, 1625, 55, 672, 271, 91, 49, 757, 4, 127, 29, 63, 1719, 71, 100, 127, 103, 76, 103, 12, 127, 64, 1, 160, 18, 97, 8, 143, 127, 292, 704, 367, 13, 52, 8, 63, 148, 8, 225, 107, 61, 18, 226, 4333, 48, 510, 28, 356, 646, 182, 44, 109, 245, 589, 33, 257, 7, 531, 1125, 35, 9, 441, 3, 54, 79, 87, 328, 31, 391, 413, 383, 11, 1058, 18, 183, 69, 56, 74, 74, 1, 22, 711, 8, 196, 374, 45, 106, 2, 480, 32, 821, 675, 55, 1881, 590, 203, 23, 243, 574, 155, 29, 69, 54, 900, 27, 340, 405, 24, 39, 307, 139, 4, 77, 789, 182, 90, 252, 426, 10, 219, 26, 73, 1, 183, 370, 26, 1, 2, 90, 2866, 6, 51, 4, 989, 436, 34, 534, 717, 4, 99] + [3, 30, 28, 62, 14, 32, 13, 577, 1, 396, 41, 59, 59, 447, 36, 117, 31, 219, 40, 11, 5, 21, 38, 2, 92, 477, 56, 177, 158, 1277, 9, 27, 429, 2447, 23, 403, 45, 14, 35, 799, 310, 77, 72, 25, 449, 61, 1, 7, 835, 5, 72, 1, 18, 85, 159, 95, 133, 84, 177, 79, 36, 118, 301, 23, 51, 1, 85, 11, 483, 68, 135, 26, 33, 97, 155, 33, 12, 329, 133, 1, 22, 212, 10, 501, 439, 186, 33, 740, 27, 107, 4, 1151, 333, 23, 14, 25, 109, 168, 209, 83, 41, 239, 301, 305, 65, 69, 183, 597, 717, 69, 291, 250, 48, 17, 176, 53, 65, 72, 1040, 64, 6, 71, 1033, 10, 6, 303, 117, 192, 103, 80, 159, 121, 105, 113, 184, 8, 27, 114, 439, 89, 21, 22, 759, 1073, 10, 41, 21, 301, 5, 653, 9, 2595, 165, 59, 190, 158, 70, 7, 35, 2, 7, 327, 126, 296, 42, 574, 241, 335, 893, 102, 24, 279, 229, 1172, 73, 1457, 116]
# p1scores =[228, 140, 230, 155, 308, 305, 273, 222, 364, 0, 183, 280, 228, 167, 278, 216, 316, 124, 228, 123, 305, 245, 200, 275, 175, 251, 320, 217, 281, 47, 276, 88, 240, 207, 194, 243, 234, 408, 275, 227, 197, 234, 247, 366, 245, 156, 198, 225, 234, 193, 281, 221, 191, 202, 222, 193, 374, 256, 153, 200, 331, 252, 270, 218, 228, 245, 224, 266, 165, 331, 208, 208, 0, 272, 209, 224, 223, 300, 0, 245, 216, 296, 274, 164, 253, 290, 228, 283, 257, 222, 163, 251, 220, 110, 225, 307, 187, 248, 214, 226, 232, 249, 170, 213, 165, 186, 208, 174, 223, 135, 237, 231, 238, 251, 174, 231, 198, 311, 249, 213, 218, 192, 179, 202, 174, 311, 273, 185, 263, 333, 321, 233, 141, 260, 180, 180, 263, 183, 187, 180, 230, 143, 229, 253, 93, 254, 184, 241, 190, 257, 66, 218, 153, 360, 280, 192, 181, 214, 214, 207, 213, 162, 257, 239, 262, 189, 185, 272, 300, 292, 180, 181, 228, 271, 278, 190, 151, 174, 257, 250, 163, 207, 212, 275, 173, 251, 328, 245, 282, 219, 265, 278, 157, 205, 177, 196, 0, 0, 260, 203] + [155, 231, 171, 247, 245, 0, 202, 235, 159, 283, 209, 265, 269, 243, 273, 163, 192, 176, 0, 164, 220, 195, 216, 211, 154, 275, 192, 244, 192, 191, 181, 231, 229, 253, 213, 316, 170, 162, 307, 231, 161, 163, 178, 193, 249, 317, 356, 203, 234, 244, 190, 177, 256, 0, 234, 230, 172, 182, 265, 152, 160, 0, 174, 170, 284, 222, 226, 258, 139, 190, 139, 212, 174, 226, 160, 54, 152, 315, 136, 158, 320, 196, 280, 168, 124, 81, 178, 167, 174, 171, 220, 253, 186, 154, 209, 272, 230, 255, 272, 309, 368, 260, 165, 169, 294, 234, 231, 328, 168, 151, 171, 221, 207, 252, 359, 48, 257, 269, 231, 221, 0, 290, 220, 66, 289, 194, 236, 115, 162, 156, 228, 207, 208, 318, 206, 230, 221, 230, 202, 207, 330, 252, 271, 218, 242, 302, 257, 221, 296, 241, 194, 174, 306, 145, 233, 252, 286, 297, 231, 169, 247, 0, 284, 272, 162, 300, 235, 268, 258, 0, 193, 257, 353, 176, 234, 172, 182, 256, 160, 258, 186, 178, 191, 58, 159, 306, 238, 308, 208, 210, 239, 252, 0, 212, 235, 114, 252, 176, 307, 222]
# p2scores = [234, 234, 251, 241, 175, 253, 229, 235, 204, 0, 268, 228, 319, 282, 181, 195, 207, 133, 238, 87, 156, 223, 217, 170, 276, 186, 191, 183, 209, 41, 150, 195, 267, 207, 228, 301, 275, 176, 273, 290, 255, 221, 233, 218, 208, 173, 274, 295, 219, 246, 197, 212, 202, 119, 243, 282, 114, 229, 221, 193, 235, 228, 193, 182, 319, 199, 221, 242, 197, 150, 211, 166, 0, 179, 225, 238, 193, 182, 0, 276, 270, 192, 202, 191, 241, 184, 217, 115, 167, 220, 230, 226, 180, 223, 252, 209, 345, 137, 230, 222, 280, 248, 327, 226, 309, 207, 192, 264, 247, 252, 246, 222, 244, 170, 283, 249, 233, 171, 241, 253, 245, 217, 243, 289, 202, 143, 173, 200, 239, 266, 245, 293, 239, 151, 236, 151, 185, 190, 227, 225, 223, 206, 171, 283, 67, 238, 219, 267, 265, 210, 99, 283, 214, 146, 256, 328, 268, 358, 218, 252, 179, 116, 301, 260, 239, 282, 314, 197, 234, 222, 209, 124, 223, 190, 211, 224, 224, 235, 197, 142, 206, 178, 262, 228, 183, 185, 212, 280, 155, 233, 249, 252, 348, 315, 217, 205, 0, 0, 307, 225] + [227, 197, 196, 129, 291, 0, 210, 247, 187, 245, 256, 190, 184, 214, 201, 144, 270, 224, 0, 186, 235, 204, 209, 202, 343, 124, 194, 229, 179, 184, 259, 265, 239, 166, 202, 274, 249, 265, 358, 252, 242, 250, 299, 367, 223, 196, 194, 320, 259, 247, 356, 203, 184, 0, 253, 272, 228, 262, 241, 230, 271, 0, 299, 184, 273, 156, 237, 147, 99, 183, 273, 242, 265, 240, 310, 35, 210, 250, 168, 230, 154, 210, 222, 167, 149, 55, 222, 263, 256, 214, 148, 251, 278, 221, 267, 184, 208, 176, 244, 253, 154, 291, 178, 314, 126, 281, 214, 243, 192, 199, 242, 193, 208, 238, 246, 62, 198, 279, 209, 296, 0, 210, 238, 138, 173, 207, 250, 113, 162, 319, 350, 221, 196, 170, 222, 194, 222, 279, 242, 224, 163, 183, 224, 275, 187, 191, 230, 312, 259, 230, 240, 327, 252, 205, 162, 110, 179, 176, 279, 285, 255, 0, 278, 298, 291, 269, 222, 237, 209, 0, 191, 181, 220, 211, 185, 335, 297, 258, 183, 174, 179, 238, 164, 86, 285, 197, 276, 189, 255, 337, 212, 190, 0, 269, 244, 143, 227, 205, 199, 237]
# p1endgamescores = [209, 140, 219, 155, 308, 264, 209, 210, 259, None, 183, 240, 158, 109, 254, 203, 270, None, 211, None, 241, 203, 200, 275, 167, 201, 243, 150, 263, None, 221, None, 177, 160, 181, 188, 188, 333, 259, 173, 173, 222, 186, 321, 239, 147, 174, 158, 162, 193, 254, 208, 182, None, 182, 174, 374, 249, 153, 192, 331, 188, 266, 159, 192, 186, 215, 203, 165, 271, 168, 208, None, 221, 209, 179, 185, 283, None, 192, 169, 224, 220, 164, 208, 238, 228, 217, 203, 177, 121, 236, 210, 110, 178, 244, 183, None, 168, 175, 224, 193, 159, 172, 158, 162, 190, 166, 192, 121, 226, 205, 194, 210, 146, 182, 194, 257, 227, 187, 205, 170, 157, 169, 174, 265, 271, 183, 251, 278, 271, 184, 141, 260, 110, 180, 211, 165, 160, 161, 192, 129, 184, 179, None, 233, 174, 241, 167, 200, None, 203, 147, 304, 203, 173, 137, 201, 156, 143, 207, None, 180, 169, 219, 180, 158, 220, 260, 210, 143, None, 213, 230, 260, 180, 151, 153, 208, 247, 163, 203, 174, 270, 173, 212, 274, 220, 282, 176, 222, 173, 145, 186, 162, 193, None, None, 216, 192] + [155, 196, 171, None, 234, None, 146, 187, 159, 283, 168, 265, 216, 228, 225, None, 156, 157, None, 159, 202, 189, 149, 209, 142, 275, 143, 199, 192, 182, 172, 222, 199, 211, 164, 273, 159, 144, 212, 222, 125, 154, 178, 188, 197, 250, 307, 158, 217, 182, 175, 177, 256, None, 163, 191, 160, 182, 259, None, 144, None, 144, 145, 226, 222, 164, 243, None, 171, 139, 188, 156, 216, 131, None, 152, 289, None, 149, 233, 189, 207, 162, None, None, 164, 137, 144, 148, 220, 199, 170, 154, 179, 228, 230, 196, 203, 281, 288, 248, 165, 156, 252, 225, 202, 300, 168, 141, 160, 212, 180, 193, 291, None, 183, 209, 214, 210, None, 229, 150, None, 232, 130, 214, None, 149, 135, 187, 185, 178, 304, 193, 216, 166, 214, 162, 166, 267, 208, 227, 162, 176, 246, 247, 156, 274, 214, 147, 159, 289, 145, 229, 252, 219, 268, 198, 156, 194, None, 233, 171, 162, 292, 235, 202, 220, None, 173, 257, 293, 164, 230, 158, 166, 214, 160, 246, 186, 178, 177, None, 139, 257, 204, 255, 178, 178, 179, 188, None, 206, 168, 102, 181, 160, 234, 208]
# p2endgamescores = [158, 189, 184, 176, 141, 214, 229, 158, 189, None, 209, 198, 277, 260, 121, 184, 204, None, 183, None, 145, 200, 197, 154, 197, 172, 171, 163, 190, None, 124, None, 230, 181, 159, 272, 233, 168, 175, 230, 180, 176, 187, 194, 202, 163, 227, 268, 210, 246, 187, 197, 187, None, 227, 214, 111, 174, 175, 185, 235, 214, 159, 164, 233, 194, 205, 192, 182, 142, 186, 152, None, 172, 225, 167, 167, 164, None, 266, 233, 157, 185, 191, 221, 149, 194, 86, 146, 191, 182, 159, 151, 223, 219, 190, 305, None, 215, 201, 229, 233, 278, 202, 282, 186, 189, 259, 193, 196, 199, 202, 202, 153, 243, 225, 189, 149, 191, 234, 201, 169, 228, 242, 202, 127, 145, 192, 215, 213, 209, 260, 221, 130, 213, 142, 143, 181, 148, 183, 196, 193, 149, 269, None, 168, 152, 180, 198, 189, None, 275, 212, 142, 226, 275, 232, 312, 182, 205, 157, None, 258, 250, 208, 224, 204, 175, 210, 183, 156, None, 132, 142, 195, 207, 217, 158, 155, 111, 189, 154, 210, 182, 153, 165, 176, 199, 123, 208, 222, 244, 288, 274, 156, 142, None, None, 271, 216] + [216, 159, 196, None, 238, None, 172, 230, 187, 229, 199, 163, 178, 144, 148, None, 187, 209, None, 168, 193, 173, 180, 184, 279, 124, 164, 176, 153, 171, 210, 208, 195, 157, 202, 250, 198, 213, 345, 193, 228, 193, 283, 291, 172, 188, 134, 280, 171, 235, 283, 184, 163, None, 245, 231, 220, 214, 176, None, 222, None, 259, 179, 243, 156, 210, 112, None, 173, 200, 196, 223, 174, 270, None, 196, 210, None, 172, 139, 193, 220, 151, None, None, 174, 251, 227, 149, 132, 218, 262, 195, 188, 132, 208, 169, 229, 193, 132, 225, 148, 269, 96, 228, 165, 174, 175, 195, 238, 193, 166, 213, 246, None, 178, 270, 168, 252, None, 171, 208, None, 150, 200, 176, None, 147, 311, 332, 219, 139, 140, 203, 150, 211, 190, 220, 200, 149, 168, 205, 227, 176, 170, 166, 295, 212, 188, 198, 280, 171, 202, 151, 110, 161, 171, 236, 205, 233, None, 256, 236, 252, 191, 208, 215, 183, None, 176, 116, 197, 165, 176, 262, 188, 228, 161, 124, 179, 217, 157, None, 236, 155, 189, 171, 191, 268, 192, 177, None, 231, 211, 140, 216, 194, 180, 197]
# times = [0.302287, 0.48822600000000005, 0.5163570000000002, 0.16153499999999976, 0.7776640000000001, 0.001535000000000064, 0.29301699999999986, 0.5065280000000003, 0.12990400000000024, 0.32921500000000004, 4.679038, 0.1681329999999992, 3.2305550000000007, 0.5520459999999989, 0.7192220000000002, 0.12025600000000125, 0.6981760000000001, 3.6961950000000012, 0.003185000000001992, 0.48873000000000033, 1.2964649999999978, 0.5333119999999987, 1.792968000000002, 0.6345550000000024, 0.28365699999999805, 0.20615100000000197, 0.3406500000000001, 0.4964759999999977, 0.18752800000000036, 1.0494940000000028, 3.761049, 0.9204159999999995, 1.9074659999999959, 1.5012680000000032, 9.198293, 0.24091200000000157, 0.4045929999999984, 3.628905000000003, 17.396524999999997, 0.3690509999999989, 3.187155000000004, 0.6000769999999989, 0.29019800000000373, 0.48729500000000314, 6.386953000000005, 2.8630199999999917, 0.7748610000000014, 0.7580719999999985, 0.3651010000000099, 3.6552050000000094, 0.7605970000000042, 0.19398900000000197, 0.24668499999999938, 0.0033159999999980982, 6.240561999999997, 0.1838510000000042, 0.8707640000000083, 0.16168700000000058, 0.4301110000000108, 0.16683499999999185, 0.9311519999999973, 0.0026849999999996044, 1.4847460000000012, 1.142407999999989, 1.4954979999999978, 1.0758420000000086, 1.8791650000000004, 0.9196019999999976, 0.10925000000000296, 0.5226569999999953, 0.1593209999999914, 1.157032000000001, 2.5614479999999986, 0.3541659999999922, 0.6173730000000006, 0.059522000000001185, 0.160381000000001, 0.9406049999999908, 0.13094700000000614, 0.25168399999999735, 3.846960999999993, 0.7361259999999987, 1.356601000000012, 0.6552250000000015, 0.11782300000000134, 0.04031500000000676, 0.5775300000000101, 1.1632939999999934, 1.4485340000000093, 0.45620300000000213, 0.27908299999999997, 3.0335510000000028, 1.2548239999999993, 0.17242399999999236, 0.36704799999999693, 2.1102300000000014, 0.29303199999999663, 4.164985999999985, 4.567004999999995, 2.086742000000015, 0.4733879999999999, 5.844267000000002, 0.4267099999999857, 1.209859999999992, 0.2015480000000025, 8.292562000000004, 2.92284699999999, 0.4104629999999929, 0.29586899999998195, 0.46127000000001317, 1.0170789999999954, 1.455286000000001, 1.8845369999999946, 0.8482099999999946, 0.5651830000000189, 0.04415199999999686, 2.0751889999999946, 2.479348000000016, 2.5295759999999916, 0.7797919999999863, 0.0026730000000156906, 0.9183069999999987, 1.6649270000000058, 0.1019019999999955, 4.529155000000003, 5.846455999999989, 0.7741430000000094, 0.08540899999999851, 2.5175160000000005, 2.068481999999989, 0.5640789999999924, 0.428260999999992, 1.7390479999999968, 1.0019539999999836, 0.8226879999999994, 0.9755020000000059, 7.529112999999995, 0.7808420000000069, 0.21134399999999687, 0.7513040000000046, 7.666158999999993, 0.26195699999999533, 0.23442700000001082, 2.399527000000006, 1.2790499999999838, 1.7537809999999752, 1.2455859999999745, 1.0338150000000041, 1.7212069999999926, 1.1864989999999977, 1.219680000000011, 1.1028200000000083, 2.04205300000001, 0.26001099999999155, 0.38013599999999315, 0.15817499999999995, 1.6904879999999878, 4.912279000000012, 0.9157529999999952, 0.3886739999999804, 0.4158909999999878, 0.0027560000000050877, 6.362789000000021, 7.658319000000006, 0.28317899999998986, 0.5404159999999933, 0.47652000000002204, 3.7486769999999865, 0.2283069999999725, 0.0037100000000123146, 4.584168000000034, 0.28847100000001547, 19.02055999999999, 1.7636289999999804, 0.7426980000000185, 2.4264119999999707, 1.9503730000000132, 0.8652650000000222, 0.20177099999995107, 0.5929290000000265, 0.1720860000000357, 0.2188199999999938, 3.2740200000000073, 0.050792999999998756, 1.3619659999999953, 3.1773059999999873, 0.6073489999999993, 4.746735000000001, 2.2632360000000062, 3.4399270000000115, 8.308117999999979, 1.0250589999999988, 0.00169000000005326, 0.39543000000003303, 2.3666280000000484, 1.9741940000000113, 9.370889999999974, 0.8959370000000035, 10.932597000000044, 1.146158000000014] + [0.9818600000000001, 0.18684599999999985, 0.284651, 0.1931339999999997, 0.20349899999999987, 0.37138899999999975, 7.124136999999999, 0.6058829999999986, 2.4041420000000002, 0.003247, 0.1637550000000001, 0.23646800000000034, 7.939729000000002, 1.4012209999999996, 0.877122, 3.031236, 1.5146709999999999, 0.11898400000000109, 1.9030850000000008, 0.12234899999999982, 3.3588829999999987, 0.20842400000000083, 0.2950750000000042, 0.5302830000000043, 0.45972799999999836, 0.3606710000000035, 12.203933, 5.492877, 0.770862000000001, 0.03264899999999926, 0.6282549999999958, 0.17952399999999358, 6.333936999999999, 0.37348300000000023, 0.7375720000000001, 1.793454000000004, 0.5641670000000119, 3.2574770000000086, 74.67717799999998, 4.1415079999999875, 0.4001869999999883, 0.6712049999999863, 0.3119820000000004, 1.284636000000006, 1.3202970000000107, 0.6841909999999984, 1.0290500000000122, 3.697091999999998, 11.638582000000014, 0.6672000000000082, 5.086490999999995, 2.5516369999999995, 0.8975179999999909, 0.1515009999999961, 0.5307719999999847, 5.827793000000014, 0.22040800000002037, 1.4703389999999956, 0.528538999999995, 0.684363999999988, 0.15716900000001033, 11.696953000000008, 0.893558000000013, 0.9925029999999992, 1.231281999999993, 1.0381110000000149, 0.8575850000000003, 1.1173339999999996, 0.29615900000001716, 1.1849320000000034, 0.6783920000000023, 0.1940620000000024, 0.0026720000000182154, 1.5418269999999836, 0.3530099999999834, 1.0412879999999802, 0.26709900000000175, 1.358899000000008, 0.0024579999999900792, 1.183667999999983, 2.0924819999999897, 5.934335000000004, 3.029453999999987, 0.1766280000000222, 0.31619799999998577, 0.5998119999999858, 0.28447099999999637, 0.7415009999999995, 1.376227, 0.248722000000015, 1.985258000000016, 1.0290329999999983, 0.7684800000000109, 0.2983030000000042, 1.9575689999999781, 28.328948000000025, 0.573664000000008, 0.17980899999997746, 4.1246980000000235, 0.5455279999999902, 2.5830419999999776, 5.1338309999999865, 1.8075769999999807, 0.5125810000000115, 1.0577020000000061, 2.2284500000000094, 4.102599999999995, 0.4566859999999906, 2.302823999999987, 0.2938520000000153, 4.157145000000014, 8.024020999999948, 0.5287420000000225, 0.2804760000000215, 3.1981030000000032, 0.22229199999998173, 0.5656019999999558, 1.203959999999995, 1.0350630000000365, 3.2405449999999973, 0.41684399999996913, 2.891042000000027, 3.298088000000007, 3.5374330000000214, 0.2688280000000418, 7.112251000000015, 0.3323740000000157, 1.5135099999999966, 0.675389999999993, 0.7517609999999877, 0.7041050000000268, 0.6652470000000221, 0.19704200000001038, 0.3577319999999986, 5.477946999999972, 0.2305769999999825, 1.974019999999996, 2.7916529999999966, 0.49781999999999016, 1.2191030000000183, 0.17617500000000064, 3.7758499999999913, 0.4338819999999828, 5.4692380000000185, 0.07212999999995873, 5.095369000000005, 0.5802400000000034, 0.20575300000001562, 12.511234000000002, 4.129910999999993, 0.06967699999995602, 1.6817480000000273, 0.39475400000003447, 1.9287759999999707, 5.909084000000007, 1.5200940000000287, 0.4394580000000019, 0.6964069999999651, 0.5813059999999837, 6.31139300000001, 0.40707700000001523, 0.1473760000000084, 2.8344220000000178, 3.150712999999996, 0.4260699999999815, 0.4825100000000475, 2.814973000000009, 1.2284329999999954, 0.19369899999998097, 0.7573419999999942, 6.188214000000016, 0.11435000000000173, 1.5439799999999764, 0.8929660000000013, 2.1043359999999893, 3.371122000000014, 0.27641800000003514, 1.863973000000044, 0.36803000000003294, 0.6705519999999865, 0.15709199999997736, 1.5896569999999883, 2.8591299999999933, 0.36724600000002283, 0.17984000000001288, 0.21805399999999509, 0.9198010000000068, 18.44721400000003, 0.21354800000000296, 0.6144419999999968, 0.17110600000000886, 6.6795529999999985, 3.6269309999999564, 0.42886500000003025, 4.119304, 5.221270000000004, 0.002066000000013446, 0.0019340000000056534, 0.2663430000000062, 0.9184209999999666]
# # Score for ABPruning Depth 4 on rack size 5
# p1scores = [175, 14, 220, 184, 201, 199, 248, 187, 259, 241, 292, 142, 261, 284, 193, 0, 196, 149, 227, 247, 170, 210, 284, 240, 353, 247, 214, 333, 210, 0, 230, 165, 207, 193, 259, 183, 247, 164, 250, 301, 193, 149, 223, 211, 193, 223, 287, 123, 240, 276, 222, 308, 246, 154, 173, 221, 158, 199, 147, 121, 0, 77, 153, 185, 218, 200, 207, 211, 171, 234, 198, 222, 175, 159, 180, 280, 219, 172, 277, 254, 238, 226, 200, 209, 258, 303, 242, 210, 244, 249, 300, 107, 174, 330, 268, 220, 252, 243, 196, 370, 213, 167, 168, 94, 202, 125, 175, 211, 253, 0, 125, 201, 0, 219, 211, 176, 209, 200, 223, 312, 197, 240, 274, 261, 212, 165, 258, 223, 204, 282, 238, 232, 200, 229, 292, 234, 248, 269, 227, 225, 150, 203, 253, 251, 127, 235, 229, 174, 268, 179, 189, 206, 262, 0, 186, 138, 274, 207, 213, 241, 237, 283, 223, 190, 325, 252, 211, 0, 205, 317, 145, 332, 217, 199, 273, 294, 240, 210, 218, 312, 211, 176, 230, 162, 249, 149, 166, 186, 131, 179, 174, 198, 208, 359, 273, 168, 225, 275, 406, 236]
# p2scores = [169, 11, 225, 226, 253, 198, 214, 280, 297, 206, 203, 209, 200, 206, 267, 0, 219, 273, 297, 189, 245, 218, 117, 170, 236, 238, 138, 181, 261, 0, 261, 191, 245, 236, 218, 225, 206, 270, 293, 198, 220, 253, 174, 288, 253, 240, 194, 202, 280, 254, 211, 138, 258, 262, 159, 191, 320, 170, 264, 188, 0, 60, 199, 340, 295, 167, 254, 311, 263, 160, 169, 221, 187, 224, 205, 163, 190, 208, 226, 213, 199, 234, 144, 182, 300, 216, 233, 234, 267, 300, 219, 248, 274, 158, 238, 237, 224, 284, 270, 214, 241, 225, 249, 178, 274, 189, 268, 282, 157, 0, 129, 257, 0, 95, 222, 135, 244, 212, 188, 178, 200, 250, 226, 292, 235, 187, 159, 210, 187, 188, 264, 174, 241, 230, 242, 193, 257, 252, 290, 227, 204, 233, 189, 194, 44, 143, 214, 217, 233, 145, 226, 195, 231, 0, 203, 236, 208, 202, 247, 205, 274, 140, 238, 224, 245, 274, 174, 0, 204, 232, 260, 189, 266, 225, 226, 228, 276, 169, 288, 156, 280, 243, 200, 200, 216, 188, 181, 259, 183, 270, 253, 247, 272, 182, 227, 199, 231, 239, 154, 241]
# p1endgamescores = [166, None, 157, 170, 201, 192, 211, 180, 239, 198, 243, 142, 188, 210, 171, None, 160, 149, 173, 184, 159, 207, 284, 240, 299, 185, 212, 267, 180, None, 182, 165, 141, 139, 194, 174, 247, 152, 221, 240, 193, 142, 223, 211, 181, 212, 248, 123, 228, 208, 222, 255, 191, 154, 173, 154, 150, 199, 124, 121, None, None, 153, 181, 183, 194, 185, 183, 112, 234, 198, 198, 175, 129, 180, 211, 188, 172, 277, 227, 238, 172, 193, 209, 214, 247, 198, 180, 209, 213, 244, None, 138, 330, 187, 180, 237, 178, 187, 304, 157, 155, 152, None, 148, 125, 160, 175, 196, None, None, 187, None, None, 211, None, 174, 200, 184, 255, 159, 157, 229, 247, 212, None, 258, 161, 189, 204, 202, 211, 182, 209, 243, 234, 248, 247, 188, 225, 150, 199, 253, 174, None, 235, 175, 174, 214, None, 189, 206, 249, None, 183, 138, 200, 145, 173, 230, 227, 283, 193, 153, 280, 153, 211, None, 142, 257, None, 278, 191, 199, 228, 249, 179, 200, 204, 258, 178, 152, 170, 148, 197, 149, 151, 171, 124, 146, 162, 186, 208, 301, 223, 168, 164, 257, 340, 190]
# p2endgamescores = [163, None, 196, 209, 207, 177, 192, 192, 191, 180, 147, 209, 193, 194, 205, None, 182, 251, 261, 177, 239, 190, 117, 153, 185, 222, 136, 171, 223, None, 219, 185, 214, 202, 200, 158, 206, 163, 245, 190, 212, 238, 151, 267, 210, 232, 179, 202, 222, 219, 197, 114, 246, 238, 159, 185, 269, 159, 225, 188, None, None, 199, 259, 221, 153, 245, 260, 249, 160, 155, 180, 187, 181, 205, 153, 186, 193, 226, 173, 199, 206, 111, 164, 272, 209, 208, 219, 217, 287, 204, None, 204, 158, 179, 211, 160, 262, 178, 183, 230, 206, 203, None, 258, 172, 193, 235, 143, None, None, 179, None, None, 222, None, 194, 212, 170, 161, 188, 239, 196, 249, 211, None, 159, 180, 187, 181, 195, 160, 184, 183, 213, 166, 206, 180, 241, 206, 204, 218, 119, 178, None, 127, 174, 217, 175, None, 176, 192, 172, None, 193, 236, 187, 180, 194, 193, 131, 140, 189, 152, 232, 260, 174, None, 184, 210, None, 159, 225, 208, 190, 178, 268, 162, 216, 143, 230, 222, 155, 180, 192, 188, 173, 218, 165, 238, 213, 170, 212, 154, 200, 199, 199, 180, 135, 182]
# times = [2.732856, 0.013799000000000117, 0.6212740000000005, 17.461609000000003, 0.15544099999999972, 3.888458, 0.1793350000000018, 0.3636580000000009, 0.7966540000000002, 0.4364050000000006, 0.3475600000000014, 0.4426419999999993, 16.792683999999998, 45.095144999999995, 0.8019570000000016, 0.002502999999990152, 0.7269470000000098, 0.25820200000001137, 1.8612710000000021, 19.421993, 3.292968000000002, 0.6188310000000001, 0.418879000000004, 1.749019000000004, 3.5704350000000034, 7.313006999999999, 0.5017420000000072, 6.908141999999998, 0.8737129999999809, 0.0025660000000016225, 0.5404660000000092, 0.3335399999999993, 5.45119600000001, 0.9017589999999984, 20.26504, 0.703519, 0.4969130000000064, 0.4349410000000091, 1.9195970000000102, 8.028055999999992, 0.28790599999999245, 0.5483049999999992, 0.2805319999999938, 0.29201000000000477, 0.49781300000000783, 4.297392000000002, 2.5112029999999947, 3.0092320000000257, 2.238361999999995, 11.072942000000012, 1.7760710000000017, 0.48068399999999656, 2.9702339999999765, 0.24950999999998658, 0.4291249999999991, 12.07982100000001, 0.5462039999999888, 0.22472299999998313, 0.9820869999999786, 1.1886100000000113, 0.003675000000015416, 0.07956299999997896, 2.8142090000000053, 0.388623999999993, 10.462159000000014, 38.91616700000003, 1.1222400000000334, 4.5918779999999515, 1.1467499999999973, 0.21945599999997967, 0.38036699999997836, 1.5123520000000212, 0.5903450000000134, 0.8667050000000245, 0.48585700000001, 26.411121999999978, 1.29780599999998, 0.2938289999999597, 1.8478240000000028, 0.7368250000000103, 1.1077379999999835, 21.91255000000001, 1.8880800000000022, 2.213452000000018, 3.029463000000021, 3.320968999999991, 0.2863209999999867, 2.8904580000000237, 1.3423369999999863, 7.960946000000035, 6.179254999999955, 0.10425200000003088, 2.6533749999999827, 0.1375290000000291, 0.47113200000001143, 0.993741, 13.20896399999998, 23.886505999999997, 0.38961600000004637, 3.5794860000000313, 3.537679, 5.111327000000001, 53.177969000000004, 0.1302570000000003, 1.8522600000000011, 0.6265039999999971, 4.604827999999998, 0.5654570000000092, 1.4373130000000032, 0.002815999999995711, 0.09244599999999537, 0.40296200000000226, 0.002415999999996643, 0.11714700000000278, 0.24759699999999896, 0.0949499999999972, 1.584856000000002, 2.4273259999999937, 0.18289699999999698, 1.5296809999999965, 14.213572999999997, 4.0379059999999924, 0.2696860000000072, 2.9077939999999955, 2.107904000000005, 0.16219599999999446, 0.5316650000000038, 6.9160169999999965, 0.41877599999999404, 8.157394999999994, 4.251577000000012, 4.231014000000002, 9.600237000000007, 7.453451000000001, 0.5010110000000054, 0.9992290000000139, 0.20955200000000218, 0.9690920000000176, 0.5488789999999995, 0.24547300000000405, 0.6523559999999975, 2.037618999999978, 0.18045399999999745, 18.83436499999999, 0.06877599999998552, 0.38777899999999477, 0.9994989999999859, 3.7605120000000056, 0.8266940000000034, 0.09906100000000606, 0.14770200000000955, 0.14975399999997308, 0.5807059999999922, 0.002221999999989066, 1.9387200000000178, 0.7457660000000033, 11.175792999999999, 0.6206999999999994, 3.6378159999999866, 3.3504609999999957, 4.76576399999999, 1.0963680000000124, 14.936075000000017, 1.338105000000013, 0.45994799999999714, 1.2010209999999972, 0.35091800000000717, 0.002596000000011145, 9.615527000000014, 15.125898999999976, 0.14351299999998446, 8.531500999999992, 11.296021999999994, 0.23752799999999752, 0.43902700000001005, 0.405838000000017, 2.0098749999999654, 9.548711000000026, 1.9105750000000512, 5.05331000000001, 0.6292460000000233, 0.34711999999996124, 0.917568000000017, 2.972601999999995, 0.4131250000000364, 0.9787170000000174, 3.019792999999993, 0.3610109999999622, 1.3573409999999626, 0.3707560000000285, 8.371876000000043, 6.125440000000026, 0.1835360000000037, 19.582659999999976, 9.010859000000039, 0.3678770000000213, 3.2456080000000043, 0.36412599999999884, 3.174400999999989, 1.2992909999999824]
#score for ABPruning Depth 5 on rack size 5
# nodes1 = [2030, 15, 51, 67, 94, 27, 868, 862, 37, 8, 561, 2, 439, 375, 930, 136, 898, 20, 91, 21, 39, 27, 285, 219, 38, 52, 109, 4, 63, 628, 929, 237, 2169, 13800, 151, 1184, 12, 71, 11, 417, 3589, 2811, 225, 32, 14, 31, 11, 95, 15, 46, 29, 67, 71, 2097, 619, 588, 39, 2600, 624, 50, 41, 169, 5, 39, 765, 48, 44, 4, 81, 8, 92, 1, 72, 84, 73, 201, 66, 58, 59, 372, 153, 146, 17, 28, 16, 711, 610, 11]
# p1scores1 = [170, 188, 237, 232, 214, 253, 279, 239, 203, 171, 167, 284, 304, 225, 214, 201, 152, 252, 365, 193, 219, 169, 252, 190, 267, 251, 222, 211, 290, 163, 272, 253, 195, 174, 64, 212, 312, 247, 192, 146, 208, 200, 230, 274, 0, 228, 286, 183, 178, 180, 376, 258, 150, 180, 200, 124, 249, 266, 291, 227, 222, 153, 182, 135, 190, 201, 275, 196, 317, 0, 0, 220, 238, 186, 209, 236, 255, 219, 205, 228, 22, 0, 191, 202, 253, 218, 200, 305, 285, 249, 256, 233, 255, 0, 155, 126, 287, 203, 169, 256]
# p2scores1 =[260, 184, 203, 231, 269, 195, 237, 266, 255, 222, 165, 181, 191, 251, 225, 244, 264, 283, 188, 220, 180, 187, 252, 225, 271, 221, 150, 259, 202, 193, 217, 230, 173, 288, 113, 247, 225, 189, 245, 192, 175, 287, 243, 267, 0, 213, 218, 236, 205, 253, 156, 184, 304, 315, 275, 160, 168, 272, 175, 170, 266, 190, 230, 363, 243, 273, 227, 183, 184, 0, 0, 246, 203, 303, 281, 240, 215, 189, 213, 302, 20, 0, 184, 194, 184, 169, 178, 196, 278, 247, 223, 173, 184, 0, 224, 178, 175, 217, 208, 165]
# p1endgamescores1 = [133, 188, 237, 176, 186, 243, 279, 213, 147, 162, 167, 216, 258, 189, 214, 182, 152, 252, 305, 193, 219, 169, 239, 162, 256, 230, 222, 203, 253, 163, 229, 230, 148, 165, None, 186, 235, 208, 126, 146, 208, 200, 230, 264, None, 166, 227, 166, 178, 180, 322, 258, 150, 160, 200, 124, 203, 242, 200, 168, 204, 153, 182, 114, 169, 166, 214, 196, 280, None, None, 204, 232, 170, 158, 236, 215, 219, 205, 210, None, None, 191, 156, 253, 218, 194, 254, 218, 192, 207, 222, 255, None, 155, 126, 249, 125, 164, 214]
# p2endgamescores1 = [185, 167, 203, 227, 196, 132, 190, 240, 204, 192, 165, 169, 174, 233, 225, 224, 264, 283, 160, 208, 180, 170, 183, 167, 228, 164, 120, 196, 185, 158, 188, 173, 167, 243, None, 179, 195, 143, 202, 192, 163, 287, 189, 235, None, 196, 176, 187, 178, 227, 138, 148, 230, 272, 275, 160, 149, 225, 173, 149, 219, 190, 230, 284, 184, 230, 199, 162, 160, None, None, 196, 203, 206, 232, 178, 198, 189, 213, 229, None, None, 160, 166, 184, 152, 151, 149, 268, 243, 195, 173, 184, None, 224, 178, 143, 177, 182, 138]
# times1 =[16.112638, 0.31204600000000227, 0.6796920000000028, 0.7734100000000019, 0.9705629999999985, 0.46329000000000065, 0.17553400000000252, 8.127403000000001, 7.779152, 0.5737299999999976, 0.23147000000000162, 4.792618999999995, 0.2497279999999975, 5.353186999999998, 3.664079000000001, 8.297562, 1.6148019999999974, 0.2074479999999994, 7.665702000000003, 0.3802950000000038, 1.2186629999999923, 0.39734699999999634, 0.5429369999999949, 0.3928499999999957, 2.7380150000000043, 2.2847989999999925, 0.5711359999999956, 0.6492369999999994, 1.601081999999991, 0.23464300000000549, 0.7281010000000094, 5.839645000000004, 8.009985, 2.2360089999999957, 0.03794600000000514, 18.62865500000001, 106.599591, 1.4785849999999812, 10.312135000000012, 0.2718900000000133, 0.8596039999999903, 0.19486899999998286, 0.24861400000000344, 3.8706320000000005, 0.0023579999999867596, 29.138779999999997, 23.555926999999997, 2.274694000000011, 0.5276250000000005, 0.27002799999996796, 0.41291000000001077, 0.25529799999998204, 0.17174199999999473, 0.9664579999999887, 0.3229390000000194, 0.6177310000000489, 0.3732360000000199, 0.7111439999999902, 0.8822620000000256, 16.29657199999997, 5.067601999999965, 5.20061800000002, 0.5240180000000123, 21.185518000000002, 5.6123850000000175, 0.6041490000000067, 0.5517729999999688, 1.9459439999999972, 0.21777700000001232, 0.0031510000000025684, 0.0023370000000113578, 0.5712520000000154, 6.16274999999996, 0.5592800000000011, 0.4912060000000338, 0.1607930000000124, 0.1942860000000337, 0.847802999999999, 0.2699929999999995, 0.8795339999999783, 0.025317999999970198, 0.0020590000000311193, 0.17303100000003724, 0.7059210000000462, 1.0945910000000367, 0.877018000000021, 1.789291999999989, 0.7205609999999751, 0.6656090000000177, 0.8197440000000142, 3.1443270000000325, 1.449218999999971, 1.6580999999999904, 0.003945999999984906, 0.365415999999982, 0.46404300000000376, 0.31528900000000704, 6.125376000000017, 5.259367999999995, 0.25710000000003674]
# nodes2 = [1, 1, 20, 7433, 21, 10733, 357, 186, 231, 990, 421, 5195, 33, 400, 20, 197, 81, 157, 30, 84, 1, 14, 5147, 838, 289, 80, 361, 699, 8385, 374, 846, 683, 6, 88, 43, 215, 193, 11, 8, 37, 1780]
# p1scores2 =[147, 129, 0, 147, 316, 194, 234, 237, 316, 240, 207, 251, 199, 197, 0, 271, 242, 254, 231, 277, 233, 146, 305, 181, 186, 266, 232, 214, 78, 247, 0, 281, 217, 200, 149, 177, 0, 248, 228, 229, 174, 212, 0, 223, 186, 250, 0, 186, 331, 266]
# p2scores2 =[218, 278, 0, 274, 200, 144, 173, 182, 178, 236, 286, 312, 158, 189, 0, 246, 235, 161, 245, 214, 237, 221, 144, 162, 136, 162, 137, 241, 113, 232, 0, 178, 303, 313, 62, 225, 0, 212, 186, 225, 206, 262, 0, 159, 219, 197, 0, 240, 228, 168]
# p1endgamescores2 =[147, 129, None, 136, 253, 194, 169, 165, 260, 176, 138, 240, None, 138, None, 255, 182, 197, 228, 197, 153, 146, 258, 181, 186, 256, 154, 202, None, 236, None, 211, 198, 166, None, 169, None, 188, 177, 184, 169, 161, None, 177, 145, 194, None, 186, 311, 211]
# p2endgamescores2 =[203, 270, None, 207, 187, 144, 167, 168, 128, 223, 269, 305, None, 171, None, 155, 214, 146, 219, 196, 231, 191, 117, 146, 125, 133, 129, 182, None, 199, None, 150, 230, 251, None, 211, None, 205, 165, 189, 198, 223, None, 137, 174, 165, None, 226, 177, 154]
# times2= [0.27102499999999996, 0.206704, 0.003219000000000083, 0.339874, 73.975264, 0.32704999999999984, 80.912725, 3.3703629999999976, 2.0692709999999863, 2.395210999999989, 10.872302999999988, 4.510770000000008, 0.1395480000000191, 48.527783, 0.0015649999999993724, 0.4957629999999824, 5.709429999999998, 0.3313050000000146, 2.196942000000007, 0.9056879999999978, 1.7203229999999792, 0.46023599999998055, 0.83063199999998, 0.17995000000001937, 0.3007690000000025, 44.54222200000001, 7.979903999999976, 2.9357029999999895, 0.0614140000000134, 0.9921439999999961, 0.0038780000000429027, 3.3685120000000097, 6.164650999999992, 62.014320999999995, 0.0810989999999947, 4.158075999999994, 0.0031409999999709726, 7.932039000000032, 5.6581540000000246, 0.31328999999999496, 0.9587760000000003, 0.5008419999999774, 0.0027319999999804168, 2.3414569999999912, 1.9283489999999688, 0.2215190000000007, 0.002453000000002703, 0.2446790000000192, 0.4796670000000063, 15.450380999999993]
# nodes = nodes1 + nodes2
# p1scores = p1scores1 + p1scores2
# p2scores = p2scores1 + p2scores2
# p1endgamescores = p1endgamescores1 + p1endgamescores2
# p2endgamescores = p2endgamescores1 + p2endgamescores2
# times = times1 + times2
# No max depth for AB pruning on rack size 5
# nodes1 = [2918, 19, 20, 167, 223, 24, 66, 239, 901, 34, 5, 439, 14, 34, 667, 170, 79, 670, 308, 66, 62, 253, 343, 4, 79, 2440, 54, 2283, 92, 206, 433, 3, 43, 938, 54, 10, 197, 2857, 75, 13, 105, 44, 119, 19, 69, 4487, 1236, 25, 10, 2, 199, 981, 96, 12, 815, 53, 726, 61, 3301, 69, 1665, 1018, 2148, 120432, 49, 262, 27, 528, 75, 2508, 65, 43, 60, 109, 32, 1664, 287, 2759, 1428, 246, 128, 90, 898, 20, 371, 56, 13, 8, 1196, 6033, 129, 13, 1399]
# p1scores1 = [180, 215, 196, 195, 195, 235, 184, 220, 231, 195, 197, 212, 263, 30, 187, 161, 293, 218, 268, 273, 173, 280, 203, 243, 235, 305, 255, 197, 191, 255, 170, 228, 213, 234, 163, 189, 355, 214, 212, 167, 225, 214, 206, 158, 145, 264, 239, 259, 224, 182]
# p2scores1 = [261, 276, 286, 203, 278, 182, 178, 177, 198, 209, 189, 200, 187, 22, 112, 229, 206, 188, 268, 220, 194, 171, 158, 260, 179, 224, 253, 256, 186, 186, 288, 267, 323, 274, 202, 230, 211, 268, 208, 178, 171, 255, 161, 184, 53, 144, 197, 220, 262, 251]
# p1endgamescores1 = [104, 170, 196, 181, 184, 190, 184, 210, 220, 195, 190, 158, 263, None, None, 161, 222, 215, 256, 264, 173, 229, 203, 221, 165, 265, 216, 177, 191, 200, 158, 213, 206, 195, 163, 165, 297, 214, 212, 167, 211, 206, 206, 158, None, 264, 234, 196, 170, 156]
# p2endgamescores1 = [230, 258, 228, 160, 222, 149, 178, 147, 189, 200, 150, 187, 156, None, None, 229, 200, 188, 178, 172, 194, 157, 133, 196, 169, 210, 220, 184, 186, 180, 213, 147, 277, 236, 202, 183, 205, 244, 179, 178, 129, 178, 161, 184, None, 123, 180, 172, 252, 232]
# times1 = [28.457569, 0.33411299999999855, 0.3422729999999987, 1.7242899999999999, 1.9751229999999964, 0.34948599999999885, 0.8178440000000009, 2.284306000000001, 8.470917, 0.49538099999999474, 0.2556449999999941, 4.728405000000002, 0.34807999999999595, 0.023735999999999535, 0.12552500000000322, 0.483984999999997, 7.080171, 1.9386399999999995, 0.9097670000000022, 6.730280999999998, 2.9818090000000126, 0.7033690000000092, 0.72840699999999, 2.370058, 4.470228999999989, 0.2786049999999989, 0.8592219999999884, 20.823213999999993, 0.6710889999999949, 17.893317999999994, 0.8816439999999943, 1.7517409999999956, 3.9330260000000123, 0.20288299999999992, 0.6357670000000013, 7.664194999999992, 0.7840810000000147, 0.3089580000000183, 1.8615410000000168, 24.267165000000006, 0.848608999999982, 0.27916300000001115, 1.231020000000001, 0.5714190000000201, 0.04297500000001264, 1.3442199999999787, 0.3977549999999894, 0.8133920000000217, 36.14156200000002, 10.697302999999977, 0.5683670000000001, 0.26924099999999984, 0.17733, 2.02914, 8.453273, 0.8671249999999997, 0.2741490000000013, 8.405273000000001, 0.003088000000001756, 0.7832660000000011, 6.770484, 0.001788000000001233, 0.7870349999999995, 32.759317, 0.8810690000000037, 15.959770999999996, 9.082476, 23.287146000000007, 899.159576, 0.6069360000000188, 2.3854630000000725, 0.4569099999999935, 0.13301100000001043, 4.110847000000035, 0.874349000000052, 20.135546999999974, 0.7187790000000405, 0.4951149999999416, 0.675617000000102, 1.151836000000003, 0.4612999999999374, 13.440222000000176, 0.0017380000001594453, 2.7643929999999273, 22.713453000000072, 11.432960999999978, 2.4568299999998544, 1.368257000000085, 0.9997370000000956, 7.1294339999999465, 0.3538969999999608, 3.9655290000000605, 0.6393659999998818, 0.26812500000005457, 0.23288300000012896, 9.49111599999992, 55.96718499999997, 1.2186229999999796, 0.28220200000009754, 10.691080000000056]
# nodes2 = [499, 1628, 990, 2, 13, 133, 17, 1173, 60, 5, 1573, 333, 12296, 31539, 51, 35, 229, 61, 1644, 129, 52, 55, 2175, 41, 137, 73, 7, 12, 41, 993, 14, 23, 15, 670, 505, 7139, 23, 17, 492, 2, 7498, 17, 4, 859, 4331, 8, 3, 165, 3847]
# p1scores2 = [226, 198, 227, 200, 237, 209, 153, 247, 177, 143, 222, 230, 184, 321, 220, 229, 261, 185, 226, 233, 258, 145, 154, 258, 250, 186, 178, 127, 240, 266, 246, 205, 289, 224, 256, 246, 224, 244, 198, 147, 241, 244, 235, 308, 192, 261, 202, 274, 295, 267]
# p2scores2 = [225, 190, 209, 284, 179, 162, 169, 211, 202, 212, 258, 230, 213, 229, 220, 133, 169, 295, 206, 233, 320, 267, 276, 253, 305, 229, 216, 237, 178, 318, 319, 240, 195, 190, 200, 175, 210, 201, 206, 238, 205, 218, 226, 199, 231, 206, 149, 204, 234, 255]
# p1endgamescores2 = [167, 190, 167, 200, 237, 209, 153, 198, 177, 143, 147, 202, 184, 260, 200, 229, 261, 155, 164, 233, 243, 115, 150, 173, 240, 168, 178, 127, 240, 249, 227, 195, 248, 224, 248, 240, 167, 184, 198, 120, 204, 175, 190, 265, 192, 203, 202, 230, 280, 171]
# p2endgamescores2 = [219, 185, 195, 266, 163, 162, 169, 194, 202, 200, 233, 175, 213, 215, 178, 119, 145, 201, 178, 155, 234, 226, 215, 204, 238, 185, 172, 183, 157, 252, 204, 154, 175, 170, 133, 167, 175, 168, 194, 184, 169, 188, 206, 183, 231, 184, 149, 185, 154, 186]
# times2 = [5.462273, 13.628348999999998, 9.027452999999998, 0.20035800000000137, 0.350676, 1.452566000000001, 0.3063469999999988, 9.485683000000002, 0.7841099999999983, 0.20266799999999563, 17.036028, 3.118584999999996, 102.818501, 242.39040999999997, 0.5522730000000138, 0.5206039999999916, 2.3233899999999608, 0.7285350000000221, 14.949749999999995, 0.17539299999998548, 1.184301000000005, 0.577241000000015, 0.6432050000000231, 20.644333999999958, 0.5160099999999943, 1.323853999999983, 0.8926519999999982, 0.2601789999999937, 0.33121899999997595, 0.4770679999999743, 8.132326000000035, 0.31665900000001557, 0.39193999999997686, 0.3116600000000176, 6.508721000000037, 5.085165000000018, 55.82077000000004, 0.3661329999999907, 0.4054830000000038, 4.384490000000028, 0.16655200000002424, 70.42404600000009, 0.35272199999997156, 0.2003789999999981, 8.768035000000054, 35.55618399999992, 0.24955899999997655, 0.1856559999999945, 1.568037000000004, 29.536572999999976]
# nodes = nodes1 + nodes2
# p1scores = p1scores1 + p1scores2
# p2scores = p2scores1 + p2scores2
# p1endgamescores = p1endgamescores1 + p1endgamescores2
# p2endgamescores = p2endgamescores1 + p2endgamescores2
# times = times1 + times2
# PVS Search
# nodes = [1, 13, 3, 101, 3, 4, 16, 11, 26, 6, 44, 43, 23, 3, 3, 9, 133, 69, 24, 13, 1098, 22, 51, 3, 282, 19, 22, 93, 12, 9, 139, 307, 4, 11, 16, 3, 10, 5, 34, 153, 15, 11, 47, 14, 76, 25, 6, 69, 18, 6, 22, 14, 141, 7, 3, 12, 286, 31, 45, 4, 39, 78, 21, 8, 12, 11, 20, 6, 3, 468, 177, 17, 215, 6, 32, 20, 4, 15, 55, 8, 7, 60, 301, 3, 6, 12, 1542, 111, 11, 19, 8, 3, 269, 44, 82, 88, 5, 11, 1368, 6, 39, 12, 13, 49, 55, 11, 3, 19, 6, 36, 12, 35, 23, 29, 213, 22, 23, 9, 6, 6, 455, 3, 8, 2, 83, 12, 137, 74, 38, 15, 4, 3, 6, 11, 3, 3, 34, 28, 21, 17, 51, 3, 7, 29, 67, 11, 6, 30, 35, 476, 3, 3, 49, 17, 6, 3, 224, 9, 57, 3, 10, 43, 164, 33, 13, 138, 41, 12, 3, 20, 169, 167, 3, 3, 13, 14, 20, 3, 50, 3, 146, 77, 3, 3, 194, 7, 11, 3, 8, 8, 6, 181, 11, 11, 15, 28, 40, 14, 261, 3, 18, 47, 10, 14, 4, 236, 6, 6, 6, 77, 57, 3, 18, 54, 41, 3, 3, 592, 15, 62, 29, 47, 1, 5, 55, 31, 7182, 283, 167, 18, 62, 14, 233, 32, 11, 30, 149, 3, 22849, 141, 130, 6, 24, 31, 11, 83, 262, 204, 5, 9, 71, 74, 3, 12, 61, 41, 38, 4, 49, 15, 21, 4, 123, 14, 3, 4, 15, 284, 49, 553, 15, 41, 5, 37, 29, 92, 11, 13, 39, 5, 57, 129, 21, 104, 25, 66, 13, 81, 3, 3, 8, 3, 192, 28, 93, 17107, 53, 135, 53, 89, 7, 6, 23, 9, 80, 408, 125, 36, 56, 1, 204, 7, 13, 3, 12, 18, 3, 30, 25, 7, 22, 581, 6, 2, 3, 110, 6, 164, 57, 6, 10, 3, 3, 6, 3, 7, 3, 25, 3, 3, 1, 102, 1, 1, 13, 5, 15, 3, 250, 11, 223, 101, 16, 4, 90, 19, 75, 9, 25, 3, 40, 5, 7, 16, 69, 5, 6, 3, 6, 22, 3, 3, 54, 8, 69, 6, 3, 3, 524, 17, 27, 9, 56, 6, 16, 17, 48, 3, 376, 1, 56, 30, 21, 378, 48, 27, 23, 3, 821, 12, 6, 31, 12, 8, 284, 35, 172, 59, 36, 1652, 122, 19, 41, 27, 20, 11, 325, 13, 13, 133, 27, 3, 3, 91, 3, 3, 1, 385, 27, 47, 7, 127, 3, 26, 232, 20, 18, 3, 9, 84, 11, 3, 3, 116, 14, 53, 32, 22, 15]
# p1scores =[218, 166, 280, 234, 259, 315, 0, 261, 282, 258, 224, 198, 246, 0, 185, 204, 144, 153, 214, 235, 188, 108, 223, 227, 161, 260, 138, 220, 321, 287, 240, 73, 250, 203, 260, 191, 225, 182, 188, 228, 240, 171, 183, 216, 235, 180, 273, 165, 229, 226, 209, 137, 213, 299, 254, 241, 205, 320, 230, 227, 227, 214, 299, 187, 181, 251, 309, 140, 181, 195, 286, 139, 201, 281, 224, 212, 230, 152, 174, 267, 165, 115, 208, 156, 0, 262, 279, 202, 267, 197, 220, 263, 246, 118, 216, 157, 150, 337, 172, 49, 276, 193, 145, 217, 200, 276, 227, 219, 290, 189, 243, 251, 200, 39, 286, 318, 326, 268, 214, 169, 197, 235, 249, 338, 176, 168, 226, 212, 248, 257, 255, 0, 0, 172, 278, 192, 244, 182, 243, 200, 189, 191, 268, 215, 270, 259, 156, 304, 196, 271, 194, 255, 309, 286, 121, 229, 293, 226, 176, 165, 305, 376, 150, 227, 235, 112, 31, 202, 219, 152, 337, 269, 195, 240, 16, 241, 237, 163, 257, 169, 210, 298, 257, 232, 268, 290, 316, 256, 202, 174, 181, 244, 165, 284, 238, 193, 194, 264, 207, 233, 280, 187, 257, 212, 239, 258, 189, 235, 229, 226, 270, 208, 0, 0, 278, 229, 278, 184, 215, 263, 209, 188, 222, 166, 272, 0, 286, 223, 343, 325, 171, 246, 313, 164, 381, 311, 242, 238, 214, 141, 284, 196, 310, 297, 202, 195, 226, 249, 243, 163, 224, 263, 172, 161, 288, 205, 179, 156, 380, 260, 269, 223, 208, 0, 252, 189, 0, 257, 0, 190, 313, 234, 186, 187, 164, 272, 154, 168, 148, 60, 187, 0, 250, 194, 31, 325, 174, 261, 0, 232, 227, 279, 233, 166, 225, 284, 346, 196, 234, 0, 209, 180, 258, 207, 175, 215, 172, 233, 189, 260, 190, 174, 248, 256, 255, 126, 228, 229, 164, 260, 0, 288, 279, 44, 190, 218, 226, 135, 273, 229, 237, 250, 233, 254, 203, 288, 188, 171, 191, 280, 258, 196, 238, 160, 294, 203, 231, 265, 180, 223, 265, 108, 321, 0, 270, 144, 212, 272, 230, 290, 197, 249, 300, 149, 198, 191, 221, 280, 200, 224, 198, 168, 146, 207, 0, 241, 9, 191, 144, 290, 293, 213, 269, 215, 199, 195, 254, 202, 20, 204, 259, 235, 153, 161, 202, 264, 208, 280, 142, 250, 141, 142, 99, 190, 232, 190, 218, 329, 201, 185, 35, 181, 257, 218, 192, 213, 262, 242, 160, 149, 268, 214, 182, 166, 275, 205, 289, 216, 256, 249, 202, 204, 277, 307, 233, 273, 200, 294, 0, 198, 220, 123, 181, 147, 257, 251, 178, 250, 203, 205, 136, 0, 230, 289, 221, 197, 212, 207, 274, 293, 152, 178, 323, 202, 134, 241, 180, 191, 170, 222, 149, 249, 242, 204, 251, 309, 301, 322, 136, 224, 176, 204, 291, 279, 203, 238, 252, 283, 285, 238, 323, 241, 260, 194, 210, 248, 0, 238, 247, 185]
# p2scores =[189, 196, 243, 218, 227, 220, 0, 259, 216, 248, 316, 289, 184, 0, 146, 141, 184, 198, 186, 261, 170, 94, 184, 367, 178, 332, 233, 200, 254, 238, 195, 95, 192, 305, 263, 156, 306, 248, 203, 215, 148, 246, 248, 118, 247, 276, 195, 243, 309, 273, 335, 174, 255, 268, 215, 140, 252, 221, 205, 226, 243, 149, 112, 269, 199, 219, 221, 96, 290, 143, 164, 222, 209, 171, 250, 264, 264, 263, 221, 215, 265, 158, 219, 201, 0, 240, 246, 195, 196, 290, 250, 264, 267, 192, 271, 275, 240, 222, 193, 12, 177, 178, 184, 160, 248, 190, 262, 200, 140, 208, 298, 215, 250, 24, 173, 219, 197, 256, 386, 200, 218, 279, 196, 179, 292, 215, 225, 186, 201, 173, 266, 0, 0, 196, 160, 212, 154, 143, 312, 170, 212, 120, 222, 202, 195, 239, 208, 186, 195, 177, 206, 153, 168, 153, 188, 191, 256, 255, 261, 314, 297, 181, 195, 284, 179, 98, 33, 155, 246, 159, 186, 274, 226, 184, 35, 224, 189, 232, 203, 192, 220, 159, 232, 206, 237, 274, 182, 134, 187, 185, 217, 163, 197, 197, 184, 180, 248, 186, 232, 261, 181, 198, 258, 151, 206, 190, 221, 238, 235, 209, 193, 266, 0, 0, 129, 280, 196, 202, 225, 218, 259, 239, 164, 242, 282, 0, 219, 198, 193, 249, 301, 176, 245, 215, 203, 187, 220, 261, 230, 239, 189, 217, 261, 168, 321, 195, 242, 263, 268, 224, 208, 171, 332, 258, 209, 238, 223, 274, 179, 192, 214, 250, 121, 0, 223, 316, 0, 290, 0, 294, 204, 215, 311, 184, 317, 157, 276, 230, 145, 136, 218, 0, 195, 205, 25, 167, 197, 192, 0, 242, 171, 290, 195, 160, 193, 330, 258, 249, 293, 0, 196, 206, 198, 217, 223, 160, 222, 247, 178, 212, 177, 227, 250, 196, 190, 261, 271, 283, 215, 237, 0, 203, 233, 153, 184, 202, 284, 227, 186, 210, 194, 277, 225, 176, 170, 245, 369, 181, 227, 230, 251, 330, 199, 205, 252, 308, 197, 195, 244, 230, 171, 274, 206, 0, 136, 178, 220, 294, 221, 125, 257, 304, 303, 252, 274, 179, 268, 173, 173, 191, 236, 229, 214, 278, 0, 197, 17, 327, 129, 186, 208, 230, 223, 160, 139, 191, 183, 252, 11, 238, 207, 126, 186, 263, 187, 209, 190, 263, 305, 241, 291, 202, 148, 214, 246, 209, 188, 271, 213, 240, 46, 305, 275, 315, 230, 125, 214, 223, 199, 204, 237, 209, 169, 351, 191, 238, 219, 234, 311, 220, 245, 192, 224, 160, 233, 170, 200, 249, 0, 167, 188, 175, 231, 238, 252, 243, 139, 285, 281, 283, 185, 0, 260, 181, 204, 278, 312, 233, 156, 215, 348, 230, 146, 212, 205, 286, 197, 300, 249, 222, 266, 166, 166, 225, 217, 192, 205, 231, 161, 221, 360, 250, 170, 198, 184, 255, 250, 222, 206, 169, 235, 159, 301, 184, 296, 215, 0, 149, 218, 345]
# p1endgamescores =[218, 166, 234, 166, 212, 270, None, 229, 211, 194, 199, 166, 201, None, 185, 204, 144, 153, 214, 178, 133, None, 223, 165, 161, 210, 138, 220, 305, 194, 240, None, 203, 203, 216, 191, 183, 182, 188, 184, 231, 158, 183, None, 202, 168, 222, 165, 219, 152, 201, 137, 206, 203, 225, 241, 156, 250, 230, 146, 188, 214, 299, 158, 181, 180, 269, None, 112, 195, 205, 139, 150, 226, 208, 194, 171, 152, 174, 193, 154, None, 195, 156, None, 262, 230, 158, 241, 189, 206, 189, 181, 118, 204, 157, 136, 329, 172, None, 276, 193, 145, 217, 190, 212, 164, 219, 246, 189, 213, 251, 191, None, 207, 246, 278, 251, 150, 169, 150, 219, 188, 287, 160, 168, 154, 143, 197, 202, 236, None, None, 172, 278, 178, 244, 182, 201, 200, 173, None, 218, 205, 207, 188, 145, 263, 196, 231, 176, 255, 309, 264, 121, 229, 285, 201, 176, 165, 290, 293, 150, 182, 219, None, None, 202, 210, 152, 255, 258, 167, 191, None, 196, 237, 163, 218, 169, 210, 207, 212, 221, 166, 267, 305, 209, 202, 174, 145, 181, 165, 231, 189, 193, 194, 212, 149, 193, 210, 158, 210, 212, 176, 188, 176, 188, 182, 226, 206, 185, None, None, 278, 229, 207, 184, 182, 224, 196, 188, 222, 136, 266, None, 276, 223, 275, 308, 134, 246, 251, 149, 340, 311, 179, 227, 167, 141, 193, 149, 257, 211, 163, 195, 202, 225, 189, 163, 157, 198, 167, 151, 226, 183, 150, 135, 335, 195, 269, 210, 208, None, 192, 189, None, 241, None, 155, 246, 223, 164, 134, 161, 231, 139, 153, 148, None, 187, None, 199, 194, None, 263, 174, 190, None, 164, 227, 236, 168, 166, 160, 239, 303, 160, 218, None, 189, 166, 209, 137, 175, 215, 172, 200, 189, 178, 190, 164, 232, 216, 235, 126, 218, 203, 164, 236, None, 232, 279, None, 190, 173, 142, 135, 273, 214, 163, 162, 187, 254, 203, 271, 177, 171, 175, 222, 211, 154, 238, 160, 241, 195, 206, 221, 180, 223, 223, 94, 296, None, 201, 144, 212, 251, 187, 252, 156, 149, 253, 149, 160, 191, 221, 217, 200, 224, 178, 168, 146, 207, None, 197, None, 181, None, 290, 237, 213, 193, 215, 199, 195, 254, 182, None, 204, 259, 222, 153, 155, 188, 181, 148, 223, 142, 237, 141, 142, None, 144, 218, 178, 206, 305, 184, 161, None, 163, 208, 215, 156, 213, 216, 228, 160, 139, 229, 168, 182, 145, 224, 192, 244, 194, 236, 249, 202, 204, 208, 267, 183, 273, 139, 248, None, 187, 203, 123, 152, 136, 210, 190, 178, 248, 184, 157, 136, None, 192, 210, 215, 183, 186, 174, 223, 279, 145, 168, 258, 202, 134, 227, 180, 191, 170, 222, 134, 201, 242, 183, 187, 262, 301, 251, 136, 197, 143, 195, 291, 207, 203, 217, 163, 239, 237, 189, 263, 241, 218, 194, 157, 202, None, 238, 236, 158]
# p2endgamescores= [183, 196, 222, 205, 206, 191, None, 216, 202, 219, 277, 225, 165, None, 124, 141, 184, 198, 175, 233, 161, None, 184, 354, 178, 293, 233, 200, 184, 227, 177, None, 167, 305, 181, 144, 277, 248, 179, 170, 139, 179, 203, None, 194, 254, 158, 225, 187, 249, 278, 174, 182, 223, 158, 128, 199, 207, 178, 167, 201, 127, 112, 226, 199, 203, 187, None, 278, 143, 146, 205, 187, 151, 223, 224, 237, 263, 221, 175, 212, None, 146, 187, None, 220, 228, 190, 144, 224, 172, 228, 254, 169, 214, 261, 170, 153, 166, None, 157, 178, 184, 160, 207, 176, 233, 200, 114, 197, 240, 170, 166, None, 159, 192, 186, 216, 295, 200, 160, 189, 146, 134, 230, 188, 208, 182, 189, 166, 207, None, None, 177, 160, 141, 154, 136, 270, 164, 167, None, 217, 162, 169, 219, 197, 176, 162, 162, 157, 135, 155, 147, 188, 153, 196, 213, 261, 282, 234, 158, 195, 259, 121, None, None, 155, 221, 139, 151, 259, 172, 170, None, 199, 189, 215, 156, 169, 187, 149, 183, 189, 230, 227, 167, 123, 171, 169, 193, 135, 197, 179, 155, 180, 248, 170, 187, 239, 144, 193, 239, 141, 164, 138, 183, 219, 235, 209, 193, 223, None, None, 129, 256, 177, 202, 178, 174, 259, 239, 164, 157, 212, None, 151, 185, 169, 196, 255, 176, 226, 162, 181, 187, 210, 199, 203, 233, 180, 193, 230, 153, 278, 189, 186, 187, 211, 224, 195, 158, 271, 215, 189, 223, 173, 201, 132, 163, 200, 182, 109, None, 201, 257, None, 222, None, 237, 155, 179, 266, 168, 305, 132, 212, 203, 145, None, 192, None, 155, 205, None, 144, 184, 192, None, 230, 171, 263, 166, 151, 135, 305, 196, 205, 245, None, 128, 199, 131, 205, 190, 160, 183, 204, 158, 199, 177, 125, 169, 134, 156, 261, 191, 187, 194, 195, None, 180, 233, None, 184, 167, 257, 227, 186, 199, 187, 261, 187, 176, 166, 206, 261, 181, 153, 223, 228, 289, 154, 205, 223, 269, 134, 161, 219, 198, 151, 223, 157, None, 111, 161, 170, 249, 194, 115, 209, 268, 249, 252, 223, 160, 164, 162, 157, 155, 162, 214, 214, 278, None, 176, None, 276, None, 153, 172, 224, 190, 160, 134, 191, 167, 215, None, 238, 195, 79, 186, 198, 144, 199, 190, 221, 286, 214, 291, 202, None, 188, 200, 147, 150, 188, 175, 164, None, 256, 208, 253, 183, 125, 190, 141, 199, 199, 211, 173, 157, 304, 169, 189, 177, 226, 268, 173, 229, 192, 195, 149, 175, 143, 193, 221, None, 130, 178, 175, 180, 225, 225, 208, 139, 206, 209, 271, 165, None, 208, 161, 197, 237, 238, 188, 123, 208, 254, 168, 137, 212, 168, 231, 175, 269, 249, 222, 223, 146, 159, 175, 201, 165, 192, 225, 161, 160, 317, 223, 170, 183, 169, 211, 205, 195, 181, 140, 209, 148, 280, 184, 254, 178, None, 149, 155, 296]
# times= [0.2928059999999999, 0.3718410000000001, 0.23194399999999993, 1.0388579999999998, 0.22879199999999988, 0.22002699999999997, 0.0020039999999998948, 0.4194810000000002, 0.3165870000000002, 0.37523799999999996, 0.21161799999999964, 0.8742600000000005, 0.6539440000000001, 0.0025639999999995666, 0.33535300000000046, 0.19672800000000024, 0.19727399999999928, 0.21439200000000014, 1.375591000000001, 0.8091880000000007, 0.38516199999999934, 0.09082000000000079, 0.2991969999999995, 9.217161, 0.37808399999999764, 0.8026850000000003, 0.18621900000000124, 2.9802820000000025, 0.3490499999999983, 0.43283699999999925, 1.1114730000000002, 0.08380700000000019, 0.3125120000000017, 0.25763999999999854, 1.3630969999999998, 2.764902000000003, 0.23528799999999706, 0.3022879999999972, 0.4018209999999982, 0.1808000000000014, 0.26575300000000013, 0.24835099999999954, 0.1446050000000021, 0.15552600000000183, 0.5358790000000013, 1.543016999999999, 0.3358879999999971, 0.3114440000000016, 0.6193889999999982, 0.3618939999999995, 0.7966959999999972, 0.390703000000002, 0.25773399999999924, 0.6757259999999974, 0.35827700000000107, 0.22720100000000087, 0.3796840000000046, 0.43254400000000004, 1.4931490000000025, 0.2548719999999989, 0.23152199999999823, 0.2505860000000055, 0.1444189999999992, 2.4351270000000014, 0.5021939999999958, 0.6229390000000024, 0.2047719999999984, 0.07404299999999608, 0.473507000000005, 0.9960200000000015, 0.37344699999999875, 0.2536440000000013, 0.32034300000000115, 0.29288700000000034, 0.4103250000000003, 0.25149100000000146, 0.1767630000000011, 4.083317000000001, 1.9761140000000026, 0.35448799999999636, 1.6717980000000026, 0.09816299999999956, 0.23800300000000618, 0.4695199999999957, 0.003132999999998276, 0.437342000000001, 0.26709399999999306, 0.3666509999999974, 0.5937780000000004, 0.23120199999999613, 0.24429899999999805, 0.7964970000000022, 3.20188499999999, 0.25137300000000096, 0.2140629999999959, 0.2290739999999971, 12.218799000000004, 0.989570999999998, 0.2993850000000009, 0.03139299999999423, 0.34039199999999425, 0.2431930000000051, 0.2137830000000065, 0.13565599999999733, 2.187706999999989, 0.6617399999999947, 1.391360000000006, 0.9645450000000011, 0.20681100000000185, 0.33145700000000033, 9.58070099999999, 0.30060399999999277, 0.512715, 0.021703999999999724, 0.3306620000000038, 0.3271529999999956, 0.614806999999999, 0.6048430000000025, 0.3124660000000006, 0.22258399999999767, 0.3527690000000092, 0.21717099999999334, 0.5492429999999899, 0.3776319999999913, 0.4154920000000004, 0.42213999999999885, 0.4515840000000111, 2.5750829999999922, 0.401961, 0.43810599999999056, 0.22623299999999347, 0.002532000000002199, 0.0018150000000076716, 0.22750400000001036, 0.23555100000000095, 0.2394079999999974, 4.218062000000003, 0.18922299999999836, 0.2122399999999942, 0.19388100000000463, 0.7154629999999997, 0.11671599999999671, 0.31569100000000105, 1.2622329999999948, 0.7974519999999927, 0.6517769999999956, 0.41394299999998907, 0.20967999999999165, 0.234185999999994, 0.251410000000007, 0.2803170000000108, 0.18839300000000492, 0.2053939999999983, 0.534396000000001, 0.4496340000000032, 0.37912299999999277, 0.3112829999999889, 0.6531530000000032, 0.29095900000000086, 0.2679389999999984, 0.5020150000000001, 0.8538089999999983, 0.2451690000000042, 0.24101299999999526, 0.40490699999999435, 0.08170499999999947, 0.03884700000000407, 0.5336039999999969, 5.059089999999998, 0.18274100000000715, 0.2251499999999993, 0.8296859999999953, 0.31562900000000127, 0.21862600000000043, 0.026416000000011763, 0.21508499999998776, 2.6393170000000055, 0.2953679999999963, 0.669667000000004, 0.19704600000000028, 0.2758139999999969, 0.6253249999999753, 1.6880829999999776, 0.5045389999999941, 0.41301500000000146, 1.3947259999999915, 0.5800529999999924, 0.27186100000000124, 0.16846100000000774, 0.36898900000002754, 1.8655620000000113, 1.9216669999999851, 0.22315499999999133, 0.22424100000000635, 0.2909649999999999, 0.3366570000000024, 0.37276799999997934, 0.20635099999998374, 0.6916360000000168, 0.22340499999998542, 1.4546670000000006, 0.9543570000000159, 0.2264419999999916, 0.23100800000000277, 1.7468560000000082, 0.2247030000000052, 0.38132199999998306, 0.208044000000001, 0.22038499999999317, 0.192748000000023, 0.2522610000000043, 2.0404780000000073, 0.0028300000000172076, 0.0027790000000038617, 0.24784099999999398, 0.3263469999999984, 0.3013249999999914, 0.4446060000000216, 0.41555499999998347, 0.3310480000000098, 2.386485999999991, 0.1714550000000088, 0.3242869999999982, 0.7600260000000105, 0.27437799999998447, 0.002240000000000464, 0.2850119999999947, 0.17968399999998041, 2.786428000000001, 0.20285200000000714, 0.20589999999998554, 0.1930720000000008, 0.8937139999999886, 0.8421769999999924, 0.2545039999999972, 0.40410099999999716, 0.8030490000000157, 0.5610989999999845, 0.21402100000000246, 0.2232050000000072, 5.460230999999993, 0.28734200000002375, 0.8302300000000002, 0.45365300000000275, 0.554003999999992, 0.17290600000001177, 0.22391000000001782, 0.7349100000000135, 0.4988390000000038, 57.867542000000014, 2.9327009999999802, 1.8384949999999947, 0.34806199999999876, 0.6671989999999823, 0.3419749999999908, 2.6556659999999965, 0.40598099999999704, 0.3016930000000002, 0.7211619999999925, 1.6560149999999965, 0.2520900000000097, 172.473804, 1.5781190000000151, 0.003030000000023847, 1.5507789999999773, 0.1987359999999967, 0.0020370000000298205, 0.2470360000000369, 0.0019209999999816318, 0.46808499999997366, 0.5146919999999682, 0.30661500000002206, 1.0912050000000022, 3.103079999999977, 2.1348110000000133, 0.20253500000001168, 0.22418199999998478, 0.8674279999999612, 0.8155019999999809, 0.04360199999996439, 0.16060300000003735, 0.0019020000000296022, 0.3572400000000471, 0.6463150000000155, 0.02232800000001589, 0.5644740000000183, 0.5229150000000118, 0.17267799999996214, 0.0018010000000003856, 0.6582479999999578, 0.3232359999999517, 0.42014299999999594, 0.17136499999998023, 1.1740439999999808, 0.3454179999999951, 0.24046300000003384, 0.22762199999999666, 0.3469519999999875, 2.7941959999999995, 0.0023160000000075343, 0.5626589999999965, 5.594690000000014, 0.3335419999999658, 0.5099799999999846, 0.20556300000004057, 0.5425690000000145, 0.4355209999999943, 0.8707939999999894, 0.24418299999996407, 0.380628999999999, 0.5869670000000156, 0.21521200000000817, 0.6054320000000075, 1.3143350000000282, 0.42159899999995787, 1.293295999999998, 0.38424699999995937, 0.6967149999999833, 0.300407000000007, 0.8768420000000106, 0.0034870000000069012, 0.16064799999998058, 0.2565319999999929, 0.07622500000002219, 0.2552289999999857, 0.16474999999996953, 1.8532679999999573, 0.4848479999999995, 1.3019820000000095, 117.35243199999996, 0.7084909999999809, 1.5091749999999138, 0.5793330000000196, 1.1138200000000325, 0.24734999999998308, 0.2551379999999881, 0.41855899999995927, 0.23927900000001046, 0.8112929999999778, 4.130955999999969, 1.4083500000000413, 0.5017380000000458, 0.6638189999999895, 0.13171699999998054, 2.0982510000000048, 0.23331199999995533, 0.3367120000000341, 0.18857300000001942, 0.22771699999998418, 0.36383999999998196, 0.2500719999999319, 0.33536500000002434, 0.5049139999999852, 0.0017800000000534055, 0.2386900000000196, 0.3896989999999505, 0.16270300000007865, 5.211135000000013, 0.22361899999998514, 0.17212899999992715, 0.1858239999999114, 1.361674999999991, 0.21281499999997777, 1.8029099999999971, 0.6559100000000626, 0.2045899999999392, 0.1893720000000485, 0.26809000000002925, 0.18401700000003984, 0.20749799999998686, 0.20333000000005086, 0.19717500000001564, 0.2518370000000232, 0.17771000000004733, 0.004097000000001572, 0.20062699999994038, 0.016684999999938555, 0.3801069999999527, 0.12811999999996715, 0.23352599999998347, 0.23732299999994666, 0.17410899999993035, 1.1341130000000703, 0.15998000000001866, 0.16210699999999179, 0.17891899999995076, 0.3379569999999603, 0.26499699999999393, 0.01535799999999199, 0.314029000000005, 0.19228199999997742, 2.368088000000057, 0.2382149999999683, 2.0576879999999846, 1.0398030000000063, 0.37048200000003817, 0.2978219999999965, 0.8121879999999919, 0.40711000000010245, 0.9477319999999736, 0.2424389999999903, 0.4584310000000187, 0.07188800000005813, 0.19823200000007546, 0.4595449999999346, 0.2064699999999675, 0.24890899999991234, 0.31812999999999647, 0.7636250000000473, 0.20206900000005135, 0.028891999999927975, 0.18949299999997038, 0.27459399999997913, 0.2852930000000242, 0.3780209999999897, 0.18278799999995954, 0.22277599999995346, 0.5774390000000267, 0.23634100000003855, 0.9100349999999935, 0.26783899999998084, 0.1856520000000046, 0.1749169999999367, 4.234426999999982, 0.375171000000023, 0.4404510000000528, 0.30652699999996, 0.8563239999999723, 0.26012500000001637, 0.15538699999990513, 0.3218699999999899, 0.3836069999999836, 0.7139559999999392, 0.16673899999989317, 3.1698390000000245, 0.177866999999992, 0.773089999999911, 0.47497200000009343, 0.0037820000000010623, 0.37524600000006103, 4.157304999999951, 0.6040100000000166, 0.36641099999997095, 0.3943050000000312, 0.23496799999998075, 7.371562999999924, 0.28099299999996674, 0.23972500000002128, 0.41920299999992494, 0.26016200000003664, 0.2959040000000641, 0.0020480000000588916, 2.8170840000000226, 0.5177230000000463, 1.8271009999999706, 0.6777199999999084, 0.5227209999999332, 11.963899999999967, 1.501141999999959, 0.3560229999999365, 0.4501699999999573, 0.3957470000000285, 0.3981499999999869, 0.17331400000000485, 0.26129900000000816, 2.6427649999999403, 0.2815819999999576, 0.29509600000005776, 0.1560309999999845, 1.2763760000000275, 0.3734460000000581, 0.16770899999994526, 0.21281999999996515, 0.9043809999999439, 0.1593480000000227, 0.18587000000002263, 0.2203460000000632, 4.136911999999938, 0.48137499999995725, 0.7381710000000794, 0.2286619999999857, 1.283792999999946, 0.19774400000005699, 0.4337709999999788, 2.3513019999999187, 0.35244299999999384, 0.38877899999999954, 0.25251300000002175, 0.30437899999992624, 0.9129359999999451, 0.33933600000000297, 0.18143799999995736, 0.23576900000000478, 1.2049879999999575, 0.3232110000000148, 0.6946389999999383, 0.002425000000016553, 0.4352480000000014, 0.36690199999998185, 0.30720100000007733]
# nodes = [584, 137, 33, 106, 5, 25, 6, 4, 255, 15, 54, 455, 27, 332, 735, 55, 1233, 278, 33, 8, 4, 4, 6, 3, 5, 13, 159, 39, 3, 33, 39, 335, 57, 6, 779, 146, 9, 328, 9, 11, 47, 367, 6, 1592, 12, 11, 634, 42, 128, 3, 21, 7, 22, 3, 33, 248, 58, 10, 5, 13, 23, 6, 2, 305, 24, 615, 3, 54, 27, 51, 1, 71, 4, 222, 6, 191, 203, 5, 11, 33, 105, 5, 90, 65, 3, 10, 15, 256, 70, 1118, 31, 4, 23, 20, 12, 63, 42, 3, 7, 13, 28, 3, 61, 77, 18, 83, 22, 45, 7894, 128, 247, 18, 313, 6, 9, 299, 11, 303, 18, 4, 31, 32, 3, 65, 3, 15, 18, 16, 3, 6, 15, 69, 27, 129, 539, 2, 1939, 17, 3, 3, 37, 12, 193, 3, 14, 52, 21, 53, 421, 1, 6, 263, 535, 20, 5, 347, 676, 3, 53, 3, 3, 16, 4, 14, 121, 152, 10, 9, 12, 29, 11, 24, 14, 7, 34, 1, 14, 49, 397, 16, 3, 8, 178, 13, 18, 256, 472, 11, 3, 262, 3, 11, 103, 123, 4, 15, 3, 49, 8, 252, 16, 30, 10, 315, 12, 211, 12, 589, 47, 5, 210, 6, 4, 6, 33, 6, 174, 180, 5, 4, 29, 25, 48, 11, 1, 69, 6, 47, 3, 25, 14, 3, 6, 6, 9, 3, 3, 3, 13883, 8, 31, 20, 40, 9, 6, 29, 965, 4, 155, 6, 16, 6, 11, 656, 166, 238, 5, 20, 9, 35, 118, 47, 5, 2, 139, 17, 17, 49, 830, 3, 5, 12, 34, 39, 247, 9, 408, 14, 9, 52, 14, 7, 3, 2370, 3, 133, 6, 237, 6, 73, 6, 1373, 163, 9, 1, 11, 1, 13, 35, 14, 11, 96, 3, 73, 71, 21, 230, 35, 15, 13, 61, 260, 5, 249, 3, 55, 41, 18, 14, 9, 1, 94, 11, 22, 28, 1, 29, 95, 3, 3, 40, 27, 5, 106, 13, 41, 83, 25, 19, 5, 11, 1, 6, 14, 39, 36, 3, 51, 11, 6, 18, 3360, 43, 419, 5, 24, 60, 20, 70, 325, 6, 10, 6, 159, 19, 25, 12, 32, 5, 3, 4, 11, 8, 119, 1, 8, 3, 11, 77, 3, 10, 11, 11, 244, 8, 18, 29, 26, 19, 69, 3, 100, 21, 3, 45, 177, 10, 6, 25, 277, 1185, 19, 25, 3, 3, 10, 6, 6, 130, 71, 9, 81, 282, 4, 4, 15, 6, 126, 327, 5, 21, 23, 3, 7, 6, 116, 147, 14, 3, 19, 22, 65, 12, 30, 23, 85, 38, 6195, 349, 37, 276, 27, 3, 168]
# p1scores = [184, 236, 90, 177, 291, 288, 291, 159, 235, 211, 289, 325, 182, 0, 264, 136, 172, 180, 304, 191, 259, 316, 187, 194, 321, 219, 186, 190, 0, 171, 251, 287, 136, 192, 124, 0, 317, 216, 135, 161, 269, 183, 0, 155, 188, 271, 242, 260, 284, 223, 183, 215, 255, 239, 259, 167, 227, 243, 186, 246, 186, 0, 199, 216, 215, 180, 254, 189, 275, 179, 192, 134, 230, 186, 346, 208, 247, 312, 216, 173, 248, 137, 237, 201, 204, 299, 282, 150, 246, 256, 189, 140, 193, 255, 240, 0, 205, 217, 250, 301, 133, 214, 0, 284, 182, 202, 218, 168, 0, 302, 168, 201, 230, 196, 73, 327, 215, 173, 228, 275, 226, 128, 232, 228, 229, 282, 298, 192, 296, 214, 140, 285, 226, 249, 247, 256, 304, 0, 230, 279, 264, 222, 158, 321, 282, 200, 209, 199, 253, 343, 199, 223, 177, 239, 0, 244, 161, 0, 215, 236, 268, 211, 279, 180, 223, 308, 262, 140, 160, 207, 172, 211, 189, 236, 265, 104, 167, 288, 216, 281, 270, 256, 178, 240, 134, 261, 260, 180, 222, 0, 215, 203, 327, 251, 174, 256, 109, 235, 181, 214, 258, 215, 0, 297, 220, 149, 292, 241, 193, 178, 343, 271, 208, 195, 2, 299, 221, 192, 312, 343, 220, 190, 293, 257, 0, 154, 201, 166, 211, 165, 121, 262, 312, 229, 221, 296, 283, 294, 251, 200, 227, 210, 173, 151, 299, 165, 287, 126, 208, 158, 268, 120, 132, 205, 200, 225, 163, 193, 153, 245, 231, 150, 241, 264, 182, 261, 277, 216, 189, 261, 0, 294, 217, 262, 229, 203, 228, 233, 258, 185, 231, 163, 325, 164, 342, 184, 243, 223, 228, 170, 203, 230, 145, 242, 90, 287, 199, 288, 267, 222, 272, 240, 181, 0, 300, 0, 366, 286, 180, 161, 188, 203, 270, 181, 261, 151, 185, 214, 181, 186, 212, 221, 192, 270, 208, 270, 173, 222, 223, 193, 192, 190, 304, 187, 252, 0, 269, 297, 202, 239, 172, 0, 243, 193, 34, 225, 241, 251, 304, 265, 280, 225, 0, 315, 185, 196, 265, 232, 0, 221, 121, 176, 211, 132, 0, 218, 102, 198, 44, 233, 282, 169, 263, 242, 263, 254, 246, 241, 218, 224, 272, 297, 169, 306, 0, 347, 167, 261, 0, 296, 365, 183, 246, 195, 206, 202, 139, 279, 153, 211, 280, 155, 190, 203, 154, 216, 254, 190, 197, 218, 210, 187, 226, 234, 178, 228, 139, 192, 147, 246, 195, 251, 206, 209, 9, 291, 222, 61, 280, 228, 186, 180, 217, 195, 201, 174, 207, 198, 282, 198, 246, 169, 225, 190, 188, 184, 261, 215, 206, 148, 217, 253, 290, 316, 233, 243, 147, 189, 171, 184, 233, 200, 170, 180, 123, 257, 232, 247, 358, 202, 145, 0, 224, 0, 211, 257, 271, 216, 262, 200, 192, 244, 241, 286, 364, 213, 245, 195, 213, 220, 173, 201, 331, 164, 223, 271, 195, 266, 206, 130]
# p2scores = [222, 201, 56, 162, 279, 200, 212, 309, 234, 203, 169, 255, 147, 0, 237, 187, 287, 282, 225, 363, 251, 177, 185, 243, 210, 255, 217, 151, 0, 193, 216, 218, 194, 212, 57, 0, 208, 174, 229, 246, 242, 212, 0, 210, 257, 218, 222, 218, 257, 123, 216, 195, 199, 188, 279, 191, 188, 260, 295, 265, 223, 0, 190, 203, 178, 162, 229, 283, 260, 252, 134, 226, 217, 293, 190, 176, 178, 267, 297, 265, 202, 85, 178, 254, 183, 273, 242, 200, 197, 238, 203, 71, 169, 207, 232, 0, 153, 173, 276, 210, 305, 216, 0, 225, 283, 168, 279, 188, 0, 235, 338, 261, 205, 395, 131, 210, 181, 205, 299, 258, 217, 208, 303, 193, 173, 255, 178, 182, 215, 212, 276, 180, 258, 225, 213, 194, 209, 0, 213, 194, 243, 272, 212, 256, 292, 249, 207, 213, 236, 198, 216, 310, 241, 147, 0, 282, 258, 0, 229, 238, 287, 203, 187, 245, 285, 267, 223, 274, 321, 241, 171, 270, 169, 315, 289, 212, 294, 230, 259, 195, 173, 276, 184, 205, 225, 203, 349, 255, 76, 0, 313, 174, 190, 235, 184, 268, 129, 244, 261, 246, 230, 172, 0, 161, 323, 181, 188, 192, 251, 194, 236, 193, 258, 135, 11, 206, 285, 289, 206, 214, 270, 236, 221, 206, 0, 254, 215, 253, 184, 144, 151, 159, 200, 232, 204, 222, 228, 267, 204, 188, 292, 221, 240, 195, 205, 150, 164, 216, 167, 196, 223, 224, 205, 202, 160, 257, 211, 259, 139, 253, 199, 241, 268, 188, 225, 201, 193, 181, 211, 211, 0, 203, 217, 197, 178, 281, 242, 169, 211, 168, 155, 246, 166, 313, 195, 254, 191, 218, 224, 189, 168, 201, 178, 207, 70, 179, 142, 241, 226, 212, 254, 243, 298, 0, 118, 0, 211, 223, 194, 214, 270, 212, 213, 328, 268, 227, 177, 292, 245, 197, 229, 226, 219, 162, 281, 167, 269, 225, 234, 243, 225, 198, 196, 272, 170, 0, 207, 263, 221, 205, 240, 0, 304, 174, 50, 281, 196, 206, 204, 183, 175, 192, 0, 221, 258, 172, 212, 237, 0, 215, 223, 206, 232, 315, 0, 285, 161, 208, 72, 247, 305, 260, 314, 174, 152, 182, 225, 201, 186, 168, 262, 158, 219, 197, 0, 165, 300, 221, 0, 180, 213, 257, 278, 163, 166, 230, 214, 182, 207, 246, 186, 215, 233, 281, 184, 329, 325, 280, 240, 207, 246, 260, 198, 217, 185, 287, 248, 213, 173, 198, 241, 160, 179, 243, 14, 225, 257, 88, 203, 299, 262, 199, 263, 340, 195, 166, 268, 274, 228, 177, 243, 160, 245, 213, 232, 113, 210, 241, 251, 208, 219, 242, 259, 211, 163, 206, 200, 259, 196, 217, 312, 150, 336, 224, 164, 170, 156, 265, 182, 240, 278, 0, 198, 0, 175, 208, 173, 172, 267, 241, 281, 261, 234, 196, 174, 139, 188, 252, 142, 263, 304, 292, 209, 142, 172, 296, 249, 137, 188, 282]
# p1endgamescores= [184, 174, None, 177, 266, 267, 273, 146, 190, 171, 280, 303, None, None, 252, 136, 161, 172, 234, 178, 179, 256, 187, 182, 283, 219, 186, 190, None, 171, 204, 201, None, 192, None, None, 317, 216, 135, 149, 217, 183, None, 155, 126, 254, 212, 178, 267, 223, 183, 215, 248, 173, 180, 167, 164, 176, 186, 207, 167, None, 199, 205, 215, 180, 232, 174, 213, 173, 192, 134, 210, 147, 281, 149, 223, 272, 216, 146, 197, None, 237, 153, 204, 253, 282, 150, 231, 244, 189, None, None, 233, 173, None, 205, 169, 236, 258, 133, 214, None, 258, 172, 202, 185, 168, None, 250, 157, 174, 230, 181, None, 253, 204, 173, 224, 232, 219, 128, 221, 183, 229, 235, 298, 180, 238, 214, None, 285, 150, 249, 239, 179, 258, None, 163, 189, 214, 172, 127, 277, 240, 200, 206, 181, 193, 293, 199, 178, 172, 239, None, 182, 135, None, 215, 219, 203, 173, 279, 157, 205, 234, 198, 135, 145, 207, 172, 211, 189, 223, 182, None, 167, 244, 210, 219, 206, 189, 170, 197, 134, 211, 212, 180, None, None, 160, None, 274, 241, 167, 186, None, 224, 181, 171, 215, 215, None, 242, 213, 149, 240, 235, 182, 167, 301, 265, 185, 195, None, 242, 206, 185, 235, 299, 136, 153, 293, 257, None, 146, 153, 148, 211, 165, None, 221, 237, 207, 166, 239, 260, 252, 171, 200, 166, 152, 152, 129, 299, None, 241, 126, 208, 158, 213, 120, 132, 205, 190, 185, 150, 134, 153, 166, 192, 143, 198, 264, 174, 261, 227, 216, 189, 208, None, 249, 217, 181, 229, 182, 219, 233, 203, 185, 231, 149, 258, 147, 301, 184, 192, 206, 191, 163, 186, 230, 145, 242, None, 199, 199, 223, 214, 183, 214, 228, 175, None, 300, None, 335, 241, 180, 161, 165, 203, 217, 163, 172, 151, 185, 178, 157, 186, 212, 192, 192, 254, 186, 218, 165, 156, 203, 193, 178, 190, 304, 129, 252, None, 269, 285, 202, 233, 158, None, 202, 193, None, 214, 180, 171, 266, 216, 280, 225, None, 253, 179, 196, 224, 161, None, 206, 121, 176, 157, 132, None, 207, None, 127, None, 200, 194, 169, 260, 200, 205, 212, 179, 185, 218, 224, 217, 212, 169, 253, None, 281, 157, 249, None, 296, 311, 183, 153, 182, 165, 202, 139, 240, 153, 176, 194, 155, 190, 197, 154, 201, 214, 170, 169, 218, 196, 167, 210, 185, 178, 187, 129, 192, 147, 239, 189, 181, 206, 209, None, 235, 172, None, 216, 174, 162, 164, 217, 147, 152, 174, 168, 186, 183, 198, 189, None, 169, 143, 188, 184, 206, 215, 206, 145, 151, 253, 262, 249, 181, 243, 147, 135, 171, 178, 203, 200, 170, 180, 123, 196, 184, 186, 307, 147, 137, None, 164, None, 199, 233, 217, 216, 244, 190, 144, 187, 167, 239, 310, 202, 209, 195, 213, 178, 160, 143, 302, None, 223, 250, 184, 248, 164, 130]
# p2endgamescores = [222, 184, None, 162, 236, 135, 150, 240, 195, 175, 155, 151, None, None, 149, 187, 220, 230, 207, 310, 213, 143, 185, 176, 156, 181, 210, 138, None, 193, 186, 205, None, 189, None, None, 190, 174, 213, 205, 202, 212, None, 210, 239, 161, 151, 193, 184, 123, 165, 195, 154, 172, 279, 158, 174, 215, 275, 238, 209, None, 190, 177, 157, 162, 181, 227, 233, 196, 134, 226, 147, 185, 174, 162, 168, 251, 297, 216, 158, None, 151, 176, 183, 257, 209, 200, 192, 188, 203, None, None, 164, 182, None, 153, 149, 230, 171, 283, 216, None, 206, 226, 168, 236, 149, None, 210, 275, 183, 191, 338, None, 186, 147, 205, 264, 231, 190, 208, 209, 168, 173, 193, 178, 161, 188, 196, None, 180, 165, 209, 153, 186, 187, None, 186, 165, 222, 241, 151, 196, 233, 228, 182, 150, 204, 185, 199, 261, 204, 135, None, 243, 211, None, 210, 174, 270, 183, 180, 199, 237, 241, 223, 243, 264, 221, 166, 246, 169, 243, 270, None, 294, 187, 174, 180, 153, 239, 156, 145, 225, 197, 328, 255, None, None, 286, None, 168, 150, 160, 225, None, 201, 261, 229, 214, 155, None, 140, 277, 173, 165, 120, 242, 175, 221, 138, 170, 135, None, 180, 202, 236, 181, 193, 263, 206, 172, 206, None, 184, 173, 209, 178, 144, None, 133, 179, 203, 183, 203, 170, 211, 184, 159, 273, 170, 171, 174, 184, None, 148, 216, 143, 196, 207, 224, 190, 178, 152, 213, 141, 204, 137, 221, 163, 226, 225, 188, 207, 189, 193, 174, 199, 211, None, 189, 205, 171, 161, 238, 168, 154, 158, 156, 155, 204, 143, 236, 179, 226, 173, 168, 204, 142, 151, 174, 178, 196, None, 168, 142, 226, 193, 196, 230, 237, 227, None, 118, None, 154, 193, 194, 190, 225, 212, 207, 231, 252, 227, 177, 208, 181, 197, 208, 137, 219, 145, 234, 150, 211, 212, 180, 243, 172, 180, 154, 249, 159, None, 175, 190, 221, 152, 193, None, 235, 138, None, 192, 178, 145, 177, 144, 175, 192, None, 165, 245, 172, 155, 212, None, 193, 223, 206, 212, 299, None, 198, None, 197, None, 173, 292, 255, 239, 174, 152, 156, 169, 196, 176, 168, 255, 155, 219, 194, None, 144, 259, 146, None, 163, 170, 257, 260, 143, 152, 230, 214, 127, 183, 194, 150, 215, 217, 194, 184, 229, 272, 237, 212, 207, 196, 244, 171, 191, 185, 263, 201, 213, 173, 141, 176, 116, 141, 182, None, 209, 230, None, 184, 299, 216, 152, 263, 277, 177, 166, 226, 262, 197, 177, 207, None, 210, 168, 194, 113, 189, 226, 226, 176, 169, 185, 204, 171, 153, 164, 200, 245, 159, 202, 227, 150, 287, 224, 164, 151, 141, 246, 154, 208, 234, None, 183, None, 150, 200, 151, 172, 188, 201, 193, 194, 201, 180, 151, 127, 149, 252, 142, 210, 223, 273, 160, None, 172, 283, 198, 135, 165, 282]
# times =[0.2743589999999999, 5.318681, 0.07979300000000045, 1.5507600000000004, 0.5014630000000011, 1.1186679999999996, 0.27624600000000044, 0.34914800000000135, 0.20126000000000133, 0.19063099999999977, 2.79533, 0.3795719999999996, 0.11689600000000056, 0.0023640000000000327, 0.6355559999999993, 4.5787379999999995, 0.3549609999999994, 3.3291059999999995, 6.6117750000000015, 0.6707800000000006, 11.804835, 3.248521999999994, 0.5565570000000051, 0.26883400000000535, 0.20992000000000388, 0.2048680000000047, 0.21727899999999778, 0.20856299999999806, 0.0026269999999968263, 0.20617599999999925, 0.2120870000000039, 0.33939900000000023, 0.17759799999999615, 1.487210999999995, 0.0785849999999968, 0.002582000000003859, 0.6452020000000047, 0.1866330000000005, 0.47352700000000425, 0.5345780000000033, 3.126418000000001, 0.7590050000000019, 0.0023320000000026653, 0.26359099999999813, 7.4764960000000045, 1.4632659999999973, 0.2262970000000024, 4.835604999999987, 0.27355199999999513, 0.30192799999998954, 0.5614940000000104, 4.153507000000005, 0.25050199999999734, 13.877615999999989, 0.30518599999999196, 0.27388400000000956, 6.8312329999999974, 0.6253849999999943, 1.385463999999999, 0.2206780000000066, 0.39123200000000224, 0.0026289999999988822, 0.2288730000000072, 0.37665399999998783, 0.25503500000000656, 0.5221849999999932, 2.5710949999999997, 0.7062860000000057, 0.30631700000000706, 0.2537200000000013, 0.27305599999999686, 0.36915000000000475, 0.19596199999999442, 0.1919990000000098, 3.1551429999999954, 0.716202999999993, 5.582977999999997, 0.17267300000000319, 0.7769669999999991, 0.37520699999998897, 0.5890309999999914, 0.12458099999999206, 0.15832800000001157, 0.8142780000000016, 0.18010799999998994, 2.2336070000000063, 0.2858439999999973, 2.0616249999999923, 2.2583609999999936, 0.21343000000000245, 0.29611099999999624, 0.07873299999999972, 0.10656600000000083, 0.5221829999999983, 1.1246090000000066, 0.0034959999999983893, 0.19683299999999804, 0.9667299999999841, 0.6986190000000079, 0.23166599999998994, 0.28642899999999827, 0.2941720000000032, 0.0021700000000066666, 3.1485469999999793, 0.7726910000000089, 10.74784600000001, 0.47506500000000074, 0.2107340000000022, 0.004694000000000642, 0.4216910000000098, 0.384254999999996, 0.9270379999999818, 0.8823179999999979, 0.6307809999999847, 0.07757700000001932, 0.25545099999999366, 0.23527200000000903, 0.27938999999997804, 0.5966109999999958, 0.23215700000000083, 0.7871729999999957, 0.9395379999999989, 0.31039200000000733, 0.8570550000000026, 0.3962099999999964, 0.6121700000000203, 74.240038, 1.2719389999999748, 2.398614999999978, 0.4113229999999817, 0.130693999999977, 0.16336599999999635, 3.3271819999999934, 0.21936999999999784, 0.2399300000000153, 3.271817999999996, 0.3502979999999809, 0.0021349999999813463, 2.8564560000000085, 0.4366709999999898, 0.21518299999999613, 0.47966900000000123, 0.511070999999987, 0.21172500000000127, 0.7042129999999815, 0.22021899999998595, 0.3094350000000077, 0.35768600000000106, 0.3170769999999834, 0.20976599999997347, 0.2586960000000147, 0.3194780000000037, 0.7840920000000153, 0.4228789999999947, 0.0018149999999934607, 1.4951489999999978, 4.571793999999983, 0.0028519999999900847, 0.19428400000001034, 16.458572000000004, 0.36880500000000893, 0.2092370000000301, 0.17441700000000537, 0.5177160000000072, 0.3180580000000077, 1.9738370000000032, 0.14592999999996437, 0.3311919999999873, 0.5329450000000406, 0.3922040000000493, 0.7291119999999864, 3.838661000000002, 0.18346299999996063, 0.30108599999999797, 2.617703000000006, 0.11662799999999152, 5.350319999999954, 0.4023660000000291, 0.20773600000001124, 3.0374439999999936, 6.259878000000015, 0.20349399999997786, 0.7443569999999795, 0.20455600000002505, 0.20005799999995588, 0.33098400000000083, 0.28242800000003854, 0.1911269999999945, 0.16996500000004744, 0.00200700000004872, 0.35800599999998894, 0.1151039999999739, 1.2366170000000238, 1.463862000000006, 0.24819899999999961, 0.28080200000005107, 0.1446510000000103, 0.2656059999999911, 0.49560800000000427, 0.3013970000000086, 0.41183500000005324, 0.32828000000000657, 0.0023799999999596366, 0.18572399999999334, 0.4779570000000035, 0.16291100000000824, 0.3611760000000004, 0.48043000000001257, 3.6279910000000086, 0.34387399999997115, 0.21615400000001728, 0.2522140000000377, 1.64122100000003, 0.3578430000000026, 0.012416999999970812, 0.3818390000000136, 2.794548999999961, 4.532386000000031, 0.25787900000000263, 0.28167300000001205, 3.2173520000000053, 0.16719399999999496, 0.26954000000000633, 1.2589529999999627, 0.0030679999999847496, 1.2137920000000122, 0.18453900000002932, 0.26699800000000096, 0.1593520000000126, 0.6906700000000114, 0.11297799999999825, 0.23153299999995625, 2.6802209999999604, 0.332396000000017, 0.4681940000000395, 0.3165329999999926, 3.07279299999999, 0.24047500000000355, 2.0580280000000357, 0.3123619999999505, 5.243685999999968, 0.7146920000000136, 0.21976000000000795, 3.076519000000019, 0.25107799999994995, 0.12842000000000553, 0.24390399999998635, 0.22460699999999179, 0.4590610000000197, 0.2646139999999946, 1.7169870000000174, 1.5391970000000015, 0.1926499999999578, 0.18852800000001935, 0.42942499999998063, 0.46656999999999016, 0.5425439999999639, 0.2884779999999978, 0.16632099999998218, 0.7489209999999957, 0.25986500000004753, 0.6344950000000154, 0.17514399999998886, 0.3713470000000143, 0.43203099999999495, 0.22101200000003018, 0.24162699999999404, 0.28059899999999516, 0.26426200000003064, 0.18813199999999597, 0.002047000000004573, 0.22939300000001595, 0.22065400000002455, 112.07626800000003, 0.25548199999997223, 0.5102570000000242, 0.3294389999999794, 0.48925700000000916, 0.2741060000000175, 0.22553599999997687, 0.4796089999999822, 9.269835999999998, 0.21005400000001373, 1.567997000000048, 0.24786600000004455, 0.37319400000001224, 0.2031189999999583, 0.29812600000002476, 6.961295000000007, 1.6417099999999891, 2.217209999999966, 0.22646800000001122, 0.34776600000003555, 0.27075999999999567, 0.04555599999997639, 0.559359000000029, 1.4431720000000041, 0.6163859999999772, 0.1976860000000329, 0.1663120000000049, 1.4424380000000383, 0.4179849999999874, 0.3047669999999698, 0.0022060000000010405, 0.6744509999999764, 0.0025359999999636784, 7.280429999999967, 0.19869099999993978, 0.2118520000000217, 0.3106629999999768, 0.4921759999999722, 0.5397970000000214, 2.563126000000011, 0.23918699999990167, 4.168202999999949, 0.25603000000000975, 0.25373100000001614, 0.5347769999999628, 0.4362109999999575, 0.248826999999892, 0.2005619999999908, 20.58092499999998, 0.16772800000001098, 1.2809089999999514, 0.23856100000000424, 2.6518559999999525, 0.2241759999999431, 0.807495999999901, 0.25628199999994195, 15.08129299999996, 1.718539000000078, 0.2800760000000082, 0.15305699999998978, 0.24920399999996334, 0.19556299999999283, 0.002608999999893058, 0.3430789999999888, 0.5016770000000861, 0.27557999999999083, 0.24524400000007063, 1.1488299999999754, 0.001960999999937485, 0.18066000000010263, 1.0189860000000408, 0.046310999999946034, 0.8147239999999556, 0.4319380000000592, 2.463842999999997, 0.5028310000000147, 0.28361099999995076, 0.3403039999999464, 0.7582350000000133, 0.002641999999923428, 2.6517499999999927, 0.20867100000009486, 2.8328109999999924, 0.21719999999993433, 0.8316340000000082, 0.004023999999958505, 0.862070000000017, 0.3754100000001017, 0.3171740000000227, 0.28037300000005416, 0.15669800000000578, 0.0025540000000319196, 1.0522500000000719, 0.13599099999998998, 0.3395850000000564, 0.03323299999999563, 0.3468769999999495, 0.5886510000000271, 0.15522699999996803, 0.4459910000000491, 0.9823129999999765, 0.16250299999990148, 0.2060279999999466, 1.0837969999998904, 0.4193809999999303, 0.26057700000001205, 1.1498530000000073, 0.2932789999999841, 0.5540510000000722, 1.00759400000004, 0.5449180000000524, 0.001852999999982785, 0.3948650000000953, 0.19931499999995594, 0.24875999999994747, 0.0020850000000791624, 0.19165899999995872, 0.2945310000000063, 0.2972780000000057, 0.5189850000000433, 0.6321240000000898, 0.20359499999995023, 0.7282339999999294, 0.2336639999999761, 0.22433399999999892, 0.3277249999999867, 25.414679999999976, 1.1345509999999877, 3.627480999999989, 0.17990399999996498, 0.3493879999999763, 0.8598930000000564, 0.4006809999999632, 0.7420379999999795, 3.5034540000000334, 0.34112900000002355, 0.2840160000000651, 0.3063030000000708, 1.7751930000000584, 0.33825100000001385, 0.4618129999998928, 0.3032819999999674, 0.4490490000000591, 0.1971369999999979, 0.18943799999999555, 0.1644260000000486, 0.2644780000000537, 0.25672099999997045, 1.1970969999999852, 0.17178499999999985, 0.18757900000002792, 0.011530999999990854, 0.18386999999995624, 0.2971830000000182, 0.061786000000097374, 0.8652479999999514, 0.18300199999998767, 0.23523599999998623, 0.2565879999999652, 0.28473799999994753, 2.536852000000067, 0.25889299999994364, 0.37905799999998635, 0.38067899999998644, 0.481068999999934, 0.32650599999999486, 0.8703060000000278, 0.2168890000000374, 0.1374399999999696, 1.190992999999935, 0.3806890000000749, 0.23123199999997723, 0.6082290000000512, 1.8757859999999482, 0.3063209999999117, 0.28667799999993804, 0.3929840000000695, 2.716554999999971, 0.18356700000003912, 9.648217000000045, 0.3845440000000053, 0.46393799999998464, 0.17559099999994032, 0.1838070000000016, 0.29988399999990634, 0.20619599999997718, 0.24680100000000493, 1.222122000000013, 0.9158440000001065, 0.15998100000001614, 0.24987899999996444, 0.8780479999999216, 2.5886379999999463, 0.1621099999999842, 0.20714399999997113, 0.3633859999999913, 0.2887719999999945, 1.257669000000078, 0.002312999999958265, 3.205654999999979, 0.002686000000039712, 0.1995879999999488, 0.4251120000000128, 0.4229799999999386, 0.18300399999998263, 0.1944580000000542, 0.21475999999995565, 1.0064419999999927, 1.523727000000008, 0.35039299999994, 0.21240199999999732, 0.36000000000001364, 0.3293019999999842, 0.5997019999999793, 0.34401500000001306, 0.45804899999995996, 0.3713300000000572, 0.9313150000000405, 0.49069199999996727, 46.48023999999998, 0.09830699999997705, 3.6500310000000127, 0.5836429999999382, 2.2442889999999807, 0.5207999999998947, 0.22033799999996972, 2.03454099999999]
""""""""""""""""" Data for evaluation functions """""""""""""""
# Rack Eval Depth 4
# p1scores =[146, 184, 274, 288, 0, 222, 223, 304, 157, 347, 0, 300, 173, 201, 182, 222, 170, 160, 189, 230, 223, 181, 117, 247, 221, 229, 284, 169, 268, 241, 0, 235, 215, 178, 197, 222, 145, 197, 215, 258, 0, 216, 0, 194, 213, 241, 196, 217, 272, 177, 288, 269, 232, 0, 277, 212, 336, 201, 249, 144, 321, 121, 236, 265, 191, 192, 222, 204, 242, 197, 317, 0, 220, 144, 182, 225, 178, 248, 272, 221, 116, 7, 219, 148, 220, 226, 166, 280, 236, 215, 263, 236, 250, 154, 227, 260, 296, 226, 219, 216]
# p2scores =[212, 230, 180, 226, 0, 231, 220, 316, 233, 206, 0, 146, 239, 207, 180, 173, 191, 159, 233, 175, 228, 211, 165, 178, 196, 243, 221, 218, 258, 235, 0, 291, 151, 228, 185, 179, 219, 286, 203, 231, 0, 194, 0, 213, 233, 202, 232, 309, 155, 161, 245, 213, 205, 0, 272, 305, 169, 217, 201, 136, 178, 190, 221, 195, 244, 236, 178, 238, 238, 284, 189, 0, 239, 193, 180, 189, 304, 250, 221, 212, 147, 16, 198, 255, 299, 237, 313, 206, 258, 243, 201, 242, 263, 218, 206, 255, 172, 290, 300, 176]
# p1endgamescores= [146, 141, 232, 229, None, 217, 178, 291, 157, 269, None, 257, 161, 201, 182, 171, 170, 160, 180, 187, 161, 158, None, 244, 204, 181, 230, 169, 218, 183, None, 198, None, 178, 150, 181, 135, 197, 209, 200, None, 216, None, 194, 193, 192, 190, 164, 272, 177, 214, 257, 184, None, 249, 195, 267, 183, 186, 141, 259, None, 172, 207, 191, 176, 172, 139, 171, 178, 267, None, 178, 144, 125, 157, 146, 200, 219, 221, None, None, 173, 148, 207, 215, 137, 205, 193, 170, 218, 177, 218, 154, 168, 185, 252, 182, 211, 190]
# p2endgamescores =[168, 200, 168, 184, None, 171, 216, 242, 214, 183, None, 133, 217, 195, 180, 169, 191, 137, 171, 151, 220, 151, None, 178, 185, 220, 193, 197, 215, 221, None, 252, None, 191, 154, 146, 134, 230, 172, 214, None, 177, None, 213, 182, 179, 205, 289, 123, 161, 224, 152, 182, None, 204, 240, 155, 202, 176, 136, 147, None, 213, 165, 244, 183, 157, 228, 223, 211, 153, None, 215, 165, 157, 173, 222, 175, 200, 190, None, None, 171, 255, 259, 170, 239, 187, 208, 196, 173, 242, 192, 218, 195, 249, 156, 211, 284, 169]
# times =[0.3045979999999999, 0.31411900000000004, 1.028207, 0.7278799999999999, 0.002391000000000254, 0.8223549999999995, 0.5361419999999999, 0.30885799999999985, 0.4713649999999996, 8.040690000000001, 0.0017460000000006914, 4.453520000000001, 3.8119639999999997, 0.15258000000000038, 2.6539730000000006, 4.876311000000001, 1.587686999999999, 0.22876500000000277, 0.37653800000000004, 1.014126000000001, 15.079270000000001, 2.490597000000001, 0.09578199999999981, 0.58981, 5.331534000000005, 14.039788000000009, 0.8188509999999951, 0.9263629999999949, 1.0293779999999941, 30.377004, 0.0019709999999975025, 0.21263400000000843, 0.13112600000000896, 0.6971180000000032, 1.796717000000001, 0.29961399999999117, 0.2729439999999954, 0.17386500000000638, 1.2968099999999936, 21.760698000000005, 0.002534999999994625, 0.3060159999999996, 0.002262999999999238, 4.769763999999981, 13.430371000000008, 7.867820000000023, 0.4319200000000194, 10.286172999999991, 0.5875459999999748, 0.8725009999999997, 17.543420999999995, 0.3250749999999982, 0.3641499999999951, 0.003634000000005244, 14.963843999999995, 2.745355999999987, 4.397753000000023, 1.3617279999999994, 5.664902999999981, 0.8148960000000045, 6.911541, 0.1422369999999944, 34.491161999999974, 1.352770000000021, 0.2054809999999634, 1.0123800000000074, 0.3612370000000169, 1.0711959999999863, 12.283149999999978, 0.9499319999999898, 0.8136440000000107, 0.0021970000000237633, 0.24760899999995445, 0.20240000000001146, 10.06759199999999, 17.460323999999957, 7.640714000000003, 0.28121299999997973, 5.4325359999999705, 1.2148369999999886, 0.07670100000001412, 0.013754000000005817, 0.3093770000000404, 0.8976590000000328, 0.6152389999999741, 0.2235469999999964, 8.328934000000004, 5.629072000000008, 7.482176999999979, 1.0071859999999901, 0.3191290000000322, 1.495381000000009, 1.3220549999999776, 3.6810449999999832, 3.060097999999982, 27.271862, 0.2244190000000117, 0.594159999999988, 1.149567999999988, 15.241562999999985]
# 2x Eval Function Depth 4
# p1scores= [202, 223, 274, 184, 263, 204, 215, 187, 133, 205, 278, 296, 241, 192, 181, 31, 161, 250, 159, 325, 347, 295, 329, 174, 254, 263, 266, 189, 341, 288, 163, 204, 201, 228, 207, 301, 186, 150, 166, 0, 0, 210, 212, 219, 161, 139, 269, 253, 73, 271, 237, 243, 226, 293, 157, 268, 215, 150, 223, 184, 239, 248, 121, 253, 0, 225, 297, 289, 182, 219, 190, 116, 212, 0, 265, 175, 307, 257, 215, 0, 334, 224, 182, 202, 149, 246, 150, 190, 268, 177, 201, 259, 203, 246, 166, 253, 241, 233, 171, 187]
# p2scores= [163, 261, 187, 200, 144, 141, 188, 224, 266, 270, 219, 179, 310, 287, 241, 34, 164, 185, 249, 188, 210, 270, 223, 250, 203, 260, 291, 273, 200, 206, 323, 194, 227, 238, 206, 181, 337, 237, 259, 0, 0, 221, 168, 272, 325, 133, 230, 219, 72, 211, 175, 281, 236, 181, 319, 228, 219, 240, 222, 204, 267, 222, 242, 246, 0, 241, 146, 225, 210, 178, 205, 207, 260, 0, 236, 173, 175, 253, 250, 0, 203, 220, 359, 327, 280, 184, 232, 236, 163, 154, 210, 184, 173, 221, 242, 195, 218, 275, 222, 175]
# p1endgamescores =[202, 209, 226, 184, 263, 204, 163, 187, 128, 192, 229, 220, 208, 184, 181, None, 135, 188, 128, 311, 302, 213, 257, 150, 187, 182, 174, 175, 286, 262, 138, 204, 201, 228, 201, 240, 156, 138, 154, None, None, 189, 191, 197, 143, None, 228, 246, None, 200, 228, 228, 176, 252, 157, 220, 204, 150, 166, 137, 190, 178, 121, 243, None, 164, 229, 197, 182, 203, 190, 116, 196, None, 199, 175, 254, 225, 139, None, 253, 224, 125, 172, 149, 192, 150, 190, 238, 172, 185, 193, 201, 202, 144, 192, 179, 220, 171, 187]
# p2endgamescores = [163, 201, 187, 177, 144, 141, 158, 196, 254, 190, 184, 152, 268, 239, 224, None, 154, 161, 196, 171, 189, 253, 173, 227, 185, 254, 267, 205, 173, 162, 258, 194, 227, 206, 177, 178, 297, 229, 195, None, None, 141, 126, 228, 288, None, 199, 185, None, 198, 155, 193, 209, 154, 304, 194, 159, 183, 222, 188, 238, 204, 242, 183, None, 233, 134, 198, 210, 138, 205, 207, 200, None, 199, 173, 158, 206, 221, None, 188, 220, 339, 288, 260, 146, 232, 236, 151, 106, 161, 153, 161, 209, 188, 160, 198, 206, 222, 152]
# times = [1.6513579999999999, 0.6924669999999997, 1.2346110000000001, 0.44587600000000016, 0.2932700000000006, 0.21223100000000006, 2.0563260000000003, 0.3351480000000002, 0.4891210000000008, 1.4405210000000004, 0.2486669999999993, 1.874815, 1.0169619999999995, 0.8398979999999998, 0.526726, 0.03356199999999987, 2.181731000000001, 1.1180710000000005, 1.1629669999999983, 10.324406, 41.16270399999999, 14.29225000000001, 2.9749949999999927, 3.5038200000000046, 13.185907999999998, 1.687308999999999, 17.269787000000008, 0.6310780000000022, 0.33241999999999905, 1.520972999999998, 1.9234519999999975, 2.1628419999999977, 0.2926080000000013, 0.3611009999999908, 0.35834699999998065, 9.21249400000002, 1.1236370000000022, 1.434044, 0.9033249999999953, 0.002450999999979331, 0.0024689999999907286, 2.669511, 1.0052470000000255, 0.4205469999999991, 0.5798229999999762, 0.1314869999999928, 1.144127999999995, 1.239783000000017, 0.06410700000000702, 0.3739930000000129, 12.927264000000008, 1.9154200000000117, 1.834779999999995, 0.47640100000000984, 0.36341600000000085, 0.4595600000000104, 0.3548640000000205, 0.26604800000001205, 13.487632999999988, 10.89629099999999, 1.0695749999999862, 34.55716100000001, 0.8232450000000142, 0.3374949999999899, 0.002517000000011649, 13.29813900000002, 4.015976999999992, 1.9313290000000052, 10.20299399999999, 0.31741999999997006, 0.3866659999999911, 0.40405199999997876, 0.3988350000000196, 0.0027299999999854663, 0.47522499999996626, 0.7034429999999929, 1.440870000000018, 2.0513310000000047, 5.061823000000004, 0.001909000000011929, 17.014077000000043, 0.5752730000000383, 5.345965000000035, 0.9250749999999925, 0.20375300000000607, 0.3181369999999788, 0.5623110000000224, 1.655349000000001, 5.229088000000047, 1.2716040000000248, 1.0718870000000038, 1.7607150000000047, 0.3929019999999923, 0.7842210000000023, 27.87901800000003, 4.229108999999994, 9.242232999999999, 0.567216999999971, 1.0133329999999887, 0.3096429999999941]
#Baseline Eval Depth 4
# nodes = [52, 288, 52, 249, 966, 77, 34, 18, 111, 26, 41, 197, 34, 84, 4303, 108, 580, 27, 1, 36, 6, 515, 915, 266, 37, 2, 108, 594, 126, 803, 4793, 365, 1045, 100, 17, 403, 8, 35, 45, 5, 225, 113, 10, 111, 92, 49, 17, 3275, 175, 16, 1156, 214, 169, 25, 3, 507, 1970, 163, 234, 1, 205, 149, 55, 87, 986, 2, 176, 202, 3, 8, 77, 10, 1236, 1, 311, 262, 2700, 3879, 22, 77, 462, 472, 63, 59, 212, 3, 1683, 591, 1113, 3615, 2494] + [43, 8, 38, 30, 4, 64, 487, 506, 1472, 87, 13, 88, 5273, 50, 725, 63, 269, 33, 77, 64, 13, 93, 1293, 2, 106, 21, 154, 33, 33, 6, 3622, 11, 3483, 67, 657, 159, 276, 167, 231, 958, 50, 71, 200, 236, 1754, 1371, 8, 6, 82, 23, 89, 108, 248, 589, 3, 46, 2188, 41, 7, 418, 82, 326, 307, 23, 19, 61, 1318, 83, 1364, 505, 634, 43, 295, 218, 41, 79, 371, 213, 607, 37, 39, 636, 1507, 25, 109, 571, 1236, 1144, 719, 23, 581, 2407, 10, 697, 58, 171, 135, 905, 56]
# p1scores =[292, 202, 285, 193, 238, 152, 255, 227, 209, 192, 143, 196, 231, 182, 220, 215, 305, 237, 213, 308, 279, 206, 280, 202, 312, 196, 269, 179, 142, 202, 277, 221, 326, 229, 272, 248, 267, 278, 232, 202, 154, 347, 267, 260, 293, 347, 156, 184, 258, 190, 214, 179, 195, 261, 238, 212, 201, 246, 215, 215, 180, 227, 209, 207, 188, 200, 218, 133, 245, 292, 272, 149, 147, 229, 175, 187, 165, 238, 159, 214, 267, 208, 269, 241, 213, 273, 215, 233, 224, 156, 289, 369, 157, 262, 261, 307, 193, 0, 291, 199] + [182, 169, 192, 207, 199, 200, 224, 217, 223, 0, 157, 237, 216, 214, 168, 266, 149, 209, 192, 193, 148, 223, 279, 248, 228, 218, 233, 210, 199, 241, 292, 0, 202, 214, 249, 213, 218, 0, 268, 169, 186, 179, 150, 261, 255, 220, 0, 274, 265, 294, 230, 151, 188, 288, 268, 238, 239, 265, 207, 160, 293, 225, 254, 199, 11, 257, 261, 193, 264, 0, 251, 166, 213, 146, 189, 185, 278, 223, 199, 197, 276, 188, 234, 216, 257, 246, 237, 225, 169, 177, 253, 280, 160, 164, 239, 0, 388, 239, 226, 186]
# p2scores =[159, 255, 300, 211, 183, 199, 214, 194, 294, 224, 197, 259, 196, 321, 229, 250, 200, 147, 281, 179, 182, 238, 152, 254, 151, 269, 214, 206, 176, 172, 205, 218, 287, 227, 246, 217, 197, 233, 222, 197, 263, 259, 267, 241, 173, 142, 150, 235, 224, 282, 228, 308, 213, 298, 134, 286, 262, 211, 266, 217, 194, 207, 196, 236, 266, 292, 314, 303, 219, 244, 225, 187, 275, 204, 227, 333, 157, 185, 197, 242, 246, 259, 203, 234, 286, 212, 213, 201, 150, 207, 247, 162, 254, 183, 162, 228, 364, 0, 234, 168, 178, 231, 241, 145, 247, 277, 314, 149, 223, 0, 259, 203, 205, 240, 104, 251, 243, 230, 249, 247, 235, 228, 180, 212, 274, 280, 225, 166, 281, 230, 160, 0, 277, 247, 259, 259, 261, 0, 185, 312, 229, 196, 198, 178, 251, 274, 0, 188, 218, 288, 222, 239, 219, 179, 230, 242, 201, 240, 234, 221, 234, 186, 201, 154, 21, 211, 180, 234, 200, 0, 227, 265, 212, 213, 220, 210, 181, 219, 272, 176, 210, 128, 267, 215, 192, 219, 228, 261, 215, 221, 189, 182, 234, 219, 177, 0, 134, 243, 269, 283]
# p1endgamescores= [241, 160, 263, 193, 193, 152, 228, 165, 170, 174, 143, 178, 178, 166, 156, 197, 250, 233, 196, 259, 234, 158, 222, 156, 312, 189, 223, 179, 142, 202, 211, 221, 227, 180, 249, 197, 206, 212, 170, 148, 154, 302, 261, 199, 233, 286, 156, 180, 237, 180, 169, 161, 162, 171, 238, 195, 167, 197, 213, 168, 178, 172, 209, 200, 145, 144, 200, 109, 186, 218, 256, 149, 147, 175, 149, 175, 165, 187, 143, 198, 252, 154, 244, 230, 182, 210, 187, 174, 219, 156, 224, 276, 157, 256, 248, 240, 166, None, 226, 199] + [182, 155, 178, 151, 143, 181, 206, 214, 216, None, 148, 188, 200, 172, 168, 185, 149, 209, 185, 158, 148, 183, 279, 158, 204, 166, 226, 210, 181, 222, 292, None, 140, 208, 180, 155, 138, None, 268, 169, 180, 179, 150, 208, 208, 207, None, 230, 265, 263, 199, 133, 177, 194, 196, 184, 179, 245, 146, 157, 253, 221, 254, 199, None, 213, 261, 183, 256, None, 221, 166, 171, 146, 180, 174, 239, 223, 142, 154, 224, 188, 190, 163, 206, 159, 192, 212, 142, 160, 253, 236, 145, 164, 176, None, 318, 230, 145, 149]
# p2endgamescores =[137, 228, 216, 211, 160, 199, 157, 194, 226, 155, 175, 202, 163, 283, 214, 169, 196, 121, 237, 156, 165, 207, 136, 203, 151, 199, 178, 187, 176, 147, 177, 159, 279, 189, 189, 188, 167, 212, 216, 184, 229, 199, 214, 194, 173, 134, 127, 175, 174, 207, 186, 249, 169, 280, 134, 241, 210, 183, 199, 196, 159, 174, 196, 223, 224, 229, 195, 252, 207, 228, 167, 187, 275, 192, 157, 267, 157, 167, 184, 177, 179, 185, 146, 159, 216, 183, 193, 201, 137, 207, 208, 151, 240, 180, 144, 201, 312, None, 166, 168] + [178, 216, 169, 133, 229, 213, 231, 118, 202, None, 180, 179, 163, 189, 104, 227, 243, 167, 189, 223, 222, 206, 166, 202, 207, 257, 191, 148, 268, 170, 160, None, 242, 241, 235, 220, 247, None, 164, 288, 219, 145, 198, 151, 216, 223, None, 157, 202, 249, 171, 198, 168, 148, 192, 216, 194, 188, 222, 172, 209, 170, 201, 154, None, 180, 170, 162, 150, None, 184, 265, 185, 190, 204, 194, 172, 208, 272, 160, 183, 110, 196, 151, 174, 190, 180, 198, 193, 197, 143, 159, 225, 212, 165, None, 124, 231, 266, 194]
# times= [0.679628, 0.25508600000000015, 0.43363600000000013, 0.46399999999999997, 0.16895599999999966, 0.8028839999999997, 4.356975, 4.766655000000001, 13.009975999999998, 0.842490999999999, 0.28075099999999864, 0.9972959999999986, 48.782015, 0.5818909999999988, 6.880387999999996, 0.8260039999999975, 3.160426000000001, 0.48574299999999937, 0.8762100000000004, 0.8821650000000005, 0.4071739999999977, 1.005681999999993, 12.369773999999992, 0.17704700000000173, 1.269368, 0.37784999999999513, 1.5121890000000064, 0.5563420000000008, 0.47250099999999406, 0.23128400000000227, 26.600381999999996, 0.2803899999999828, 29.685314000000005, 0.7725399999999922, 6.294240000000002, 1.6343379999999854, 2.923070999999993, 1.9321170000000052, 2.941325000000006, 8.602185999999989, 0.6906869999999969, 0.7905009999999777, 1.866658000000001, 2.6730459999999994, 15.083501999999982, 14.42065199999999, 0.3328260000000114, 0.2328860000000077, 0.8476809999999944, 0.37371799999999666, 0.9207979999999907, 1.137835999999993, 2.7452109999999834, 6.731470999999999, 0.1816129999999987, 0.5684990000000028, 19.516876999999994, 0.6207129999999665, 0.2729100000000244, 3.6562700000000063, 0.8647639999999797, 2.9245769999999993, 3.6845069999999964, 0.446596999999997, 0.3615979999999581, 0.7543730000000437, 12.700273000000038, 0.9589679999999703, 12.965763999999979, 5.987181000000021, 5.982330000000047, 0.6078249999999912, 3.409419000000014, 2.7159429999999816, 0.5523069999999848, 1.0286279999999692, 4.084158000000002, 2.0033220000000256, 5.545056000000045, 0.4627570000000105, 0.5283400000000142, 6.723304999999982, 13.699906999999996, 0.4170040000000199, 1.166246000000001, 5.239834999999971, 11.313789999999983, 9.967671999999993, 6.971202000000005, 0.433037000000013, 5.9265589999999975, 29.824003000000005, 0.2711219999999912, 7.5386910000000285, 0.7378659999999968, 1.8787570000000073, 1.4262469999999894, 0.0019649999999842294, 8.404497000000049, 0.6995429999999487] + [0.8239759999999999, 2.8693069999999996, 0.6537499999999996, 2.7714349999999994, 8.983509, 0.8282300000000014, 0.47210600000000014, 0.38156700000000043, 1.2638299999999987, 0.0023620000000015295, 0.39808499999999825, 0.4976900000000022, 2.021621999999997, 0.5062250000000006, 1.0995509999999982, 44.594679000000006, 1.1106079999999992, 0.1901060000000001, 4.9927550000000025, 0.4491119999999995, 0.16447800000000257, 0.4472559999999959, 0.2007289999999955, 6.015974, 8.65227200000001, 2.798123000000004, 0.5117840000000058, 0.20239599999999314, 1.181874999999991, 6.446624, 0.2352120000000042, 0.0025700000000057344, 2.038622999999987, 8.662423999999987, 40.825494000000006, 3.801616999999993, 9.708668000000017, 0.003264999999998963, 1.3517200000000003, 0.3241820000000075, 4.665531999999985, 0.22598800000000097, 0.47939200000001847, 0.6513869999999997, 0.23165700000001266, 2.067575000000005, 0.002983000000000402, 1.1652159999999867, 0.2645569999999964, 1.0616219999999998, 1.220879999999994, 0.5819160000000068, 0.3263249999999971, 31.597102000000007, 1.9335740000000214, 0.31726299999999696, 9.984741999999983, 2.2907459999999844, 2.25433799999999, 0.3571900000000028, 0.2136199999999917, 4.687556999999998, 18.58814799999999, 1.8963210000000004, 0.01300999999995156, 2.2318690000000174, 0.21198600000002443, 1.8818820000000187, 1.4707750000000033, 0.002824000000032356, 0.660618999999997, 0.9758380000000102, 8.486921999999993, 0.17451399999998785, 1.6599539999999706, 2.7566459999999893, 0.20125600000000077, 0.2870110000000068, 0.9532130000000052, 0.268195999999989, 11.179752999999948, 0.2229910000000359, 3.120221000000015, 2.5662949999999682, 23.72242, 39.422394999999995, 0.36750200000000177, 0.8205089999999586, 4.176756000000012, 4.312453000000005, 0.8300380000000018, 0.7237190000000169, 2.1888329999999883, 0.21207099999998036, 15.47395499999999, 0.0029519999999934043, 8.639047000000005, 11.690905000000043, 30.171132999999998, 19.65263299999998]
print(statistics.median(nodes))
p1wins = 0
p2wins = 0
ties = 0
final_times = 0
ind = 0
for i in range(len(p1scores)):
if p1endgamescores[i] is not None and p2endgamescores[i] is not None:
ind = 1
if p1scores[i] > p2scores[i]:
p1wins += 1
elif p1scores[i] < p2scores[i]:
p2wins += 1
else:
ties += 1
final_times += times[i]
average_time = statistics.median(times)
print(average_time)
print(p1wins)
print(p2wins)
print(ties)
"""""""""""""""""""""""""""NODE SORTING Evaluation"""""""""""""""""""""""""""""""""
# smoves = [499, 1628, 990, 2, 13, 133, 17, 1173, 60, 5, 1573, 333, 12296, 31539, 51, 35, 229, 61, 1644, 129, 52, 55, 2175, 41, 137, 73, 7, 12, 41, 993, 14, 23, 15, 670, 505, 7139, 23, 17, 492, 2, 7498, 17, 4, 859, 4331, 8, 3, 165, 3847]
# rmoves = [4, 866, 39, 487, 28, 838, 45, 5786, 14, 320, 869, 6, 16965, 322, 2250, 2670, 495, 87, 1490, 2, 473, 66, 35, 165, 25, 86, 19, 214, 87, 99, 361, 49, 17, 19382, 8629, 169, 754, 5, 734, 9616, 94, 2669, 309, 1071, 23607, 2763, 15]
# len_sorted_moves = [2918, 19, 20, 167, 223, 24, 66, 239, 901, 34, 5, 439, 14, 34, 667, 170, 79, 670, 308, 66, 62, 253, 343, 4, 79, 2440, 54, 2283, 92, 206, 433, 3, 43, 938, 54, 10, 197, 2857, 75, 13, 105, 44, 119, 19, 69, 4487, 1236, 25, 10, 2, 199, 981, 96, 12, 815, 53, 726, 61, 3301, 69, 1665, 1018, 2148, 120432, 49, 262, 27, 528, 75, 2508, 65, 43, 60, 109, 32, 1664, 287, 2759, 1428, 246, 128, 90, 898, 20, 371, 56, 13, 8, 1196, 6033, 129, 13, 1399]
# len_sorted_times = [28.457569, 0.33411299999999855, 0.3422729999999987, 1.7242899999999999, 1.9751229999999964, 0.34948599999999885, 0.8178440000000009, 2.284306000000001, 8.470917, 0.49538099999999474, 0.2556449999999941, 4.728405000000002, 0.34807999999999595, 0.023735999999999535, 0.12552500000000322, 0.483984999999997, 7.080171, 1.9386399999999995, 0.9097670000000022, 6.730280999999998, 2.9818090000000126, 0.7033690000000092, 0.72840699999999, 2.370058, 4.470228999999989, 0.2786049999999989, 0.8592219999999884, 20.823213999999993, 0.6710889999999949, 17.893317999999994, 0.8816439999999943, 1.7517409999999956, 3.9330260000000123, 0.20288299999999992, 0.6357670000000013, 7.664194999999992, 0.7840810000000147, 0.3089580000000183, 1.8615410000000168, 24.267165000000006, 0.848608999999982, 0.27916300000001115, 1.231020000000001, 0.5714190000000201, 0.04297500000001264, 1.3442199999999787, 0.3977549999999894, 0.8133920000000217, 36.14156200000002, 10.697302999999977, 28.457569, 0.33411299999999855, 0.3422729999999987, 1.7242899999999999, 1.9751229999999964, 0.34948599999999885, 0.8178440000000009, 2.284306000000001, 8.470917, 0.49538099999999474, 0.2556449999999941, 4.728405000000002, 0.34807999999999595, 0.023735999999999535, 0.12552500000000322, 0.483984999999997, 7.080171, 1.9386399999999995, 0.9097670000000022, 6.730280999999998, 2.9818090000000126, 0.7033690000000092, 0.72840699999999, 2.370058, 4.470228999999989, 0.2786049999999989, 0.8592219999999884, 20.823213999999993, 0.6710889999999949, 17.893317999999994, 0.8816439999999943, 1.7517409999999956, 3.9330260000000123, 0.20288299999999992, 0.6357670000000013, 7.664194999999992, 0.7840810000000147, 0.3089580000000183, 1.8615410000000168, 24.267165000000006, 0.848608999999982, 0.27916300000001115, 1.231020000000001, 0.5714190000000201, 0.04297500000001264, 1.3442199999999787, 0.3977549999999894, 0.8133920000000217, 36.14156200000002, 10.697302999999977, 0.5683670000000001, 0.26924099999999984, 0.17733, 2.02914, 8.453273, 0.8671249999999997, 0.2741490000000013, 8.405273000000001, 0.003088000000001756, 0.7832660000000011, 6.770484, 0.001788000000001233, 0.7870349999999995, 32.759317, 0.8810690000000037, 15.959770999999996, 9.082476, 23.287146000000007, 899.159576, 0.6069360000000188, 2.3854630000000725, 0.4569099999999935, 0.13301100000001043, 4.110847000000035, 0.874349000000052, 20.135546999999974, 0.7187790000000405, 0.4951149999999416, 0.675617000000102, 1.151836000000003, 0.4612999999999374, 13.440222000000176, 0.0017380000001594453, 2.7643929999999273, 22.713453000000072, 11.432960999999978, 2.4568299999998544, 1.368257000000085, 0.9997370000000956, 7.1294339999999465, 0.3538969999999608, 3.9655290000000605, 0.6393659999998818, 0.26812500000005457, 0.23288300000012896, 9.49111599999992, 55.96718499999997, 1.2186229999999796, 0.28220200000009754, 10.691080000000056]
# stimes = [5.462273, 13.628348999999998, 9.027452999999998, 0.20035800000000137, 0.350676, 1.452566000000001, 0.3063469999999988, 9.485683000000002, 0.7841099999999983, 0.20266799999999563, 17.036028, 3.118584999999996, 102.818501, 242.39040999999997, 0.5522730000000138, 0.5206039999999916, 2.3233899999999608, 0.7285350000000221, 14.949749999999995, 0.17539299999998548, 1.184301000000005, 0.577241000000015, 0.6432050000000231, 20.644333999999958, 0.5160099999999943, 1.323853999999983, 0.8926519999999982, 0.2601789999999937, 0.33121899999997595, 0.4770679999999743, 8.132326000000035, 0.31665900000001557, 0.39193999999997686, 0.3116600000000176, 6.508721000000037, 5.085165000000018, 55.82077000000004, 0.3661329999999907, 0.4054830000000038, 4.384490000000028, 0.16655200000002424, 70.42404600000009, 0.35272199999997156, 0.2003789999999981, 8.768035000000054, 35.55618399999992, 0.24955899999997655, 0.1856559999999945, 1.568037000000004, 29.536572999999976]
# rtimes = [0.338896, 8.730683, 0.4996229999999997, 4.7850139999999985, 0.37907200000000074, 7.887321, 0.5963290000000008, 47.081212, 0.29992200000000935, 2.7501099999999923, 7.412319000000011, 0.2718089999999904, 167.70644700000003, 3.072586000000001, 21.200469, 20.699720999999954, 4.870582000000013, 0.763321000000019, 13.35970900000001, 0.21506199999998898, 4.463702000000012, 0.7095789999999624, 0.539273000000037, 1.8219100000000026, 0.0038090000000465807, 0.36327099999999746, 1.0180799999999977, 0.3082679999999982, 2.0309389999999894, 0.7468609999999671, 0.9124090000000251, 2.8971290000000067, 0.584384, 0.28475700000001325, 163.11071900000002, 76.13204299999995, 2.0015580000000455, 6.309083999999984, 0.19872700000007626, 6.9720570000000635, 101.70751199999995, 0.002196000000026288, 0.14134500000000116, 0.9927730000000565, 26.648521000000073, 2.640781000000061, 11.751337000000035, 197.13955399999998, 26.002137999999945, 0.29406200000005356]
# lmoves = len_sorted_moves[:50]
# ltimes = len_sorted_times[:50]
# print(statistics.mean(smoves))
# print(statistics.median(rmoves))
# print(statistics.median(lmoves))
# print(statistics.median(stimes))
# print(statistics.median(rtimes))
# print(statistics.median(ltimes))
# print(len(baselinep1))
# print(len(baselinep2))
# p1wins = 0
# p2wins = 0
# for i in range(len(baselinep1)):
# if baselinep1[i] >= baselinep2[i]:
# p1wins += 1
# else:
# p2wins += 1
# print()
# sns.set_palette(["cadetblue", "gold", "tomato"])
# sns.barplot(x=["AB Pruning", "Baseline"], y = [p1wins, p2wins])
# plt.title("Wins after 200 Simulations")
# plt.xlabel("Agents")
# plt.ylabel("# of Wins")
# plt.show()
# print(p1wins)
# p1wins = 0
# p2wins = 0
# for i in range(len(randomp1)):
# if randomp1[i] >= randomp2[i]:
# p1wins += 1
# else:
# p2wins += 1
# print(p1wins)
# print(p1wins + p2wins)
# sns.set_palette(["cadetblue", "orangered"])
# sns.barplot(x=["AB Pruning", "Baseline"], y = [p1wins, p2wins])
# plt.title("Wins after 55 Simulations")
# plt.xlabel("Agents")
# plt.ylabel("# of Wins")
# plt.show()
| 530.050228 | 10,170 | 0.711874 |
4f4aaad52aa59474e76d982060300703501fbd44 | 160 | py | Python | core/bodyparts/__init__.py | ChrisLR/BasicDungeonRL | b293d40bd9a0d3b7aec41b5e1d58441165997ff1 | [
"MIT"
] | 3 | 2017-10-28T11:28:38.000Z | 2018-09-12T09:47:00.000Z | core/bodyparts/__init__.py | ChrisLR/BasicDungeonRL | b293d40bd9a0d3b7aec41b5e1d58441165997ff1 | [
"MIT"
] | null | null | null | core/bodyparts/__init__.py | ChrisLR/BasicDungeonRL | b293d40bd9a0d3b7aec41b5e1d58441165997ff1 | [
"MIT"
] | null | null | null | from core.bodyparts.base import (
Torso, Teeth, Tail, Nose, Neck,
Muzzle, Mouth, Heart, Lungs, Head, Hand, Foot, Fangs, Eye,
Ear, Arm, Brain, Leg
)
| 26.666667 | 62 | 0.65 |
4f4a24ec2ae4972532fb3b29c2aaddff0748d2ea | 719 | py | Python | destinator/util/listener.py | PJUllrich/distributed-systems | b362c1c6783fbd1659448277aab6c158485d7c3c | [
"MIT"
] | null | null | null | destinator/util/listener.py | PJUllrich/distributed-systems | b362c1c6783fbd1659448277aab6c158485d7c3c | [
"MIT"
] | null | null | null | destinator/util/listener.py | PJUllrich/distributed-systems | b362c1c6783fbd1659448277aab6c158485d7c3c | [
"MIT"
] | null | null | null | import logging
import threading
MESSAGE_SIZE = 1024
logger = logging.getLogger(__name__)
class Listener(threading.Thread):
def __init__(self, sock, queue):
super().__init__()
self.daemon = True
self.cancelled = False
self.sock = sock
self.queue = queue
def run(self):
"""
Starts the receiving loop, which receives packages from the socket.
"""
self.receive()
def receive(self):
logger.debug(f"Thread {threading.get_ident()}: "
f"Socket {self.sock}: Listener is now receiving.")
while not self.cancelled:
message = self.sock.recv(MESSAGE_SIZE)
self.queue.put(message)
| 23.966667 | 75 | 0.600834 |
4f4c168083a04a814702809e1d88fdaa878b4426 | 2,212 | py | Python | tests/helpers/__init__.py | Aetf/cc-modern-cmake | 4421755acf85a30a42f3f48b6d2e1a5130fd3f46 | [
"BSD-2-Clause"
] | null | null | null | tests/helpers/__init__.py | Aetf/cc-modern-cmake | 4421755acf85a30a42f3f48b6d2e1a5130fd3f46 | [
"BSD-2-Clause"
] | 3 | 2021-03-29T18:28:19.000Z | 2021-03-29T18:28:20.000Z | tests/helpers/__init__.py | Aetf/cc-modern-cmake | 4421755acf85a30a42f3f48b6d2e1a5130fd3f46 | [
"BSD-2-Clause"
] | null | null | null | from __future__ import print_function, division, absolute_import
from contextlib import contextmanager
import os
import difflib
import pytest
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
@contextmanager
def inside_dir(dirpath):
"""
Execute code from inside the given directory
:param dirpath: String, path of the directory the command is being run.
"""
old_path = os.getcwd()
try:
os.chdir(str(dirpath))
yield
finally:
os.chdir(old_path)
def cast_path(anypath):
"""Cast a py.path.local or a str or a pathlib.Path to a pathlib.Path
"""
return Path(str(anypath))
def assertMultiLineEqual(first, second, msg=None):
"""Assert that two multi-line strings are equal.
If they aren't, show a nice diff.
"""
__tracebackhide__ = True
if first != second:
message = ''.join(difflib.ndiff(first.splitlines(True),
second.splitlines(True)))
if msg:
message += " : " + msg
pytest.fail("Multi-line strings are unequal:\n" + message)
def assertFileHeadLines(filename, lines):
"""Assert that first few lines in the file with given name are equal to given lines.
If they aren't, show a nice diff.
None entry in lines will be skipped.
"""
__tracebackhide__ = True
if not lines:
return
orig_len = len(lines)
with Path(filename).open() as f:
def skip_none(fline, line):
if line is None:
line = fline
return (fline, line)
flines, lines = zip(*[skip_none(fline, line) for fline, line in zip(f, lines)])
assert len(flines) == orig_len
return assertMultiLineEqual(''.join(flines), ''.join(lines))
def assertFileStructure(basedir, manifest):
"""Assert that the file system structure starting from basedir follows the manifest.
Only paths in the manifest are checked.
"""
__tracebackhide__ = True
basedir = Path(basedir)
for relpath in manifest:
path = basedir / relpath
if relpath.endswith('/'):
assert path.is_dir()
else:
assert path.is_file()
| 26.97561 | 88 | 0.633816 |
4f4b54754cf61f654d775bce346bcefeea43bb24 | 4,718 | py | Python | solutions/rank-5/predict_code/predict_model.py | mattmotoki/ashrae-great-energy-predictor-3-solution-analysis | 8a5260049d4537c57c37a78e77f2fba13c55177d | [
"MIT"
] | 48 | 2020-03-18T11:34:49.000Z | 2022-03-31T18:30:00.000Z | solutions/rank-5/predict_code/predict_model.py | mattmotoki/ashrae-great-energy-predictor-3-solution-analysis | 8a5260049d4537c57c37a78e77f2fba13c55177d | [
"MIT"
] | 40 | 2020-03-24T18:17:51.000Z | 2022-03-12T00:30:30.000Z | solutions/rank-5/predict_code/predict_model.py | mattmotoki/ashrae-great-energy-predictor-3-solution-analysis | 8a5260049d4537c57c37a78e77f2fba13c55177d | [
"MIT"
] | 24 | 2020-04-18T02:52:47.000Z | 2022-01-22T19:13:16.000Z | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import _pickle as cPickle
import argparse
from copy import deepcopy
import japanize_matplotlib
import lightgbm as lgb
import matplotlib.pyplot as plt
import pickle
from sklearn.metrics import mean_squared_error
import time
from tqdm import tqdm
import os
code_path = os.path.dirname(os.path.abspath(__file__))
parser = argparse.ArgumentParser()
arg = parser.add_argument
arg('seed', type=int)
arg('iteration_mul', type=float)
arg('train_file', type=str)
arg('test_file', type=str)
arg('--learning_rate', type=float, default=0.05)
arg('--num_leaves', type=int, default=31)
arg('--n_estimators', type=int, default=500)
args = parser.parse_args()#args=['1', '0.5','train_fe.ftr', 'test_fe.ftr'])
# print(args)
train_fe = pd.read_feather(f'{code_path}/../prepare_data/{args.train_file}')
test_fe = pd.read_feather(f'{code_path}/../prepare_data/{args.test_file}')
target_fe = train_fe['meter_reading']
train_fe = train_fe.drop('meter_reading', axis=1)
X_train = train_fe.query('20160115 <= timestamp < 20160601 & site_id != 0')
X_valid = train_fe.query('20160901 <= timestamp < 20170101 & site_id != 0')
X_test = test_fe
y_train = target_fe.loc[X_train.index]
y_valid = target_fe.loc[X_valid.index]
# y_train = np.log1p(y_train)
# y_valid = np.log1p(y_valid)
X_train = X_train.drop('timestamp', axis=1)
X_valid = X_valid.drop('timestamp', axis=1)
X_test = X_test.drop('timestamp', axis=1)
# print(X_train.shape)
def meter_predict(meter, model, X_test, best_iteration, iteration_mul=1.5):
X_test_m = X_test.query('meter == {}'.format(meter)).drop('meter', axis=1)
g = X_test_m.groupby('building_id')
y_pred = []
for building_id in tqdm(sorted(X_test_m['building_id'].unique())):
X_building = g.get_group(building_id)
y_pred.append(pd.Series(model.predict(X_building, n_jobs=4,num_iteration=min(models_all[meter].n_estimators, int(best_iteration[meter][building_id]*iteration_mul))), index=X_building.index))
return pd.concat(y_pred).sort_index()
# load model
load_name = '{}/../model/model_use_{}_seed{}_leave{}_lr{}_tree{}.pkl'.format(code_path, args.train_file.replace('.ftr', ''),args.seed, args.num_leaves, str(args.learning_rate).replace('.', ''), args.n_estimators)
with open(load_name, 'rb') as f:
models = pickle.load(f)
# with open(f'{code_path}/../model/model_5_95_hokan_cleaning_50000tree_seed{}.pkl'.format(args.seed), 'wb') as f:
# pickle.dump(models, f)
# 各building, meter毎の最良のiteration数
best_iteration = dict()
for meter in [0,1,2,3]:
best_iteration[meter] = dict()
# for i in range(1448):
# best_iteration[meter][i] = 200
for i in tqdm(sorted(X_valid.query('meter == {}'.format(meter))['building_id'].unique())):
best_iteration[meter][i] = max(20, np.argmin(np.array(models[meter].evals_result_[i]['rmse'])) + 1)
# best_iteration[meter][i] = np.argmin(np.array(models[meter].evals_result_[i]['rmse'])) + 1
del_list = [list(), list(), list(), list()]
for meter in [0,1,2,3]:
for buildingID, itr in best_iteration[meter].items():
if itr<=20:
del_list[meter].append(buildingID)
if itr<=100:
best_iteration[meter][buildingID] = 100
# if itr>=int(models[0].n_estimators * 0.98):
# best_iteration[meter][buildingID] = models[0].n_estimatorss
for meter in [0,1,2,3]:
for i in range(1448):
if i not in best_iteration[meter]:
best_iteration[meter][i] = 200
#load model
load_name = '{}/../model/model_all_use_{}_seed{}_leave{}_lr{}_tree{}.pkl'.format(code_path, args.train_file.replace('.ftr', ''),args.seed, args.num_leaves, str(args.learning_rate).replace('.', ''), args.n_estimators)
with open(load_name, 'rb') as f:
models_all = pickle.load(f)
# meter type毎のtestの予測
preds = list()
for i in tqdm([3,2,1,0]):
preds.append(meter_predict(i, models_all[i], X_test, best_iteration, iteration_mul=args.iteration_mul))
y_preds = pd.concat(preds).sort_index()
# lgb.plot_importance(models_all[0], importance_type='gain', figsize=(10,20))
# lgb.plot_importance(models_all[0], importance_type='split', figsize=(10,20))
submission = pd.read_csv(f'{code_path}/../input/sample_submission.csv')
submission['meter_reading'] = (np.expm1(y_preds))
submission.loc[submission['meter_reading']<0, 'meter_reading'] = 0
save_name = '{}/../output/use_{}_seed{}_leave{}_lr{}_tree{}_mul{}.csv'.format(code_path, args.train_file.replace('.ftr', ''), args.seed, args.num_leaves, str(args.learning_rate).replace('.', ''), args.n_estimators, str(args.iteration_mul).replace('.', ''))
submission.to_csv(save_name, index=False)
submission.head()
| 37.444444 | 256 | 0.701357 |
4f4bdab7e7c433d49e00c470d188df5e8e4d786e | 357 | py | Python | app/api/v2/models/rsvp.py | jmusila/Questioner-v2 | 54110d8233311862ccfadb32b5ced557c33c4a0f | [
"MIT"
] | 1 | 2019-02-13T10:02:16.000Z | 2019-02-13T10:02:16.000Z | app/api/v2/models/rsvp.py | jmusila/Questioner-v2 | 54110d8233311862ccfadb32b5ced557c33c4a0f | [
"MIT"
] | 6 | 2019-01-21T19:18:14.000Z | 2019-01-24T19:46:40.000Z | app/api/v2/models/rsvp.py | jmusila/Questioner-v2 | 54110d8233311862ccfadb32b5ced557c33c4a0f | [
"MIT"
] | null | null | null | from datetime import datetime
class Responds:
""" Respond constructor """
def __init__(self, r_id, meetup_id, topic, status):
self.r_id = r_id
self.meetup_id = meetup_id
self.topic = topic
self.status = status
""" Method for getting single comment """
def get_single_response(self, r_id):
pass
| 21 | 55 | 0.62465 |
4f4a004a9be01e0c89f6305d96270831fd4b2262 | 18,040 | py | Python | scf/uhf_symm.py | gmwang18/pyscf | fcd6877751661c8a9743c1c872a4a2b65f6dd7ac | [
"BSD-2-Clause"
] | null | null | null | scf/uhf_symm.py | gmwang18/pyscf | fcd6877751661c8a9743c1c872a4a2b65f6dd7ac | [
"BSD-2-Clause"
] | null | null | null | scf/uhf_symm.py | gmwang18/pyscf | fcd6877751661c8a9743c1c872a4a2b65f6dd7ac | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
import time
from functools import reduce
import numpy
import scipy.linalg
from pyscf import lib
from pyscf import symm
from pyscf.lib import logger
from pyscf.scf import hf
from pyscf.scf import hf_symm
from pyscf.scf import uhf
from pyscf.scf import chkfile
def analyze(mf, verbose=logger.DEBUG, **kwargs):
from pyscf.lo import orth
from pyscf.tools import dump_mat
mol = mf.mol
if not mol.symmetry:
return uhf.analyze(mf, verbose, **kwargs)
mo_energy = mf.mo_energy
mo_occ = mf.mo_occ
mo_coeff = mf.mo_coeff
log = logger.Logger(mf.stdout, verbose)
nirrep = len(mol.irrep_id)
ovlp_ao = mf.get_ovlp()
orbsyma = symm.label_orb_symm(mol, mol.irrep_id, mol.symm_orb,
mo_coeff[0], ovlp_ao, False)
orbsymb = symm.label_orb_symm(mol, mol.irrep_id, mol.symm_orb,
mo_coeff[1], ovlp_ao, False)
orbsyma = numpy.array(orbsyma)
orbsymb = numpy.array(orbsymb)
tot_sym = 0
noccsa = [sum(orbsyma[mo_occ[0]>0]==ir) for ir in mol.irrep_id]
noccsb = [sum(orbsymb[mo_occ[1]>0]==ir) for ir in mol.irrep_id]
for i, ir in enumerate(mol.irrep_id):
if (noccsa[i]+noccsb[i]) % 2:
tot_sym ^= ir
if mol.groupname in ('Dooh', 'Coov', 'SO3'):
log.note('TODO: total symmetry for %s', mol.groupname)
else:
log.note('total symmetry = %s',
symm.irrep_id2name(mol.groupname, tot_sym))
log.note('alpha occupancy for each irrep: '+(' %4s'*nirrep),
*mol.irrep_name)
log.note(' '+(' %4d'*nirrep),
*noccsa)
log.note('beta occupancy for each irrep: '+(' %4s'*nirrep),
*mol.irrep_name)
log.note(' '+(' %4d'*nirrep),
*noccsb)
ss, s = mf.spin_square((mo_coeff[0][:,mo_occ[0]>0],
mo_coeff[1][:,mo_occ[1]>0]), ovlp_ao)
log.note('multiplicity <S^2> = %.8g 2S+1 = %.8g', ss, s)
if verbose >= logger.NOTE:
log.note('**** MO energy ****')
irname_full = {}
for k, ir in enumerate(mol.irrep_id):
irname_full[ir] = mol.irrep_name[k]
irorbcnt = {}
for k, j in enumerate(orbsyma):
if j in irorbcnt:
irorbcnt[j] += 1
else:
irorbcnt[j] = 1
log.note('alpha MO #%d (%s #%d), energy= %.15g occ= %g',
k+1, irname_full[j], irorbcnt[j], mo_energy[0][k], mo_occ[0][k])
irorbcnt = {}
for k, j in enumerate(orbsymb):
if j in irorbcnt:
irorbcnt[j] += 1
else:
irorbcnt[j] = 1
log.note('beta MO #%d (%s #%d), energy= %.15g occ= %g',
k+1, irname_full[j], irorbcnt[j], mo_energy[1][k], mo_occ[1][k])
ovlp_ao = mf.get_ovlp()
if mf.verbose >= logger.DEBUG:
label = mol.spheric_labels(True)
molabel = []
irorbcnt = {}
for k, j in enumerate(orbsyma):
if j in irorbcnt:
irorbcnt[j] += 1
else:
irorbcnt[j] = 1
molabel.append('#%-d(%s #%d)' % (k+1, irname_full[j], irorbcnt[j]))
log.debug(' ** alpha MO coefficients (expansion on meta-Lowdin AOs) **')
orth_coeff = orth.orth_ao(mol, 'meta_lowdin', s=ovlp_ao)
c_inv = numpy.dot(orth_coeff.T, ovlp_ao)
dump_mat.dump_rec(mol.stdout, c_inv.dot(mo_coeff[0]), label, molabel,
start=1, **kwargs)
molabel = []
irorbcnt = {}
for k, j in enumerate(orbsymb):
if j in irorbcnt:
irorbcnt[j] += 1
else:
irorbcnt[j] = 1
molabel.append('#%-d(%s #%d)' % (k+1, irname_full[j], irorbcnt[j]))
log.debug(' ** beta MO coefficients (expansion on meta-Lowdin AOs) **')
dump_mat.dump_rec(mol.stdout, c_inv.dot(mo_coeff[1]), label, molabel,
start=1, **kwargs)
dm = mf.make_rdm1(mo_coeff, mo_occ)
return mf.mulliken_meta(mol, dm, s=ovlp_ao, verbose=log)
def get_irrep_nelec(mol, mo_coeff, mo_occ, s=None):
'''Alpha/beta electron numbers for each irreducible representation.
Args:
mol : an instance of :class:`Mole`
To provide irrep_id, and spin-adapted basis
mo_occ : a list of 1D ndarray
Regular occupancy, without grouping for irreps
mo_coeff : a list of 2D ndarray
Regular orbital coefficients, without grouping for irreps
Returns:
irrep_nelec : dict
The number of alpha/beta electrons for each irrep {'ir_name':(int,int), ...}.
Examples:
>>> mol = gto.M(atom='O 0 0 0; H 0 0 1; H 0 1 0', basis='ccpvdz', symmetry=True, charge=1, spin=1, verbose=0)
>>> mf = scf.UHF(mol)
>>> mf.scf()
-75.623975516256721
>>> scf.uhf_symm.get_irrep_nelec(mol, mf.mo_coeff, mf.mo_occ)
{'A1': (3, 3), 'A2': (0, 0), 'B1': (1, 1), 'B2': (1, 0)}
'''
orbsyma = symm.label_orb_symm(mol, mol.irrep_id, mol.symm_orb,
mo_coeff[0], s, False)
orbsymb = symm.label_orb_symm(mol, mol.irrep_id, mol.symm_orb,
mo_coeff[1], s, False)
orbsyma = numpy.array(orbsyma)
orbsymb = numpy.array(orbsymb)
irrep_nelec = dict([(mol.irrep_name[k], (int(sum(mo_occ[0][orbsyma==ir])),
int(sum(mo_occ[1][orbsymb==ir]))))
for k, ir in enumerate(mol.irrep_id)])
return irrep_nelec
map_rhf_to_uhf = uhf.map_rhf_to_uhf
def canonicalize(mf, mo_coeff, mo_occ, fock=None):
'''Canonicalization diagonalizes the UHF Fock matrix in occupied, virtual
subspaces separatedly (without change occupancy).
'''
if not mf.mol.symmetry:
return uhf.canonicalize(mf, mo_coeff, mo_occ, fock)
mo_occ = numpy.asarray(mo_occ)
assert(mo_occ.ndim == 2)
if fock is None:
dm = mf.make_rdm1(mo_coeff, mo_occ)
fock = mf.get_hcore() + mf.get_jk(mol, dm)
occidxa = mo_occ[0] == 1
occidxb = mo_occ[1] == 1
viridxa = mo_occ[0] == 0
viridxb = mo_occ[1] == 0
s = mf.get_ovlp()
def eig_(fock, mo_coeff, idx, es, cs):
if numpy.count_nonzero(idx) > 0:
orb = mo_coeff[:,idx]
f1 = reduce(numpy.dot, (orb.T.conj(), fock, orb))
e, c = scipy.linalg.eigh(f1)
es[idx] = e
c = numpy.dot(mo_coeff[:,idx], c)
cs[:,idx] = hf_symm._symmetrize_canonicalization_(mf.mol, e, c, s)
mo = numpy.empty_like(mo_coeff)
mo_e = numpy.empty(mo_occ.shape)
eig_(fock[0], mo_coeff[0], occidxa, mo_e[0], mo[0])
eig_(fock[0], mo_coeff[0], viridxa, mo_e[0], mo[0])
eig_(fock[1], mo_coeff[1], occidxb, mo_e[1], mo[1])
eig_(fock[1], mo_coeff[1], viridxb, mo_e[1], mo[1])
return mo_e, mo
class UHF(uhf.UHF):
__doc__ = uhf.UHF.__doc__ + '''
Attributes for symmetry allowed UHF:
irrep_nelec : dict
Specify the number of alpha/beta electrons for particular irrep
{'ir_name':(int,int), ...}.
For the irreps not listed in these dicts, the program will choose the
occupancy based on the orbital energies.
Examples:
>>> mol = gto.M(atom='O 0 0 0; H 0 0 1; H 0 1 0', basis='ccpvdz', symmetry=True, charge=1, spin=1, verbose=0)
>>> mf = scf.RHF(mol)
>>> mf.scf()
-75.623975516256692
>>> mf.get_irrep_nelec()
{'A1': (3, 3), 'A2': (0, 0), 'B1': (1, 1), 'B2': (1, 0)}
>>> mf.irrep_nelec = {'B1': (1, 0)}
>>> mf.scf()
-75.429189192031131
>>> mf.get_irrep_nelec()
{'A1': (3, 3), 'A2': (0, 0), 'B1': (1, 0), 'B2': (1, 1)}
'''
def __init__(self, mol):
uhf.UHF.__init__(self, mol)
# number of electrons for each irreps
self.irrep_nelec = {}
self._keys = self._keys.union(['irrep_nelec'])
def dump_flags(self):
uhf.UHF.dump_flags(self)
hf_symm.check_irrep_nelec(self.mol, self.irrep_nelec, self.nelec)
def build(self, mol=None):
for irname in self.irrep_nelec:
if irname not in self.mol.irrep_name:
logger.warn(self, '!! No irrep %s', irname)
return uhf.UHF.build(self, mol)
def eig(self, h, s):
if not self.mol.symmetry:
return uhf.UHF.eig(self, h, s)
nirrep = self.mol.symm_orb.__len__()
s = symm.symmetrize_matrix(s, self.mol.symm_orb)
ha = symm.symmetrize_matrix(h[0], self.mol.symm_orb)
cs = []
es = []
for ir in range(nirrep):
e, c = hf.SCF.eig(self, ha[ir], s[ir])
cs.append(c)
es.append(e)
ea = numpy.hstack(es)
ca = hf_symm.so2ao_mo_coeff(self.mol.symm_orb, cs)
hb = symm.symmetrize_matrix(h[1], self.mol.symm_orb)
cs = []
es = []
for ir in range(nirrep):
e, c = scipy.linalg.eigh(hb[ir], s[ir])
cs.append(c)
es.append(e)
eb = numpy.hstack(es)
cb = hf_symm.so2ao_mo_coeff(self.mol.symm_orb, cs)
return numpy.array((ea,eb)), (ca,cb)
def get_grad(self, mo_coeff, mo_occ, fock=None):
mol = self.mol
if not mol.symmetry:
return uhf.UHF.get_grad(self, mo_coeff, mo_occ, fock)
if fock is None:
dm1 = self.make_rdm1(mo_coeff, mo_occ)
fock = self.get_hcore(mol) + self.get_veff(self.mol, dm1)
ovlp_ao = self.get_ovlp()
orbsyma = symm.label_orb_symm(self, mol.irrep_id, mol.symm_orb,
mo_coeff[0], ovlp_ao, False)
orbsymb = symm.label_orb_symm(self, mol.irrep_id, mol.symm_orb,
mo_coeff[1], ovlp_ao, False)
orbsyma = numpy.asarray(orbsyma)
orbsymb = numpy.asarray(orbsymb)
occidxa = mo_occ[0] > 0
occidxb = mo_occ[1] > 0
viridxa = ~occidxa
viridxb = ~occidxb
ga = reduce(numpy.dot, (mo_coeff[0][:,viridxa].T.conj(), fock[0],
mo_coeff[0][:,occidxa]))
ga[orbsyma[viridxa].reshape(-1,1)!=orbsyma[occidxa]] = 0
gb = reduce(numpy.dot, (mo_coeff[1][:,viridxb].T.conj(), fock[1],
mo_coeff[1][:,occidxb]))
gb[orbsymb[viridxb].reshape(-1,1)!=orbsymb[occidxb]] = 0
return numpy.hstack((ga.ravel(), gb.ravel()))
def get_occ(self, mo_energy=None, mo_coeff=None, orbsym=None):
''' We assumed mo_energy are grouped by symmetry irreps, (see function
self.eig). The orbitals are sorted after SCF.
'''
if mo_energy is None: mo_energy = self.mo_energy
mol = self.mol
if not mol.symmetry:
return uhf.UHF.get_occ(self, mo_energy, mo_coeff)
if orbsym is None:
if mo_coeff is not None: # due to linear-dep
ovlp_ao = self.get_ovlp()
orbsyma = symm.label_orb_symm(self, mol.irrep_id, mol.symm_orb,
mo_coeff[0], ovlp_ao, False)
orbsymb = symm.label_orb_symm(self, mol.irrep_id, mol.symm_orb,
mo_coeff[1], ovlp_ao, False)
orbsyma = numpy.asarray(orbsyma)
orbsymb = numpy.asarray(orbsymb)
else:
ovlp_ao = None
orbsyma = [numpy.repeat(ir, mol.symm_orb[i].shape[1])
for i, ir in enumerate(mol.irrep_id)]
orbsyma = orbsymb = numpy.hstack(orbsyma)
else:
orbsyma = numpy.asarray(orbsym[0])
orbsymb = numpy.asarray(orbsym[1])
assert(mo_energy[0].size == orbsyma.size)
mo_occ = numpy.zeros_like(mo_energy)
idx_ea_left = []
idx_eb_left = []
neleca_fix = nelecb_fix = 0
for i, ir in enumerate(mol.irrep_id):
irname = mol.irrep_name[i]
ir_idxa = numpy.where(orbsyma == ir)[0]
ir_idxb = numpy.where(orbsymb == ir)[0]
if irname in self.irrep_nelec:
if isinstance(self.irrep_nelec[irname], (int, numpy.integer)):
nelecb = self.irrep_nelec[irname] // 2
neleca = self.irrep_nelec[irname] - nelecb
else:
neleca, nelecb = self.irrep_nelec[irname]
ea_idx = numpy.argsort(mo_energy[0][ir_idxa].round(9))
eb_idx = numpy.argsort(mo_energy[1][ir_idxb].round(9))
mo_occ[0,ir_idxa[ea_idx[:neleca]]] = 1
mo_occ[1,ir_idxb[eb_idx[:nelecb]]] = 1
neleca_fix += neleca
nelecb_fix += nelecb
else:
idx_ea_left.append(ir_idxa)
idx_eb_left.append(ir_idxb)
neleca_float = self.nelec[0] - neleca_fix
nelecb_float = self.nelec[1] - nelecb_fix
assert(neleca_float >= 0)
assert(nelecb_float >= 0)
if len(idx_ea_left) > 0:
idx_ea_left = numpy.hstack(idx_ea_left)
ea_left = mo_energy[0][idx_ea_left]
ea_sort = numpy.argsort(ea_left.round(9))
occ_idx = idx_ea_left[ea_sort][:neleca_float]
mo_occ[0][occ_idx] = 1
if len(idx_eb_left) > 0:
idx_eb_left = numpy.hstack(idx_eb_left)
eb_left = mo_energy[1][idx_eb_left]
eb_sort = numpy.argsort(eb_left.round(9))
occ_idx = idx_eb_left[eb_sort][:nelecb_float]
mo_occ[1][occ_idx] = 1
vir_idx = (mo_occ[0]==0)
if self.verbose >= logger.INFO and numpy.count_nonzero(vir_idx) > 0:
ehomoa = max(mo_energy[0][mo_occ[0]>0 ])
elumoa = min(mo_energy[0][mo_occ[0]==0])
ehomob = max(mo_energy[1][mo_occ[1]>0 ])
elumob = min(mo_energy[1][mo_occ[1]==0])
noccsa = []
noccsb = []
p0 = 0
for i, ir in enumerate(mol.irrep_id):
irname = mol.irrep_name[i]
ir_idxa = orbsyma == ir
ir_idxb = orbsymb == ir
noccsa.append(numpy.count_nonzero(mo_occ[0][ir_idxa]))
noccsb.append(numpy.count_nonzero(mo_occ[1][ir_idxb]))
if ehomoa in mo_energy[0][ir_idxa]:
irhomoa = irname
if elumoa in mo_energy[0][ir_idxa]:
irlumoa = irname
if ehomob in mo_energy[1][ir_idxb]:
irhomob = irname
if elumob in mo_energy[1][ir_idxb]:
irlumob = irname
logger.info(self, 'alpha HOMO (%s) = %.15g LUMO (%s) = %.15g',
irhomoa, ehomoa, irlumoa, elumoa)
logger.info(self, 'beta HOMO (%s) = %.15g LUMO (%s) = %.15g',
irhomob, ehomob, irlumob, elumob)
ehomo = max(ehomoa,ehomob)
elumo = min(elumoa,elumob)
logger.debug(self, 'alpha irrep_nelec = %s', noccsa)
logger.debug(self, 'beta irrep_nelec = %s', noccsb)
hf_symm._dump_mo_energy(mol, mo_energy[0], mo_occ[0], ehomo, elumo,
orbsyma, 'alpha-', verbose=self.verbose)
hf_symm._dump_mo_energy(mol, mo_energy[1], mo_occ[1], ehomo, elumo,
orbsymb, 'beta-', verbose=self.verbose)
if mo_coeff is not None and self.verbose >= logger.DEBUG:
if ovlp_ao is None:
ovlp_ao = self.get_ovlp()
ss, s = self.spin_square((mo_coeff[0][:,mo_occ[0]>0],
mo_coeff[1][:,mo_occ[1]>0]), ovlp_ao)
logger.debug(self, 'multiplicity <S^2> = %.8g 2S+1 = %.8g', ss, s)
return mo_occ
def _finalize(self):
uhf.UHF._finalize(self)
ea = numpy.hstack(self.mo_energy[0])
eb = numpy.hstack(self.mo_energy[1])
oa_sort = numpy.argsort(ea[self.mo_occ[0]>0 ].round(9))
va_sort = numpy.argsort(ea[self.mo_occ[0]==0].round(9))
ob_sort = numpy.argsort(eb[self.mo_occ[1]>0 ].round(9))
vb_sort = numpy.argsort(eb[self.mo_occ[1]==0].round(9))
self.mo_energy = (numpy.hstack((ea[self.mo_occ[0]>0 ][oa_sort],
ea[self.mo_occ[0]==0][va_sort])),
numpy.hstack((eb[self.mo_occ[1]>0 ][ob_sort],
eb[self.mo_occ[1]==0][vb_sort])))
ca = self.mo_coeff[0]
cb = self.mo_coeff[1]
self.mo_coeff = (numpy.hstack((ca[:,self.mo_occ[0]>0 ].take(oa_sort, axis=1),
ca[:,self.mo_occ[0]==0].take(va_sort, axis=1))),
numpy.hstack((cb[:,self.mo_occ[1]>0 ].take(ob_sort, axis=1),
cb[:,self.mo_occ[1]==0].take(vb_sort, axis=1))))
nocc_a = int(self.mo_occ[0].sum())
nocc_b = int(self.mo_occ[1].sum())
self.mo_occ[0][:nocc_a] = 1
self.mo_occ[0][nocc_a:] = 0
self.mo_occ[1][:nocc_b] = 1
self.mo_occ[1][nocc_b:] = 0
if self.chkfile:
chkfile.dump_scf(self.mol, self.chkfile, self.e_tot, self.mo_energy,
self.mo_coeff, self.mo_occ, overwrite_mol=True)
return self
def analyze(self, verbose=None, **kwargs):
if verbose is None: verbose = self.verbose
return analyze(self, verbose, **kwargs)
@lib.with_doc(get_irrep_nelec.__doc__)
def get_irrep_nelec(self, mol=None, mo_coeff=None, mo_occ=None, s=None):
if mol is None: mol = self.mol
if mo_occ is None: mo_occ = self.mo_occ
if mo_coeff is None: mo_coeff = self.mo_coeff
if s is None: s = self.get_ovlp()
return get_irrep_nelec(mol, mo_coeff, mo_occ, s)
canonicalize = canonicalize
| 40.907029 | 113 | 0.542295 |
4f4a37537510da8d441ad30b15f70773fd2c8364 | 3,612 | py | Python | hatasmota/fan.py | emontnemery/hatasmota | c1d1629ee2e88d027741a474c9648de8d67ba817 | [
"MIT"
] | 19 | 2020-09-03T19:12:43.000Z | 2022-01-01T07:50:32.000Z | hatasmota/fan.py | emontnemery/hatasmota | c1d1629ee2e88d027741a474c9648de8d67ba817 | [
"MIT"
] | 41 | 2020-10-08T20:35:58.000Z | 2022-03-30T00:02:57.000Z | hatasmota/fan.py | emontnemery/hatasmota | c1d1629ee2e88d027741a474c9648de8d67ba817 | [
"MIT"
] | 11 | 2020-10-27T21:22:14.000Z | 2022-01-06T11:19:55.000Z | """Tasmota fan."""
from __future__ import annotations
import logging
from typing import Any
import attr
from .const import (
COMMAND_FANSPEED,
CONF_DEVICENAME,
CONF_MAC,
FAN_SPEED_HIGH,
FAN_SPEED_LOW,
FAN_SPEED_MEDIUM,
FAN_SPEED_OFF,
)
from .entity import (
TasmotaAvailability,
TasmotaAvailabilityConfig,
TasmotaEntity,
TasmotaEntityConfig,
)
from .mqtt import ReceiveMessage
from .utils import (
config_get_state_offline,
config_get_state_online,
get_topic_command,
get_topic_command_state,
get_topic_stat_result,
get_topic_tele_state,
get_topic_tele_will,
get_value_by_path,
)
SUPPORTED_FAN_SPEEDS = [FAN_SPEED_OFF, FAN_SPEED_LOW, FAN_SPEED_MEDIUM, FAN_SPEED_HIGH]
_LOGGER = logging.getLogger(__name__)
@attr.s(slots=True, frozen=True)
class TasmotaFanConfig(TasmotaAvailabilityConfig, TasmotaEntityConfig):
"""Tasmota fan configuation."""
command_topic: str = attr.ib()
result_topic: str = attr.ib()
state_topic: str = attr.ib()
@classmethod
def from_discovery_message(cls, config: dict, platform: str) -> TasmotaFanConfig:
"""Instantiate from discovery message."""
return cls(
endpoint="fan",
idx="ifan",
friendly_name=config[CONF_DEVICENAME],
mac=config[CONF_MAC],
platform=platform,
poll_payload="",
poll_topic=get_topic_command_state(config),
availability_topic=get_topic_tele_will(config),
availability_offline=config_get_state_offline(config),
availability_online=config_get_state_online(config),
command_topic=get_topic_command(config),
result_topic=get_topic_stat_result(config),
state_topic=get_topic_tele_state(config),
)
class TasmotaFan(TasmotaAvailability, TasmotaEntity):
"""Representation of a Tasmota fan."""
_cfg: TasmotaFanConfig
def __init__(self, **kwds: Any):
"""Initialize."""
self._sub_state: dict | None = None
super().__init__(**kwds)
async def subscribe_topics(self) -> None:
"""Subscribe to topics."""
def state_message_received(msg: ReceiveMessage) -> None:
"""Handle new MQTT state messages."""
if not self._on_state_callback:
return
fanspeed: int = get_value_by_path(msg.payload, [COMMAND_FANSPEED])
if fanspeed in SUPPORTED_FAN_SPEEDS:
self._on_state_callback(fanspeed)
availability_topics = self.get_availability_topics()
topics = {
"result_topic": {
"event_loop_safe": True,
"topic": self._cfg.result_topic,
"msg_callback": state_message_received,
},
"state_topic": {
"event_loop_safe": True,
"topic": self._cfg.state_topic,
"msg_callback": state_message_received,
},
}
topics = {**topics, **availability_topics}
self._sub_state = await self._mqtt_client.subscribe(
self._sub_state,
topics,
)
async def unsubscribe_topics(self) -> None:
"""Unsubscribe to all MQTT topics."""
self._sub_state = await self._mqtt_client.unsubscribe(self._sub_state)
def set_speed(self, fanspeed: int) -> None:
"""Set the fan's speed."""
payload = fanspeed
command = COMMAND_FANSPEED
self._mqtt_client.publish(
self._cfg.command_topic + command,
payload,
)
| 29.606557 | 87 | 0.637874 |
End of preview. Expand
in Dataset Viewer.
- Downloads last month
- 0