EZTIME2025 commited on
Commit
4dd77af
·
1 Parent(s): d9c12b7

שיפור בניית ערים

Browse files
.github/instructions/BUILD_PLAN.md CHANGED
@@ -46,8 +46,9 @@
46
  - [x] error handling משופר (בסיסי)
47
 
48
  **הערות:**
49
- - פונקציית `add_city` ב-Game מכילה באג (משתנים לא מוגדרים)
50
- - מיפוי פעולות מסחר וערים ב-GameManager עדיין לא מומש מלא
 
51
 
52
  ### משימה 3.2: Validation & Error Handling
53
  **סטטוס:** 🟡 בתהליך
@@ -60,24 +61,30 @@
60
 
61
  ### משימה 3.3: End-to-End Testing
62
  **סטטוס:** 🟢 בעבודה פעילה!
63
- **זהו הפוקוס הנוכחי - 10 דצמבר 2025**
64
 
65
  - [x] הרצת משחק מלא עם HumanUser
66
  - [x] בדיקת כל סוגי הפעולות (בנייה, גלגול קוביות)
67
  - [x] זיהוי ותיקון באגים בזמן אמת
68
  - [x] וידוא סנכרון בין ה-Visualizations למצב המשחק
69
 
70
- **תיקונים שבוצעו היום:**
71
  - ✅ תיקון כפתור ה-i בתצוגת הווב (Building Costs modal)
72
  - ✅ תיקון הצגת שמות שחקנים במקום "Player X" (web + console)
73
  - ✅ מימוש מלא של קניית קלפי פיתוח (BUY_DEV_CARD)
74
  - ✅ תיקון 2 באגים ב-game.py ו-player.py (DevCard.VictoryPoint)
75
  - ✅ תשתית לשימוש בקלפי פיתוח עם הודעות מועילות למשתמש
76
  - ✅ שיפור תיעוד ה-help עם הסבר מלא על כל קלפי הפיתוח
 
 
 
 
 
 
77
 
78
  **מה שעובד כרגע:**
79
  - ✨ משחק מלא עם 3 שחקנים
80
- - ✨ בנייה: יישובים, כבישים, ערים
81
  - ✨ גלגול קוביות וחלוקת משאבים
82
  - ✨ חוק ה-7: השלכת קלפים, העברת רובר, גניבת קלף
83
  - ✨ מסחר עם הבנק
 
46
  - [x] error handling משופר (בסיסי)
47
 
48
  **הערות:**
49
+ - ✅ **תיקון באג `add_city`** - תוקן שימוש במשתנים לא מוגדרים (15 דצמבר 2025)
50
+ - ✅ **מימוש בניית ערים מלא** - `_execute_build_city` עכשיו פונקציונלי (15 דצמבר 2025)
51
+ - מיפוי פעולות מסחר עדיין לא מומש מלא
52
 
53
  ### משימה 3.2: Validation & Error Handling
54
  **סטטוס:** 🟡 בתהליך
 
61
 
62
  ### משימה 3.3: End-to-End Testing
63
  **סטטוס:** 🟢 בעבודה פעילה!
64
+ **עדכון אחרון:** 15 דצמבר 2025
65
 
66
  - [x] הרצת משחק מלא עם HumanUser
67
  - [x] בדיקת כל סוגי הפעולות (בנייה, גלגול קוביות)
68
  - [x] זיהוי ותיקון באגים בזמן אמת
69
  - [x] וידוא סנכרון בין ה-Visualizations למצב המשחק
70
 
71
+ **תיקונים שבוצעו:**
72
  - ✅ תיקון כפתור ה-i בתצוגת הווב (Building Costs modal)
73
  - ✅ תיקון הצגת שמות שחקנים במקום "Player X" (web + console)
74
  - ✅ מימוש מלא של קניית קלפי פיתוח (BUY_DEV_CARD)
75
  - ✅ תיקון 2 באגים ב-game.py ו-player.py (DevCard.VictoryPoint)
76
  - ✅ תשתית לשימוש בקלפי פיתוח עם הודעות מועילות למשתמש
77
  - ✅ שיפור תיעוד ה-help עם הסבר מלא על כל קלפי הפיתוח
78
+ - ✅ **בניית ערים - תיקון מלא (15 דצמבר 2025)**:
79
+ - תיקון באג ב-`human_user.py` - שימוש ב-`board_definition` במקום פונקציה חסרה
80
+ - תיקון באג ב-`game.py` - משתנים לא מוגדרים בפונקציה `add_city`
81
+ - מימוש מלא של `_execute_build_city` ב-`game_manager.py`
82
+ - המרת הודעות שגיאה למספרי נקודות (point 44) במקום קואורדינטות
83
+ - הצגת הודעות שגיאה בקונסול הראשי של המשתמש
84
 
