tmscli 0.2.5__tar.gz → 0.2.6__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.2.5
3
+ Version: 0.2.6
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.2.5"
7
+ version = "0.2.6"
8
8
  description = "runs minesweeper in your terminal, type rules for how to play"
9
9
  dependencies = []
10
10
 
@@ -1,4 +1,5 @@
1
1
  import random
2
+ import argparse
2
3
  class minesweeper():
3
4
  def __init__(self,size,num):
4
5
  self.size=size
@@ -109,7 +110,7 @@ def main_loop(board):
109
110
  terminal_minesweeper.print_board(board)
110
111
  cmd=input()
111
112
  cmds=cmd.split()
112
- if cmds[1]>terminal_minesweeper.size or cmds[1]<0 or cmds[2]>terminal_minesweeper.size or cmds[2]<0:
113
+ if int(cmds[1])>terminal_minesweeper.size or int(cmds[1])<0 or int(cmds[2])>terminal_minesweeper.size or int(cmds[2])<0:
113
114
  print('coordinate out of range, please try again')
114
115
  if cmds[0]=='uc':
115
116
  if (not board[int(cmds[1])-1][int(cmds[2])-1][0]) and (not board[int(cmds[1])-1][int(cmds[2])-1][1]):
@@ -132,6 +133,15 @@ def main_loop(board):
132
133
  print('unrecognised command, please try again')
133
134
  terminal_minesweeper.check(board)
134
135
  def run():
136
+ p=argparse.ArgumentParser(description='Minesweeper CLI')
137
+ p.add_argument(
138
+ '-r','--rules',
139
+ action='store_true',
140
+ help='gives rules'
141
+ )
142
+ args=p.parse_args()
143
+ if args.rules:
144
+ print_rules()
135
145
  mines=terminal_minesweeper.get_mines()
136
146
  board=terminal_minesweeper.create_starting_board(mines)
137
147
  main_loop(board)
File without changes
File without changes