minor tweaks
This commit is contained in:
parent
abde27f590
commit
ec5c2eae75
@ -15,7 +15,7 @@ A terminal-based implementation of Wordle using Python and ncurses.
|
|||||||
## How to Run
|
## How to Run
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ poetry run python pyrdle.py --help (20361d14h4m)|*[main]
|
$ poetry run python pyrdle.py --help
|
||||||
usage: pyrdle.py [-h] [--easy | --medium | --hard] [--common | --literary | --techy | --cultural | --full ]
|
usage: pyrdle.py [-h] [--easy | --medium | --hard] [--common | --literary | --techy | --cultural | --full ]
|
||||||
[--wordlist FILE]
|
[--wordlist FILE]
|
||||||
|
|
||||||
|
10
pyrdle.py
10
pyrdle.py
@ -13,7 +13,7 @@ from typing import List, Tuple
|
|||||||
|
|
||||||
WORDLIST_DIR = "wordlists"
|
WORDLIST_DIR = "wordlists"
|
||||||
|
|
||||||
class pyrdleGame:
|
class Pyrdle:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.word_list = []
|
self.word_list = []
|
||||||
self.target_word = ""
|
self.target_word = ""
|
||||||
@ -132,7 +132,7 @@ def draw_title(stdscr, y_offset: int, difficulty: str = ""):
|
|||||||
stdscr.addstr(y_offset, x, title)
|
stdscr.addstr(y_offset, x, title)
|
||||||
stdscr.attroff(curses.A_BOLD)
|
stdscr.attroff(curses.A_BOLD)
|
||||||
|
|
||||||
def draw_board(stdscr, game: pyrdleGame, y_offset: int):
|
def draw_board(stdscr, game: Pyrdle, y_offset: int):
|
||||||
"""Draw the game board with all guesses"""
|
"""Draw the game board with all guesses"""
|
||||||
height, width = stdscr.getmaxyx()
|
height, width = stdscr.getmaxyx()
|
||||||
board_x = (width - (game.word_length * 4 - 1)) // 2
|
board_x = (width - (game.word_length * 4 - 1)) // 2
|
||||||
@ -165,7 +165,7 @@ def draw_board(stdscr, game: pyrdleGame, y_offset: int):
|
|||||||
x = board_x + col * 4
|
x = board_x + col * 4
|
||||||
stdscr.addstr(y, x, "[ ]")
|
stdscr.addstr(y, x, "[ ]")
|
||||||
|
|
||||||
def draw_keyboard(stdscr, game: pyrdleGame, y_offset: int):
|
def draw_keyboard(stdscr, game: Pyrdle, y_offset: int):
|
||||||
"""Draw visual keyboard showing letter status"""
|
"""Draw visual keyboard showing letter status"""
|
||||||
height, width = stdscr.getmaxyx()
|
height, width = stdscr.getmaxyx()
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ def main(stdscr):
|
|||||||
curses.init_pair(6, curses.COLOR_WHITE, curses.COLOR_BLACK) # Unused letters (gray/dim)
|
curses.init_pair(6, curses.COLOR_WHITE, curses.COLOR_BLACK) # Unused letters (gray/dim)
|
||||||
|
|
||||||
# Initialize game
|
# Initialize game
|
||||||
game = pyrdleGame()
|
game = Pyrdle()
|
||||||
if not game.load_words(word_file):
|
if not game.load_words(word_file):
|
||||||
# Try fallback to default word list
|
# Try fallback to default word list
|
||||||
if word_file != "pyrdle_words.txt" and game.load_words("pyrdle_words.txt"):
|
if word_file != "pyrdle_words.txt" and game.load_words("pyrdle_words.txt"):
|
||||||
@ -374,7 +374,7 @@ def main(stdscr):
|
|||||||
key = stdscr.getch()
|
key = stdscr.getch()
|
||||||
if key in [ord('n'), ord('N')]:
|
if key in [ord('n'), ord('N')]:
|
||||||
# Start new game
|
# Start new game
|
||||||
game = pyrdleGame()
|
game = Pyrdle()
|
||||||
game.load_words(word_file)
|
game.load_words(word_file)
|
||||||
message = ""
|
message = ""
|
||||||
continue
|
continue
|
||||||
|
@ -180,6 +180,7 @@ BINGO
|
|||||||
BIOME
|
BIOME
|
||||||
BIPED
|
BIPED
|
||||||
BIRCH
|
BIRCH
|
||||||
|
BIRDY
|
||||||
BIRTH
|
BIRTH
|
||||||
BISON
|
BISON
|
||||||
BITER
|
BITER
|
||||||
@ -1911,6 +1912,7 @@ JOINT
|
|||||||
JOLLY
|
JOLLY
|
||||||
JUDGE
|
JUDGE
|
||||||
JUICE
|
JUICE
|
||||||
|
KARMA
|
||||||
KNIFE
|
KNIFE
|
||||||
KNOCK
|
KNOCK
|
||||||
LABEL
|
LABEL
|
||||||
@ -1949,6 +1951,7 @@ LUNCH
|
|||||||
LUMPY
|
LUMPY
|
||||||
LUNGS
|
LUNGS
|
||||||
LUNKY
|
LUNKY
|
||||||
|
LUPIS
|
||||||
LUSTY
|
LUSTY
|
||||||
LYING
|
LYING
|
||||||
MAGIC
|
MAGIC
|
||||||
@ -1999,6 +2002,7 @@ MOVED
|
|||||||
MOVIE
|
MOVIE
|
||||||
MUDDY
|
MUDDY
|
||||||
MUSIC
|
MUSIC
|
||||||
|
NADIR
|
||||||
NAIVE
|
NAIVE
|
||||||
NAKED
|
NAKED
|
||||||
NAMED
|
NAMED
|
||||||
@ -2040,6 +2044,7 @@ OWNER
|
|||||||
OXIDE
|
OXIDE
|
||||||
PAGAN
|
PAGAN
|
||||||
PAINT
|
PAINT
|
||||||
|
PANDA
|
||||||
PANEL
|
PANEL
|
||||||
PANIC
|
PANIC
|
||||||
PAPER
|
PAPER
|
||||||
@ -2108,6 +2113,8 @@ PUPIL
|
|||||||
PUPPY
|
PUPPY
|
||||||
PURSE
|
PURSE
|
||||||
QUAKE
|
QUAKE
|
||||||
|
QUARK
|
||||||
|
QUART
|
||||||
QUEEN
|
QUEEN
|
||||||
QUERY
|
QUERY
|
||||||
QUEST
|
QUEST
|
||||||
@ -2118,6 +2125,8 @@ QUILT
|
|||||||
QUITE
|
QUITE
|
||||||
QUOTA
|
QUOTA
|
||||||
QUOTE
|
QUOTE
|
||||||
|
RABID
|
||||||
|
RACER
|
||||||
RADAR
|
RADAR
|
||||||
RADIO
|
RADIO
|
||||||
RAINY
|
RAINY
|
||||||
|
Loading…
Reference in New Issue
Block a user