A project that aims to create an agent, that can solve this specific rendition of Minesweeper, titled Gem Hunter. The agent needs to be able to accept an input, that looks like a grid with numbers, and missing cells, and able to reason out which cells are safe to excavate (gems), and which cells are not safe to excavate (mines or traps).
Main collaborators:
To get started, there are packages that need to be installed. You can install them yourself:
numpy
for representing data similar to array languages. Could be needed for representing the grid.python-sat
for solving the CNFs. (my bad, I thoughtpysat
was it, butpysat
is for satellite data analysis)mypy
for static type checking.pandas
for data frames, which may not be necessary, but good to have.
Or, you can use the listed requirements.txt
file to install the packages:
pip install -r requirements.txt
The main
branch is protected, which means that you cannot push directly to it. So here's a rundown on how to start working:
- Obviously, have your own local repo updated.
- Checkout a new branch from
main
with a descriptive name, can be what you're working on, or just a variation of your name (board-randomizer
,sytanl-dev
, etc.). - Change whatever you want. Do your work.
- When done, commit and push your changes to the remote repo, with the same branch name.
- Create a pull request from your branch to
main
. - Wait for me to review (so VHD can't break it) before merging into the main branch.
Do not, (YOU VHD), commit environment files. For example, .vscode
, .idea
, __pycache__
, .mypy_cache
, .venv
, etc. When adding files to commit, do not use git add .
. Instead, use git add <specific files>
.
I settle on always lower_case
for variables, functions, methods and modules. UPPER_CASE
for constants, and PascalCase
for classes. If you have something that you do not want others to use, prefix it with an underscore _
. When you write anything, comment. Comment what and why you are doing that.
Example File
Although not recommended, if a type is way too difficult to know, you may use Any
from module typing
. But try to avoid it as much as possible.
# A constant number that does nothing, there's no reason for it.
CONSTANT_NUMBER = 42
def fib(n: int) -> int:
"""
Calculates the nth Fibonacci number.
"""
if n <= 1:
return n
return fib(n - 1) + fib(n - 2)
def long_function_that_does_nothing(a: int, b: int, c: float) -> None:
"""
This function does nothing, but it's long.
"""
c: int = a + b
d: float = c * 2
e: float = c + d
# A variable that has its type easy to see doesn't need typing.
big_variable_that_sums_all = a + b + c + d + e # BAD! Mix of int and float.
_dont_touch_this = "Please don't touch this string" # GOOD! Everyone knows it's a string.
list_of_ints: list[int] = [1, 2, 3, 4, 5]
list_of_floats: list[float] = [1.0, 2.0, 3.0, 4.0, 5.0]
import typing
actual_unknown_variable_with_no_types: typing.Any = 69
class HelloWorld:
"""
A class that prints Hello.
"""
def hello(self, someone: str) -> None:
"""
Prints Hello to someone.
"""
print(f"Hello, {someone}!")
Data will be represented as a number grid, with the following rules:
- Any number >= 0 represents the number of mines around that cell.
- A number
-1
represents a mine. - A number
-2
represents a gem. - A number
-3
represents an unknown cell.