summaryrefslogtreecommitdiff
path: root/README.md
blob: c61477a4c51119964f30aa2e1bc97a37ac8548b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# gothic 1 remake lockpicking helper tool
alternative title:
> big titty gothicc gf
 
To whoever came up with the change to old lockpicking system for the remake:
you're a psycho 
I love it, 10/10 
you're the best there ever was, keep up the good work

Unfortunately my ADHD craves for instant gratification so I came up with this shitty solver. 

## assumptions
1. the interlocking of each block doesn't change
2. the correct pin slot is always the middle one
## Usage
*tests are provided in example.py*

### 1. prepare input
you'll need to define:
- how many blocks there are (`numOfBlocks`)
- how many pin slots per block there are (`numOfPinslots`) 
- for each block:
	- which pin slot the pin sits in (`initialPositions`) 
	- which block(s) move and in which direction during sliding (`edges`)

bit of explanation for `edges`:
- when you move the block left or right, other block can move as well (interlocked)
- on top of that, they can move WITH or OPPOSITE TO the selected block
- write down the block numbers that are interlocked 
	- if the block moves OPPOSITE TO selected block, then prefix it's number with minus sign `-` (negative integer) 

### parse input
##### option A - use built-in parser
run the gothpick.py program and type-in your prepared input
```
python3 gothpick.py
```
type in the input when prompted

##### option B - import the library
import the library and type in your input outside the gothpick.py 
```
import gothpick

IterateStepsManually = False
numOfBlocks = 5
numOfPins = 7
initialPositions = {
0:6,
1:3,
2:2,
3:1,
4:7
}

edges = {
0:[(1,0),(1,3)],
1:[(1,1),(1,4)],
2:[(1,2),(-1,4)],
3:[(1,3),(-1,4),(-1,2),(1,1)],
4:[(1,4)]
}

gothpick.PrintInput(initialPositions,edges)
solvedpath = gothpick.lockpick(numOfBlocks,numOfPins,initialPositions,edges)
gothpick.TranslateResults(solvedpath,IterateStepsManually)
```

### use the solution
whether you 
- were asked (option A) 
- passed an argument (option B, `IterateStepsManually`)
you had to decide if you want **step-by-step** or **complete instructions**

**step-by-step** 
one step at a time, press any key to display next step 
(i prefer this one)
**complete instructions** 
prints all instructions at once 
useful if you want to send the solution to a girl and impress her i guess