85
  **מה שעובד כרגע:**
86
  - ✨ משחק מלא עם 3 שחקנים
87
+ - ✨ בנייה: יישובים, כבישים, **ערים** ✅ (תוקן 15 דצמבר!)
88
  - ✨ גלגול קוביות וחלוקת משאבים
89
  - ✨ חוק ה-7: השלכת קלפים, העברת רובר, גניבת קלף
90
  - ✨ מסחר עם הבנק
game_viz.log CHANGED
@@ -22,7 +22,7 @@ Current Player: ► a
22
  Resources: None
23
  Buildings: Settlements: 0, Cities: 0, Roads: 0
24
 
25
- c
26
  Victory Points: 0
27
  Resources: None
28
  Buildings: Settlements: 0, Cities: 0, Roads: 0
@@ -53,7 +53,7 @@ Current Player: ► a
53
  Resources: None
54
  Buildings: Settlements: 0, Cities: 0, Roads: 0
55
 
56
- c
57
  Victory Points: 0
58
  Resources: None
59
  Buildings: Settlements: 0, Cities: 0, Roads: 0
@@ -86,7 +86,7 @@ Current Player: ► b
86
  Resources: None
87
  Buildings: Settlements: 1, Cities: 0, Roads: 0
88
 
89
- c
90
  Victory Points: 0
91
  Resources: None
92
  Buildings: Settlements: 0, Cities: 0, Roads: 0
@@ -117,7 +117,7 @@ Current Player: ► b
117
  Resources: None
118
  Buildings: Settlements: 1, Cities: 0, Roads: 1
119
 
120
- c
121
  Victory Points: 0
122
  Resources: None
123
  Buildings: Settlements: 0, Cities: 0, Roads: 0
@@ -127,15 +127,15 @@ Current Player: ► b
127
  Board Tiles: 19 tiles configured
128
 
129
 
130
- >>> Turn 2: c's turn
131
- ✓ c built a settlement
132
 
133
  ==================================================
134
   GAME STATE 
135
  ==================================================
136
 
137
  Turn: 2
138
- Current Player: ► c
139
 
140
  PLAYERS
141
  -------
@@ -150,7 +150,7 @@ Current Player: ► c
150
  Resources: None
151
  Buildings: Settlements: 1, Cities: 0, Roads: 1
152
 
153
- ► c
154
  Victory Points: 1
155
  Resources: None
156
  Buildings: Settlements: 1, Cities: 0, Roads: 0
@@ -159,14 +159,14 @@ Current Player: ► c
159
  -----
160
  Board Tiles: 19 tiles configured
161
 
162
- ✓ c built a road
163
 
164
  ==================================================
165
   GAME STATE 
166
  ==================================================
167
 
168
  Turn: 2
169
- Current Player: ► c
170
 
171
  PLAYERS
172
  -------
@@ -181,7 +181,7 @@ Current Player: ► c
181
  Resources: None
182
  Buildings: Settlements: 1, Cities: 0, Roads: 1
183
 
184
- ► c
185
  Victory Points: 1
186
  Resources: None
187
  Buildings: Settlements: 1, Cities: 0, Roads: 1
@@ -191,18 +191,18 @@ Current Player: ► c
191
  Board Tiles: 19 tiles configured
192
 
193
 
194
- >>> Turn 3: c's turn
195
 
196
  📦 Resources distributed:
197
- c: Ore, Wheat, Wheat
198
- ✓ c built a settlement
199
 
200
  ==================================================
201
   GAME STATE 
202
  ==================================================
203
 
204
  Turn: 3
205
- Current Player: ► c
206
 
207
  PLAYERS
208
  -------
@@ -217,7 +217,7 @@ Current Player: ► c
217
  Resources: None
218
  Buildings: Settlements: 1, Cities: 0, Roads: 1
219
 
220
- ► c
221
  Victory Points: 2
222
  Resources: None
223
  Buildings: Settlements: 2, Cities: 0, Roads: 1
@@ -226,14 +226,14 @@ Current Player: ► c
226
  -----
227
  Board Tiles: 19 tiles configured
228
 
229
- ✓ c built a road
230
 
231
  ==================================================
232
   GAME STATE 
233
  ==================================================
234
 
235
  Turn: 3
236
- Current Player: ► c
237
 
238
  PLAYERS
239
  -------
@@ -248,7 +248,7 @@ Current Player: ► c
248
  Resources: None
249
  Buildings: Settlements: 1, Cities: 0, Roads: 1
250
 
251
- ► c
252
  Victory Points: 2
253
  Resources: None
254
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -284,7 +284,7 @@ Current Player: ► b
284
  Resources: None
285
  Buildings: Settlements: 2, Cities: 0, Roads: 1
286
 
287
- c
288
  Victory Points: 2
289
  Resources: None
290
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -315,7 +315,7 @@ Current Player: ► b
315
  Resources: None
316
  Buildings: Settlements: 2, Cities: 0, Roads: 2
317
 
318
- c
319
  Victory Points: 2
320
  Resources: None
321
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -351,7 +351,7 @@ Current Player: ► a
351
  Resources: None
352
  Buildings: Settlements: 2, Cities: 0, Roads: 2
353
 
354
- c
355
  Victory Points: 2
356
  Resources: None
357
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -382,7 +382,7 @@ Current Player: ► a
382
  Resources: None
383
  Buildings: Settlements: 2, Cities: 0, Roads: 2
384
 
385
- c
386
  Victory Points: 2
387
  Resources: None
388
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -421,7 +421,7 @@ Current Player: ► a
421
  Resources: None
422
  Buildings: Settlements: 2, Cities: 0, Roads: 2
423
 
424
- c
425
  Victory Points: 2
426
  Resources: None
427
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -452,7 +452,7 @@ Current Player: ► a
452
  Resources: None
453
  Buildings: Settlements: 2, Cities: 0, Roads: 2
454
 
455
- c
456
  Victory Points: 2
457
  Resources: None
458
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -487,7 +487,7 @@ Current Player: ► b
487
  Resources: None
488
  Buildings: Settlements: 2, Cities: 0, Roads: 2
489
 
490
- c
491
  Victory Points: 2
492
  Resources: None
493
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -518,7 +518,7 @@ Current Player: ► b
518
  Resources: None
519
  Buildings: Settlements: 2, Cities: 0, Roads: 2
520
 
521
- c
522
  Victory Points: 2
523
  Resources: None
524
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -549,7 +549,7 @@ Current Player: ► b
549
  Resources: None
550
  Buildings: Settlements: 2, Cities: 0, Roads: 2
551
 
552
- c
553
  Victory Points: 2
554
  Resources: None
555
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -559,21 +559,21 @@ Current Player: ► b
559
  Board Tiles: 19 tiles configured
560
 
561
 
562
- >>> Turn 8: c's turn
563
 
564
- 🎲 c rolled: 3 + 5 = 8
565
 
566
  📦 Resources distributed:
567
  Player 1: Sheep
568
  Player 2: Wheat
569
- ✓ c rolled the dice
570
 
571
  ==================================================
572
   GAME STATE 
573
  ==================================================
574
 
575
  Turn: 8
576
- Current Player: ► c
577
 
578
  PLAYERS
579
  -------
@@ -588,7 +588,7 @@ Current Player: ► c
588
  Resources: None
589
  Buildings: Settlements: 2, Cities: 0, Roads: 2
590
 
591
- ► c
592
  Victory Points: 2
593
  Resources: None
594
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -597,14 +597,14 @@ Current Player: ► c
597
  -----
598
  Board Tiles: 19 tiles configured
599
 
600
- ✓ c ended their turn
601
 
602
  ==================================================
603
   GAME STATE 
604
  ==================================================
605
 
606
  Turn: 8
607
- Current Player: ► c
608
 
609
  PLAYERS
610
  -------
@@ -619,7 +619,7 @@ Current Player: ► c
619
  Resources: None
620
  Buildings: Settlements: 2, Cities: 0, Roads: 2
621
 
622
- ► c
623
  Victory Points: 2
624
  Resources: None
625
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -654,7 +654,7 @@ Current Player: ► a
654
  Resources: None
655
  Buildings: Settlements: 2, Cities: 0, Roads: 2
656
 
657
- c
658
  Victory Points: 2
659
  Resources: None
660
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -685,7 +685,7 @@ Current Player: ► a
685
  Resources: None
686
  Buildings: Settlements: 2, Cities: 0, Roads: 2
687
 
688
- c
689
  Victory Points: 2
690
  Resources: None
691
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -716,7 +716,7 @@ Current Player: ► a
716
  Resources: None
717
  Buildings: Settlements: 2, Cities: 0, Roads: 2
