tmscli 0.3.3__tar.gz → 0.3.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tmscli
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: runs minesweeper in your terminal, type rules for how to play
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "tmscli"
7
- version = "0.3.3"
7
+ version = "0.3.5"
8
8
  description = "runs minesweeper in your terminal, type rules for how to play"
9
9
  dependencies = []
10
10
 
@@ -21,8 +21,25 @@
21
21
  <main class="container">
22
22
  <h1>installation &amp; usage</h1>
23
23
  <p class="subhead">A guide on how to install tmscli from pypi to how to customise number of mines and the size of the board.</p>
24
+ <h2>Dependencies</h2>
25
+ <div class="install-card">
24
26
 
27
+ <h2>Install Python</h2>
28
+ <a href="https://www.python.org/getit/windows/" class="dependency-link">https://www.python.org/getit/windows/</a>
29
+ </div>
25
30
  <div class="install-card">
31
+ <h2>Check for Pip</h2>
32
+ <h3>first check</h3>
33
+ <pre><code>pip --version</code></pre>
34
+ <p>If a version shows up, precede to <a href="#installation-PyPi" class="dependency-link">Install from PyPi</a></p>
35
+ <br>
36
+ <p>If "Not Recognized" appears, follow the pip installation</p>
37
+ <h3>Installing pip</h3>
38
+ <pre><code>python -m ensurepip --upgrade</code></pre>
39
+ <p>then repeat the previous command (pip --version) to check for success</p>
40
+
41
+ </div>
42
+ <div class="install-card" id="installation-PyPi">
26
43
  <h2>Install from PyPI</h2>
27
44
  <pre><code>pip install tmscli</code></pre>
28
45
  </div>
@@ -80,12 +80,11 @@ class minesweeper():
80
80
  def check(self,board):
81
81
  if self.check_death(board):
82
82
  print('GAME OVER')
83
- self.print_ending(board)
84
- exit()
83
+ return True
85
84
  elif self.check_success(board):
86
85
  print('YOU WIN')
87
- self.print_ending(board)
88
- exit()
86
+ return True
87
+ return False
89
88
  def richochet(self,board,coord):
90
89
  x,y=coord
91
90
  board[x][y][3]=True
@@ -105,14 +104,23 @@ class minesweeper():
105
104
 
106
105
  terminal_minesweeper=minesweeper(9,5)
107
106
  # terminal_minesweeper.print_board(board)
107
+ def throw():
108
+ print('unrecognised command, please try again')
108
109
  def main_loop(board):
109
110
  try:
110
111
  while True:
111
112
  terminal_minesweeper.print_board(board)
112
113
  cmd=input()
113
114
  cmds=cmd.split()
114
- if int(cmds[1])>terminal_minesweeper.size or int(cmds[1])<0 or int(cmds[2])>terminal_minesweeper.size or int(cmds[2])<0:
115
+ if len(cmds)!=3:
116
+ throw()
117
+ continue
118
+ elif cmds[0] not in ['uc','uf','fl']:
119
+ throw()
120
+ continue
121
+ if int(cmds[1])>terminal_minesweeper.size or int(cmds[1])<=0 or int(cmds[2])>terminal_minesweeper.size or int(cmds[2])<=0:
115
122
  print('coordinate out of range, please try again')
123
+ continue
116
124
  if cmds[0]=='uc':
117
125
  if (not board[int(cmds[1])-1][int(cmds[2])-1][0]) and (not board[int(cmds[1])-1][int(cmds[2])-1][1]):
118
126
  board[int(cmds[1])-1][int(cmds[2])-1][0]=True
@@ -131,12 +139,19 @@ def main_loop(board):
131
139
  else:
132
140
  print('already not flagged')
133
141
  else:
134
- print('unrecognised command, please try again')
135
- terminal_minesweeper.check(board)
142
+ throw()
143
+ continue
144
+ if terminal_minesweeper.check(board):
145
+ terminal_minesweeper.print_ending(board)
146
+ exit()
136
147
  except KeyboardInterrupt:
137
148
  print('Interrupted')
149
+ terminal_minesweeper.print_ending(board)
138
150
  except:
151
+ if terminal_minesweeper.check(board):
152
+ exit()
139
153
  print('ERROR')
154
+ terminal_minesweeper.print_ending(board)
140
155
  def run():
141
156
  p=argparse.ArgumentParser(description='Minesweeper CLI')
142
157
  p.add_argument(
@@ -168,19 +183,21 @@ def run():
168
183
  main_loop(board)
169
184
 
170
185
  def print_rules():
171
- print('''
186
+ place='''
187
+ y------>
188
+ x
189
+ |
190
+ |
191
+ |
192
+ V'''
193
+ rules='''
172
194
  Minesweeper is a game where you uncover squares in a minefield, and discover where the mines are
173
195
  this version has a 9 x 9 board with 10 mines in it.
174
196
  commands:
175
197
  uc x y = uncovers square (x,y)
176
198
  fl x y = flags square (x,y)
177
199
  uf x y = unflags square (x,y)
178
- y------>
179
- x
180
- |
181
- |
182
- |
183
- V
200
+ #####
184
201
  Aim:
185
202
  uncover every square without a mine on it.
186
203
 
@@ -190,5 +207,12 @@ A space = covered (unknown)
190
207
  A number = the number of mines around it
191
208
  M = a mine (game over)
192
209
  If you step on a mine you lose, the number on the square is how many mines are around it (3 x 3 radius)
193
- ''')
210
+ '''
211
+ for i in rules.split('\n'):
212
+ if i=='#####':
213
+ print(place)
214
+ else:
215
+ print(i.rstrip())
216
+ input()
217
+ input('press enter to start:')
194
218
  run()
@@ -194,7 +194,6 @@ p {
194
194
  .install-card p {
195
195
  color: #cbd5e1;
196
196
  }
197
-
198
197
  pre {
199
198
  background: #0b1e2e;
200
199
  color: #b4e6ff;
@@ -247,7 +246,13 @@ pre code {
247
246
  border: 1px dashed #b4d9ec;
248
247
  margin: 2rem 0 0;
249
248
  }
249
+ .dependency-link{
250
+ color:rgb(255,255,255);
251
+ }
250
252
 
253
+ .dependency-link:hover{
254
+ color:rgb(125,125,150);
255
+ }
251
256
  /* footer */
252
257
  footer {
253
258
  text-align: center;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes