borse 0.1.0__tar.gz → 0.2.0__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.

Potentially problematic release.


This version of borse might be problematic. Click here for more details.

Files changed (32) hide show
  1. {borse-0.1.0 → borse-0.2.0}/CLAUDE.md +4 -3
  2. {borse-0.1.0 → borse-0.2.0}/PKG-INFO +9 -10
  3. {borse-0.1.0 → borse-0.2.0}/README.md +7 -8
  4. {borse-0.1.0 → borse-0.2.0}/pyproject.toml +5 -1
  5. {borse-0.1.0 → borse-0.2.0}/src/borse/__about__.py +1 -1
  6. {borse-0.1.0 → borse-0.2.0}/src/borse/game.py +10 -2
  7. {borse-0.1.0 → borse-0.2.0}/src/borse/progress.py +21 -0
  8. {borse-0.1.0 → borse-0.2.0}/tests/test_progress.py +52 -0
  9. {borse-0.1.0 → borse-0.2.0}/.github/workflows/ci.yml +0 -0
  10. {borse-0.1.0 → borse-0.2.0}/.github/workflows/conv-commit.yml +0 -0
  11. {borse-0.1.0 → borse-0.2.0}/.github/workflows/release.yml +0 -0
  12. {borse-0.1.0 → borse-0.2.0}/.gitignore +0 -0
  13. {borse-0.1.0 → borse-0.2.0}/.pre-commit-config.yml +0 -0
  14. {borse-0.1.0 → borse-0.2.0}/LICENSE +0 -0
  15. {borse-0.1.0 → borse-0.2.0}/morse-tree.jpg +0 -0
  16. {borse-0.1.0 → borse-0.2.0}/src/borse/WORDS.txt +0 -0
  17. {borse-0.1.0 → borse-0.2.0}/src/borse/__init__.py +0 -0
  18. {borse-0.1.0 → borse-0.2.0}/src/borse/a1z26.py +0 -0
  19. {borse-0.1.0 → borse-0.2.0}/src/borse/braille.py +0 -0
  20. {borse-0.1.0 → borse-0.2.0}/src/borse/config.py +0 -0
  21. {borse-0.1.0 → borse-0.2.0}/src/borse/main.py +0 -0
  22. {borse-0.1.0 → borse-0.2.0}/src/borse/morse.py +0 -0
  23. {borse-0.1.0 → borse-0.2.0}/src/borse/semaphore.py +0 -0
  24. {borse-0.1.0 → borse-0.2.0}/src/borse/words.py +0 -0
  25. {borse-0.1.0 → borse-0.2.0}/tests/__init__.py +0 -0
  26. {borse-0.1.0 → borse-0.2.0}/tests/test_a1z26.py +0 -0
  27. {borse-0.1.0 → borse-0.2.0}/tests/test_braille.py +0 -0
  28. {borse-0.1.0 → borse-0.2.0}/tests/test_config.py +0 -0
  29. {borse-0.1.0 → borse-0.2.0}/tests/test_morse.py +0 -0
  30. {borse-0.1.0 → borse-0.2.0}/tests/test_semaphore.py +0 -0
  31. {borse-0.1.0 → borse-0.2.0}/tests/test_words.py +0 -0
  32. {borse-0.1.0 → borse-0.2.0}/uv.lock +0 -0
@@ -2,11 +2,11 @@
2
2
 
3
3
  A terminal curses game for practicing Morse code, Braille, and flag semaphore reading.
4
4
 
5
- ## Quick Start
5
+ ## Setup
6
6
 
7
7
  ```bash
8
8
  uv sync # Install dependencies
9
- uv run borse # Run the game
9
+ prek install # Install pre-commit hooks
10
10
  ```
11
11
 
12
12
  ## Project Structure
@@ -15,9 +15,10 @@ uv run borse # Run the game
15
15
  src/borse/
16
16
  ├── main.py # Entry point, curses wrapper
17
17
  ├── game.py # Curses UI, menu, and game loop
18
- ├── morse.py # Morse code encoding (dots and dashes)
19
18
  ├── braille.py # Braille 3x2 ASCII art (filled/unfilled circles)
19
+ ├── morse.py # Morse code encoding (dots and dashes)
20
20
  ├── semaphore.py # Flag semaphore 5x5 ASCII art
21
+ ├── a1z26.py # A1Z26 practice
21
22
  ├── words.py # Common English word list