718
 
719
- c
720
  Victory Points: 2
721
  Resources: None
722
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -754,7 +754,7 @@ Current Player: ► b
754
  Resources: None
755
  Buildings: Settlements: 2, Cities: 0, Roads: 2
756
 
757
- c
758
  Victory Points: 2
759
  Resources: None
760
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -786,7 +786,7 @@ Current Player: ► b
786
  Dev Cards: 1
787
  Buildings: Settlements: 2, Cities: 0, Roads: 2
788
 
789
- c
790
  Victory Points: 2
791
  Resources: None
792
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -817,7 +817,7 @@ Current Player: ► b
817
  Resources: None
818
  Buildings: Settlements: 2, Cities: 0, Roads: 4
819
 
820
- c
821
  Victory Points: 2
822
  Resources: None
823
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -848,7 +848,7 @@ Current Player: ► b
848
  Resources: None
849
  Buildings: Settlements: 2, Cities: 0, Roads: 4
850
 
851
- c
852
  Victory Points: 2
853
  Resources: None
854
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -858,20 +858,20 @@ Current Player: ► b
858
  Board Tiles: 19 tiles configured
859
 
860
 
861
- >>> Turn 11: c's turn
862
 
863
- 🎲 c rolled: 5 + 4 = 9
864
 
865
  📦 Resources distributed:
866
  Player 3: Wheat, Wheat
867
- ✓ c rolled the dice
868
 
869
  ==================================================
870
   GAME STATE 
871
  ==================================================
872
 
873
  Turn: 11
874
- Current Player: ► c
875
 
876
  PLAYERS
877
  -------
@@ -886,7 +886,7 @@ Current Player: ► c
886
  Resources: None
887
  Buildings: Settlements: 2, Cities: 0, Roads: 4
888
 
889
- ► c
890
  Victory Points: 2
891
  Resources: None
892
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -895,14 +895,14 @@ Current Player: ► c
895
  -----
896
  Board Tiles: 19 tiles configured
897
 
898
- ✓ c proposed a trade
899
 
900
  ==================================================
901
   GAME STATE 
902
  ==================================================
903
 
904
  Turn: 11
905
- Current Player: ► c
906
 
907
  PLAYERS
908
  -------
@@ -917,7 +917,7 @@ Current Player: ► c
917
  Resources: None
918
  Buildings: Settlements: 2, Cities: 0, Roads: 4
919
 
920
- ► c
921
  Victory Points: 2
922
  Resources: None
923
  Buildings: Settlements: 2, Cities: 0, Roads: 2
@@ -926,3 +926,99 @@ Current Player: ► c
926
  -----
927
  Board Tiles: 19 tiles configured
928
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  Resources: None
23
  Buildings: Settlements: 0, Cities: 0, Roads: 0
24
 
25
+ s
26
  Victory Points: 0
27
  Resources: None
28
  Buildings: Settlements: 0, Cities: 0, Roads: 0
 
53
  Resources: None
54
  Buildings: Settlements: 0, Cities: 0, Roads: 0
55
 
56
+ s
57
  Victory Points: 0
58
  Resources: None
59
  Buildings: Settlements: 0, Cities: 0, Roads: 0
 
86
  Resources: None
87
  Buildings: Settlements: 1, Cities: 0, Roads: 0
88
 
89
+ s
90
  Victory Points: 0
91
  Resources: None
92
  Buildings: Settlements: 0, Cities: 0, Roads: 0
 
117
  Resources: None
118
  Buildings: Settlements: 1, Cities: 0, Roads: 1
119
 
120
+ s
121
  Victory Points: 0
122
  Resources: None
123
  Buildings: Settlements: 0, Cities: 0, Roads: 0
 
127
  Board Tiles: 19 tiles configured
128
 
129
 
130
+ >>> Turn 2: s's turn
131
+ ✓ s built a settlement
132
 
133
  ==================================================
134
   GAME STATE 
135
  ==================================================
136
 
137
  Turn: 2
138
+ Current Player: ► s
139
 
140
  PLAYERS
141
  -------
 
150
  Resources: None
151
  Buildings: Settlements: 1, Cities: 0, Roads: 1
152
 
153
+ ► s
154
  Victory Points: 1
155
  Resources: None
156
  Buildings: Settlements: 1, Cities: 0, Roads: 0
 
159
  -----
160
  Board Tiles: 19 tiles configured
161
 
162
+ ✓ s built a road
163
 
164
  ==================================================
165
   GAME STATE 
