Skip to content

Dan horsley #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2e41fac
initial setup
Mrsteveson Nov 18, 2019
fd31f26
Merge pull request #1 from CS22-TreasureMap/pat-steveson
Mrsteveson Nov 18, 2019
5f6f124
basic utils and new exploring utils
danielhorsley Nov 19, 2019
d781ff4
some readme isntructions in explorer guide
danielhorsley Nov 19, 2019
9f41176
formatting improvement
danielhorsley Nov 19, 2019
92c48ca
improved logic on cooldown
danielhorsley Nov 19, 2019
563a92c
map included
danielhorsley Nov 19, 2019
e23d658
more detail on explore.md
danielhorsley Nov 19, 2019
c49a93a
more markdown
danielhorsley Nov 19, 2019
b0d56af
more markdown
danielhorsley Nov 19, 2019
acc189d
more markdown
danielhorsley Nov 19, 2019
03be80c
fixing of map key bug and non update room bug
danielhorsley Nov 19, 2019
12a2d7b
Merge pull request #2 from CS22-TreasureMap/dan-horsley
PWalis Nov 19, 2019
37ccc96
Current progress on go_to_room function
PWalis Nov 19, 2019
1b658ba
Go_to_room is working! Just give it the room number as an int.
PWalis Nov 19, 2019
654176b
get_treasure
Mrsteveson Nov 19, 2019
36daae3
Merge branch 'patrickW' of https://github.com/CS22-TreasureMap/CS-Bui…
Mrsteveson Nov 19, 2019
a8f3a19
building maze
Mrsteveson Nov 19, 2019
37293ef
map fully mapped
micahjones13 Nov 19, 2019
7d30eeb
can now find and sell treasure
micahjones13 Nov 20, 2019
753512d
Can now change name. Added comments and toggled accumulate on/off acc…
micahjones13 Nov 20, 2019
25a1f3f
unique rooms mapped
Mrsteveson Nov 20, 2019
87433a5
managing conflicts
Mrsteveson Nov 20, 2019
247a8e9
cleanup and updates to get_coins
Mrsteveson Nov 20, 2019
ba19595
Merge pull request #3 from CS22-TreasureMap/pat-steveson
Mrsteveson Nov 20, 2019
e39caba
added bunch of mining functionality
Nov 20, 2019
39e0060
dash functions almost working
Nov 20, 2019
c46aac2
ls8 sort of workgin
Nov 20, 2019
893c285
corrected ls8
danielhorsley Nov 20, 2019
aed8702
auto-coins
danielhorsley Nov 20, 2019
17bd535
add retry on mine loop
danielhorsley Nov 20, 2019
b85935d
auto auto auto
danielhorsley Nov 20, 2019
0600777
better mining logic
Nov 21, 2019
86bce48
shorter mine cycle and time stop for auto
Nov 21, 2019
17f9cbb
auto.py
Nov 21, 2019
c90e555
correction
Nov 21, 2019
bb1c391
minor changes
Nov 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

#csv files
*.csv

#png files
# *.png

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "C:\\Users\\mrste\\.virtualenvs\\CS-Build-Week-2-_lfTzCd4\\Scripts\\python.exe"
}
13 changes: 13 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
python-decouple = "*"
requests = "*"

[requires]
python_version = "3.7"
64 changes: 64 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions auto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from utils import *
mappy = mapper()
mappy.create_starting_map()
mappy.auto_coins(acc=True,fly=True)
186 changes: 186 additions & 0 deletions basic_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
class Queue():
def __init__(self):
self.queue = []

def __repr__(self):
return f'{self.queue}'

def enqueue(self, value):
self.queue.append(value)

def dequeue(self):
if self.size() > 0:
return self.queue.pop(0)
else:
return None

def size(self):
return len(self.queue)


class Stack():
def __init__(self):
self.stack = []

def push(self, value):
self.stack.append(value)

def pop(self):
if self.size() > 0:
return self.stack.pop()
else:
return None

def size(self):
return len(self.stack)


class Graph:
"""Represent a graph as a dictionary of vertices mapping labels to edges."""

def __init__(self):
self.vertices = {}

def add_vertex(self, vertex):
"""
Add a vertex to the graph.
"""
if vertex not in self.vertices.keys():
self.vertices[vertex] = set()
else:
pass

def add_edge(self, v1, v2):
"""
Add a directed edge to the graph.
"""
if v1 and v2 in self.vertices.keys():
# self.vertices[v2].add(v1)
self.vertices[v1].add(v2)

def bft(self, starting_vertex):
"""
Print each vertex in breadth-first order
beginning from starting_vertex.
"""
ret_list = []
if starting_vertex is None:
return None
my_q = Queue()
visited = [starting_vertex]
my_q.enqueue(starting_vertex)
while len(my_q.queue) > 0:
point = my_q.queue[0]
joins = self.vertices[point]
for j in joins:
if j not in visited:
my_q.enqueue(j)
visited.append(j)
# print(my_q.dequeue())
ret = my_q.dequeue()
ret_list.append(ret)
return ret_list

def dft(self, starting_vertex, chooser=None):
"""
Print each vertex in depth-first order
beginning from starting_vertex.
"""
ret_list = []
if starting_vertex is None:
return None
my_s = Stack()
visited = [starting_vertex]
my_s.push(starting_vertex)
while len(my_s.stack) > 0:
point = my_s.stack[-1]
joins = self.vertices[point]
r = my_s.pop() # new code
ret_list.append(r) # new code
# print(r) ##changed to r from pop
if chooser is None:
pass
elif chooser == 'random':
joins = random.sample(joins, len(joins))
elif chooser == 'shortest':
joins = find_longest_clique(point, self, visited)
for j in joins:
if j not in visited:
my_s.push(j)
visited.append(j)
return ret_list

def dft_recursive(self, starting_vertex, visited=[]):
"""
Print each vertex in depth-first order
beginning from starting_vertex.
This should be done using recursion.
"""
print(starting_vertex)
visited.append(starting_vertex)
joins = self.vertices[starting_vertex]
if joins is None:
return None
for j in joins:
if j in visited:
pass
else:
self.dft_recursive(j, visited)

def bfs(self, starting_vertex, destination_vertex):
"""
Return a list containing the shortest path from
starting_vertex to destination_vertex in
breath-first order.
"""
print('Starting BFS')
q = Queue()
visited = set()
q.enqueue([starting_vertex])
print(f'Starting vertex: {starting_vertex}')
print(f'End Room: {destination_vertex}')

while destination_vertex not in q.queue[0]:
# while q.queue[0][-1] != destination_vertex:
# print(q)
current_point = q.queue[0][-1]
# print(f'current point: {current_point}')
joins = self.vertices[current_point].values()
# print(joins)
for j in joins:
# print(f'J: {j}')
if j != '?' and j not in visited:
visited.add(j)
_ = [x for x in q.queue[0]]
_.append(j)
q.enqueue(_)
q.dequeue()

return q.queue[0]

def dfs(self, starting_vertex, destination_vertex):
"""
Return a list containing a path from
starting_vertex to destination_vertex in
depth-first order.
"""
s = Stack()
s.push([starting_vertex])

while destination_vertex not in s.stack[-1]:
current_point = s.stack[-1][-1]

joins = self.vertices[current_point]
if joins is None:
s.pop()
else:
temp_list = []
for j in joins:
_ = [x for x in s.stack[-1]]
_.append(j)
temp_list.append(_)
for tl in temp_list:
s.push(tl)
# s.pop()

return s.stack[-1]
Loading