22
23
  ├── config.py # User configuration (~/.config/borse/config.toml)
23
24
  └── progress.py # Daily progress tracking
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: borse
3
- Version: 0.1.0
4
- Summary: A terminal game for practicing Morse code, Braille, and semaphore.
3
+ Version: 0.2.0
4
+ Summary: Practice braille, Morse, semaphore.
5
5
  Project-URL: repository, https://github.com/vEnhance/borse
6
6
  Author-email: Evan Chen <evan@evanchen.cc>
7
7
  License: MIT
@@ -29,13 +29,12 @@ Or you can install from PyPI by using `uv`, `pip`, etc.
29
29
 
30
30
  ## Configuration
31
31
 
32
- Configuration is stored in `~/.config/borse/config.json` by default:
32
+ Configuration is stored in `~/.config/borse/config.toml` by default, e.g.
33
33
 
34
- ```json
35
- {
36
- "progress_file": "~/.config/borse/progress.json",
37
- "words_per_game": 10
38
- }
34
+ ```toml
35
+ progress_file = "/home/evan/.config/borse/progress.json"
36
+ words_per_game = 10
37
+ single_letter_probability = 0.3
39
38
  ```
40
39
 
41
40
  Your daily progress is also automatically saved and displayed on the main menu.
@@ -116,10 +115,10 @@ Set up by cloning the repository and running
116
115
 
117
116
  ```bash
118
117
  uv sync
119
- uv run prek install
118
+ uv run prek install # pre-commit hooks
120
119
  ```
121
120
 
122
- To manually run the linter and tests
121
+ To manually run the linter and tests:
123
122
 
124
123
  ```bash
125
124
  uv run prek --all-files # run linter
@@ -16,13 +16,12 @@ Or you can install from PyPI by using `uv`, `pip`, etc.
16
16
 
17
17
  ## Configuration
18
18
 
19
- Configuration is stored in `~/.config/borse/config.json` by default:
19
+ Configuration is stored in `~/.config/borse/config.toml` by default, e.g.
20
20
 
21
- ```json
22
- {
23
- "progress_file": "~/.config/borse/progress.json",
24
- "words_per_game": 10
25
- }
21
+ ```toml
22
+ progress_file = "/home/evan/.config/borse/progress.json"
23
+ words_per_game = 10
24
+ single_letter_probability = 0.3
26
25
  ```
27
26
 
28
27
  Your daily progress is also automatically saved and displayed on the main menu.
@@ -103,10 +102,10 @@ Set up by cloning the repository and running
103
102
 
104
103
  ```bash
105
104
  uv sync
106
- uv run prek install
105
+ uv run prek install # pre-commit hooks
107
106
  ```
108
107
 
109
- To manually run the linter and tests
108
+ To manually run the linter and tests:
110
109
 
111
110
  ```bash
112
111
  uv run prek --all-files # run linter
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "borse"
3
- description = "A terminal game for practicing Morse code, Braille, and semaphore."
3
+ description = "Practice braille, Morse, semaphore."
4
4
  readme = "README.md"
5
5
  requires-python = ">=3.10,<4.0"
6
6
  dependencies = [
@@ -42,3 +42,7 @@ dev = [
42
42
  "ruff>=0.4.0",
43
43
  "ty>=0.0.1a6",
44
44
  ]
45
+
46
+ [tool.codespell]
47
+ count = ""
48
+ ignore-words-list = "alltime"
@@ -1,3 +1,3 @@
1
- __version__ = "0.1.0"
1
+ __version__ = "0.2.0"
2
2
  __author__ = "Evan Chen"
3
3
  __license__ = "MIT"
@@ -119,20 +119,28 @@ class Game:
119
119
  ]
120
120
 
121
121
  while True:
122
- row = self.draw_title("BORSE - Code Practice Game")
122
+ row = self.draw_title("BORSE - Braille mORse SEmaphore, by vEnhance")
123
123
  height, _ = self.stdscr.getmaxyx()
124
124
 
125
- # Show today's progress
125
+ # Show today's progress and all-time total
126
126
  today = self.progress.get_today()
127
+ alltime = self.progress.get_alltime_by_mode()
127
128
  progress_text = (
128
129
  f"Today: {today.total_words} words "
129
130
  f"(B:{today.braille_words} M:{today.morse_words} "
130
131
  f"S:{today.semaphore_words} A:{today.a1z26_words})"
131
132
  )