166
  ==================================================
167
 
168
  Turn: 2
169
+ Current Player: ► s
170
 
171
  PLAYERS
172
  -------
 
181
  Resources: None
182
  Buildings: Settlements: 1, Cities: 0, Roads: 1
183
 
184
+ ► s
185
  Victory Points: 1
186
  Resources: None
187
  Buildings: Settlements: 1, Cities: 0, Roads: 1
 
191
  Board Tiles: 19 tiles configured
192
 
193
 
194
+ >>> Turn 3: s's turn
195
 
196
  📦 Resources distributed:
197
+ s: Ore, Wheat, Wheat
198
+ ✓ s built a settlement
199
 
200
  ==================================================
201
   GAME STATE 
202
  ==================================================
203
 
204
  Turn: 3
205
+ Current Player: ► s
206
 
207
  PLAYERS
208
  -------
 
217
  Resources: None
218
  Buildings: Settlements: 1, Cities: 0, Roads: 1
219
 
220
+ ► s
221
  Victory Points: 2
222
  Resources: None
223
  Buildings: Settlements: 2, Cities: 0, Roads: 1
 
226
  -----
227
  Board Tiles: 19 tiles configured
228
 
229
+ ✓ s built a road
230
 
231
  ==================================================
232
   GAME STATE 
233
  ==================================================
234
 
235
  Turn: 3
236
+ Current Player: ► s
237
 
238
  PLAYERS
239
  -------
 
248
  Resources: None
249
  Buildings: Settlements: 1, Cities: 0, Roads: 1
250
 
251
+ ► s
252
  Victory Points: 2
253
  Resources: None
254
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
284
  Resources: None
285
  Buildings: Settlements: 2, Cities: 0, Roads: 1
286
 
287
+ s
288
  Victory Points: 2
289
  Resources: None
290
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
315
  Resources: None
316
  Buildings: Settlements: 2, Cities: 0, Roads: 2
317
 
318
+ s
319
  Victory Points: 2
320
  Resources: None
321
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
351
  Resources: None
352
  Buildings: Settlements: 2, Cities: 0, Roads: 2
353
 
354
+ s
355
  Victory Points: 2
356
  Resources: None
357
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
382
  Resources: None
383
  Buildings: Settlements: 2, Cities: 0, Roads: 2
384
 
385
+ s
386
  Victory Points: 2
387
  Resources: None
388
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
421
  Resources: None
422
  Buildings: Settlements: 2, Cities: 0, Roads: 2
423
 
424
+ s
425
  Victory Points: 2
426
  Resources: None
427
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
452
  Resources: None
453
  Buildings: Settlements: 2, Cities: 0, Roads: 2
454
 
455
+ s
456
  Victory Points: 2
457
  Resources: None
458
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
487
  Resources: None
488
  Buildings: Settlements: 2, Cities: 0, Roads: 2
489
 
490
+ s
491
  Victory Points: 2
492
  Resources: None
493
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
518
  Resources: None
519
  Buildings: Settlements: 2, Cities: 0, Roads: 2
520
 
521
+ s
522
  Victory Points: 2
523
  Resources: None
524
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
549
  Resources: None
550
  Buildings: Settlements: 2, Cities: 0, Roads: 2
551
 
552
+ s
553
  Victory Points: 2
554
  Resources: None
555
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
559
  Board Tiles: 19 tiles configured
560
 
561
 
562
+ >>> Turn 8: s's turn
563
 
564
+ 🎲 s rolled: 3 + 5 = 8
565
 
566
  📦 Resources distributed:
567
  Player 1: Sheep
568
  Player 2: Wheat
569
+ ✓ s rolled the dice
570
 
571
  ==================================================
572
   GAME STATE 
573
  ==================================================
574
 
575
  Turn: 8
576
+ Current Player: ► s
577
 
578
  PLAYERS
579
  -------
 
588
  Resources: None
589
  Buildings: Settlements: 2, Cities: 0, Roads: 2
590
 
591
+ ► s
592
  Victory Points: 2
593
  Resources: None
594
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
597
  -----
598
  Board Tiles: 19 tiles configured
599
 
600
+ ✓ s ended their turn
601
 
602
  ==================================================
603
   GAME STATE 
604
  ==================================================
605
 
606
  Turn: 8
607
+ Current Player: ► s
608
 
609
  PLAYERS
610
  -------
 
619
  Resources: None
620
  Buildings: Settlements: 2, Cities: 0, Roads: 2
621
 
622
+ ► s
623
  Victory Points: 2
624
  Resources: None
625
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
654
  Resources: None
655
  Buildings: Settlements: 2, Cities: 0, Roads: 2
656
 
657
+ s
658
  Victory Points: 2
659
  Resources: None
660
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
685
  Resources: None
686
  Buildings: Settlements: 2, Cities: 0, Roads: 2
687
 
688
+ s
689
  Victory Points: 2
690
  Resources: None
691
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
716
  Resources: None
717
  Buildings: Settlements: 2, Cities: 0, Roads: 2
718
 
719
+ s
720
  Victory Points: 2
721
  Resources: None
722
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
754
  Resources: None
755
  Buildings: Settlements: 2, Cities: 0, Roads: 2
756
 
757
+ s
758
  Victory Points: 2
759
  Resources: None
760
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
786
  Dev Cards: 1
787
  Buildings: Settlements: 2, Cities: 0, Roads: 2
788
 
789
+ s
790
  Victory Points: 2
791
  Resources: None
792
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
817
  Resources: None
818
  Buildings: Settlements: 2, Cities: 0, Roads: 4
819
 
820
+ s
821
  Victory Points: 2
822
  Resources: None
823
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
848
  Resources: None
849
  Buildings: Settlements: 2, Cities: 0, Roads: 4
850
 
851
+ s
852
  Victory Points: 2
853
  Resources: None
854
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
858
  Board Tiles: 19 tiles configured
859
 
860
 
861
+ >>> Turn 11: s's turn
862
 
863
+ 🎲 s rolled: 5 + 4 = 9
864
 
865
  📦 Resources distributed:
866
  Player 3: Wheat, Wheat
867
+ ✓ s rolled the dice
868
 
869
  ==================================================
870
   GAME STATE 
871
  ==================================================
872
 
873
  Turn: 11
874
+ Current Player: ► s
875
 
876
  PLAYERS
877
  -------
 
886
  Resources: None
887
  Buildings: Settlements: 2, Cities: 0, Roads: 4
888
 
889
+ ► s
890
  Victory Points: 2
891
  Resources: None
892
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
895
  -----
896
  Board Tiles: 19 tiles configured
897
 
898
+ ✓ s proposed a trade
899
 
900
  ==================================================
901
   GAME STATE 
902
  ==================================================
903
 
904
  Turn: 11
905
+ Current Player: ► s
906
 
907
  PLAYERS
908
  -------
 
917
  Resources: None
918
  Buildings: Settlements: 2, Cities: 0, Roads: 4
919
 
920
+ ► s
921
  Victory Points: 2
922
  Resources: None
923
  Buildings: Settlements: 2, Cities: 0, Roads: 2
 
926
  -----
927
  Board Tiles: 19 tiles configured
928
 
929
+ ✗ s built a city
930
+ Error: You don't own the settlement at point 40
931
+
932
+ ==================================================
933
+  GAME STATE 
934
+ ==================================================
935
+
936
+ Turn: 11
937
+ Current Player: ► s
938
+
939
+ PLAYERS
940
+ -------
941
+
942
+ a
943
+ Victory Points: 2
944
+ Resources: None
945
+ Buildings: Settlements: 2, Cities: 0, Roads: 2
946
+
947
+ b
948
+ Victory Points: 2
949
+ Resources: None
950
+ Buildings: Settlements: 2, Cities: 0, Roads: 4
951
+
952
+ ► s
953
+ Victory Points: 2
954
+ Resources: None
955
+ Buildings: Settlements: 2, Cities: 0, Roads: 2
956
+
957
+ BOARD
958
+ -----
959
+ Board Tiles: 19 tiles configured
960
+
961
+ ✓ s built a city
962
+
963
+ ==================================================
964
+  GAME STATE 
965
+ ==================================================
966
+
967
+ Turn: 11
968
+ Current Player: ► s
969
+
970
+ PLAYERS
971
+ -------
972
+
973
+ a
974
+ Victory Points: 2
975
+ Resources: None
976
+ Buildings: Settlements: 2, Cities: 0, Roads: 2
977
+
978
+ b
979
+ Victory Points: 2
980
+ Resources: None
981
+ Buildings: Settlements: 2, Cities: 0, Roads: 4
982
+
983
+ ► s
984
+ Victory Points: 3
985
+ Resources: None
986
+ Buildings: Settlements: 1, Cities: 1, Roads: 2
987
+
988
+ BOARD
989
+ -----
990
+ Board Tiles: 19 tiles configured
991
+
992
+ ✓ s ended their turn
993
+
994
+ ==================================================
995
+  GAME STATE 
996
+ ==================================================
997
+
998
+ Turn: 11
999
+ Current Player: ► s
1000
+
1001
+ PLAYERS
1002
+ -------
1003
+
1004
+ a
1005
+ Victory Points: 2
1006
+ Resources: None
1007
+ Buildings: Settlements: 2, Cities: 0, Roads: 2
1008
+
1009
+ b
1010
+ Victory Points: 2
1011
+ Resources: None
1012
+ Buildings: Settlements: 2, Cities: 0, Roads: 4
1013
+
1014
+ ► s
1015
+ Victory Points: 3
1016
+ Resources: None
1017
+ Buildings: Settlements: 1, Cities: 1, Roads: 2
1018
+
1019
+ BOARD
1020
+ -----
1021
+ Board Tiles: 19 tiles configured
1022
+
1023
+
1024
+ >>> Turn 12: a's turn
pycatan/game.py CHANGED
@@ -197,11 +197,13 @@ class Game:
197
 
198
  # changes a settlement on the board for a city
199
  def add_city(self, point, player):
200
- status = self.board.upgrade_settlement(player, r, i)
 
201
 
202
  if status == Statuses.ALL_GOOD:
203
  # checks if the player won
204
  if self.players[player].get_VP() >= 10:
 
205
  self.winner = player
206
 
207
  return status
 
197
 
198
  # changes a settlement on the board for a city
199
  def add_city(self, point, player):
200
+ # Upgrade settlement to city using the point object
201
+ status = self.board.upgrade_settlement(player, point)
202
 
203
  if status == Statuses.ALL_GOOD:
204
  # checks if the player won
205
  if self.players[player].get_VP() >= 10:
206
+ self.has_ended = True
207
  self.winner = player
208
 
209
  return status
pycatan/game_manager.py CHANGED
@@ -383,21 +383,54 @@ class GameManager:
383
 
384
  coords = action.parameters['point_coords']
385
 
386
- # Get the point object from board
387
  try:
388
  point = self.game.board.points[coords[0]][coords[1]]
 
 
 
 
389
  except (IndexError, TypeError):
390
  return ActionResult.failure_result(
391
  f"Invalid coordinates: {coords}",
392
  "INVALID_COORDS"
393
  )
394
 
395
- # Call the actual Game method (add_city doesn't exist, need to implement via settlement upgrade)
396
- # For now, return not implemented
397
- return ActionResult.failure_result(
398
- "City building not yet implemented in Game class",
399
- "NOT_IMPLEMENTED"
400
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
 
402
  def _execute_build_road(self, action: Action) -> ActionResult:
403
  """Execute road building action."""
 
383
 
384
  coords = action.parameters['point_coords']
385
 
386
+ # Get the point object from board and convert coords to point ID
387
  try:
388
  point = self.game.board.points[coords[0]][coords[1]]
389
+ # Try to get the point ID for better user messages
390
+ from pycatan.board_definition import board_definition
391
+ point_id = board_definition.game_coords_to_point_id(coords[0], coords[1])
392
+ location_str = f"point {point_id}" if point_id else f"coordinates {coords}"
393
  except (IndexError, TypeError):
394
  return ActionResult.failure_result(
395
  f"Invalid coordinates: {coords}",
396
  "INVALID_COORDS"
397
  )
398
 
399
+ # Upgrade the settlement to a city
400
+ status = self.game.add_city(point, action.player_id)
401
+
402
+ # Convert status to ActionResult
403
+ if status == Statuses.ALL_GOOD:
404
+ player = self.game.players[action.player_id]
405
+ return ActionResult.success_result(
406
+ f"City built at {location_str}! Victory Points: {player.get_VP()}",
407
+ "CITY_BUILT"
408
+ )
409
+ elif status == Statuses.ERR_NOT_EXIST:
410
+ return ActionResult.failure_result(
411
+ f"No settlement found at {location_str} to upgrade",
412
+ "NO_SETTLEMENT"
413
+ )
414
+ elif status == Statuses.ERR_BAD_OWNER:
415
+ return ActionResult.failure_result(
416
+ f"You don't own the settlement at {location_str}",
417
+ "NOT_YOUR_SETTLEMENT"
418
+ )
419
+ elif status == Statuses.ERR_UPGRADE_CITY:
420
+ return ActionResult.failure_result(
421
+ f"Already a city at {location_str}",
422
+ "ALREADY_CITY"
423
+ )
424
+ elif status == Statuses.ERR_CARDS:
425
+ return ActionResult.failure_result(
426
+ "Not enough resources. Need: 3 Ore, 2 Wheat",
427
+ "NOT_ENOUGH_RESOURCES"
428
+ )
429
+ else:
430
+ return ActionResult.failure_result(
431
+ f"Failed to build city: {status.name}",
432
+ status.name
433
+ )
434
 
435
  def _execute_build_road(self, action: Action) -> ActionResult:
436
  """Execute road building action."""
pycatan/game_moves_3Players.txt CHANGED
@@ -31,3 +31,6 @@ end
31
  roll
32
  t player a nothing for ore 2
33
  y
 
 
 
 
31
  roll
32
  t player a nothing for ore 2
33
  y
34
+ c 40
35
+ c 44
36
+ end
pycatan/human_user.py CHANGED
@@ -278,10 +278,10 @@ class HumanUser(User):
278
  try:
279
  point = int(parts[1])
280
 
281
- # Convert point to coordinates
282
- coords = point_to_coords(point)
283
  if coords is None:
284
- raise UserInputError(f"Invalid point number: {point}. Valid points: 1-{len(get_all_points())}")
285
 
286
  row, index = coords
287
 
@@ -889,9 +889,12 @@ class HumanUser(User):
889
 
890
  def notify_action(self, action: Action, success: bool, message: str = "") -> None:
891
  """Notify the user about an action result."""
892
- # Don't print here - the console visualization already displays this
893
- # This method is kept for compatibility but doesn't produce output
894
- pass
 
 
 
895
 
896
  def notify_game_event(self, event_type: str, message: str,
897
  affected_players: Optional[List[int]] = None) -> None:
 
278
  try:
279
  point = int(parts[1])
280
 
281
+ # Convert point to coordinates using BoardDefinition
282
+ coords = board_definition.point_id_to_game_coords(point)
283
  if coords is None:
284
+ raise UserInputError(f"Invalid point number: {point}. Valid points: 1-{len(board_definition.get_all_point_ids())}")
285
 
286
  row, index = coords
287
 
 
889
 
890
  def notify_action(self, action: Action, success: bool, message: str = "") -> None:
891
  """Notify the user about an action result."""
892
+ # Display success/error messages to the user in their input console
893
+ if message:
894
+ if success:
895
+ print(f" ✓ {message}")
896
+ else:
897
+ print(f" ✗ {message}")
898
 
899
  def notify_game_event(self, event_type: str, message: str,
900
  affected_players: Optional[List[int]] = None) -> None:
test_city_building.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Test script for city building functionality.
3
+ """
4
+ from pycatan import Game
5
+ from pycatan.card import ResCard
6
+
7
+ # Create game with 3 players
8
+ game = Game(num_of_players=3)
9
+ board = game.board
10
+
11
+ print("Testing City Building...")
12
+ print("=" * 60)
13
+
14
+ # Setup: Add a settlement for player 0
15
+ point = board.points[0][0]
16
+ print(f"\n1. Adding settlement at point [0][0] for player 0...")
17
+ status = game.add_settlement(player=0, point=point, is_starting=True)
18
+ print(f" Result: {status}")
19
+
20
+ # Give player resources for city (3 Ore, 2 Wheat)
21
+ print(f"\n2. Giving player 0 resources for city (3 Ore, 2 Wheat)...")
22
+ needed_cards = [
23
+ ResCard.Ore,
24
+ ResCard.Ore,
25
+ ResCard.Ore,
26
+ ResCard.Wheat,
27
+ ResCard.Wheat
28
+ ]
29
+ game.players[0].add_cards(needed_cards)
30
+ print(f" Player 0 cards: {[str(c) for c in game.players[0].cards]}")
31
+
32
+ # Try to build a city
33
+ print(f"\n3. Upgrading settlement to city at point [0][0]...")
34
+ status = game.add_city(point=point, player=0)
35
+ print(f" Result: {status}")
36
+
37
+ # Check victory points
38
+ print(f"\n4. Checking player 0 victory points...")
39
+ vp = game.players[0].get_VP()
40
+ print(f" Victory Points: {vp}")
41
+
42
+ # Check the building type
43
+ print(f"\n5. Checking building at point [0][0]...")
44
+ building = point.building
45
+ if building:
46
+ print(f" Building type: {building.type}")
47
+ print(f" Building owner: {building.owner}")
48
+ else:
49
+ print(f" No building found!")
50
+
51
+ print("\n" + "=" * 60)
52
+ print("Test complete!")