133
+ alltime_text = (
134
+ f"All-time: {alltime.total_words} words "
135
+ f"(B:{alltime.braille_words} M:{alltime.morse_words} "
136
+ f"S:{alltime.semaphore_words} A:{alltime.a1z26_words})"
137
+ )
132
138
  try:
133
139
  if curses.has_colors():
134
140
  self.stdscr.attron(curses.color_pair(3))
135
141
  self.stdscr.addstr(row, 2, progress_text)
142
+ row += 1
143
+ self.stdscr.addstr(row, 2, alltime_text)
136
144
  if curses.has_colors():
137
145
  self.stdscr.attroff(curses.color_pair(3))
138
146
  except curses.error:
@@ -90,6 +90,27 @@ class Progress:
90
90
  self.daily[today] = DailyProgress()
91
91
  return self.daily[today]
92
92
 
93
+ def get_alltime_total(self) -> int:
94
+ """Get total words answered across all days.
95
+
96
+ Returns:
97
+ Sum of all words across all days.
98
+ """
99
+ return sum(day.total_words for day in self.daily.values())
100
+
101
+ def get_alltime_by_mode(self) -> DailyProgress:
102
+ """Get all-time totals broken down by mode.
103
+
104
+ Returns:
105
+ DailyProgress with summed values across all days.
106
+ """
107
+ return DailyProgress(
108
+ morse_words=sum(day.morse_words for day in self.daily.values()),
109
+ braille_words=sum(day.braille_words for day in self.daily.values()),
110
+ semaphore_words=sum(day.semaphore_words for day in self.daily.values()),
111
+ a1z26_words=sum(day.a1z26_words for day in self.daily.values()),
112
+ )
113
+
93
114
  def add_word(self, mode: str) -> None:
94
115
  """Add a completed word for today.
95
116
 
@@ -116,6 +116,58 @@ class TestProgress:
116
116
  today = progress.get_today()
117
117
  assert today.morse_words == 5
118
118
 
119
+ def test_get_alltime_total_empty(self) -> None:
120
+ """Test all-time total with no progress."""
121
+ progress = Progress()
122
+ assert progress.get_alltime_total() == 0
123
+
124
+ def test_get_alltime_total_single_day(self) -> None:
125
+ """Test all-time total with single day."""
126
+ progress = Progress()
127
+ progress.add_word("morse")
128
+ progress.add_word("braille")
129
+ progress.add_word("semaphore")
130
+ assert progress.get_alltime_total() == 3
131
+
132
+ def test_get_alltime_total_multiple_days(self) -> None:
133
+ """Test all-time total across multiple days."""
134
+ progress = Progress(
135
+ daily={
136
+ "2024-01-01": DailyProgress(morse_words=5, braille_words=3),
137
+ "2024-01-02": DailyProgress(semaphore_words=2, a1z26_words=4),
138
+ "2024-01-03": DailyProgress(morse_words=1),
139
+ }
140
+ )
141
+ assert progress.get_alltime_total() == 15
142
+
143
+ def test_get_alltime_by_mode_empty(self) -> None:
144
+ """Test all-time by mode with no progress."""
145
+ progress = Progress()
146
+ alltime = progress.get_alltime_by_mode()
147
+ assert alltime.morse_words == 0
148
+ assert alltime.braille_words == 0
149
+ assert alltime.semaphore_words == 0
150
+ assert alltime.a1z26_words == 0
151
+ assert alltime.total_words == 0
152
+
153
+ def test_get_alltime_by_mode_multiple_days(self) -> None:
154
+ """Test all-time by mode across multiple days."""
155
+ progress = Progress(
156
+ daily={
157
+ "2024-01-01": DailyProgress(morse_words=5, braille_words=3),
158
+ "2024-01-02": DailyProgress(
159
+ morse_words=2, semaphore_words=2, a1z26_words=4
160
+ ),
161
+ "2024-01-03": DailyProgress(morse_words=1, braille_words=1),
162
+ }
163
+ )
164
+ alltime = progress.get_alltime_by_mode()
165
+ assert alltime.morse_words == 8
166
+ assert alltime.braille_words == 4
167
+ assert alltime.semaphore_words == 2
168
+ assert alltime.a1z26_words == 4
169
+ assert alltime.total_words == 18
170
+
119
171
 
120
172
  class TestLoadSaveProgress:
121
173
  """Tests for load_progress and save_progress functions."""
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes