Скачал, запустил. Впечатление: уголки двигаются справа налево. Ощущения игры какой-то не возникло. Но плюс в том, что меню работает (могло бы и не работать). В игре, наверное, нужно какой-то азарт выстраивать, чтобы затягивала.
Master_Sergius
Делал её специально без использования ncurses, а старым-добрым clrscr.
Это пофиг, главное, чтобы оно работало надёжно: запустил - работает, как и ожидалось.
Master_Sergius
Если вдруг этого не достаточно, придется перейти на ncurses.
ncurses даёт больше возможностей, так как представляет экран в виде доски с клетками. Если без ncurses рисовать в консоли, всё равно придётся разработать что-то похожее на ncurses.
Master_Sergius
Пишу здесь с надеждой на то, что кто-то присоединится к разработке. Она уже играбельная, но нужно сделать глубокий рефакторинг.
Интересно, как ты отслеживаешь изменения в программе, ставишь задачи, исправляешь баги. Слыхал, что есть совместная разработка? Это когда над одним багом в течение месяцев могут работать несколько разных людей, незнакомых с проектом. Как оно у тебя учитывается?
(А рефакторить там нечего, так как программа практически ничего не делает. Дорастишь её до 5000 строк (сейчас 500), тогда понадобится. На данном этапе рефакторинг может быть полезен только для самообучения рефакторингу, а не для улучшения программы.)
Вот из линтера инфа, поставь себе, чтобы проверять на простейшие ошибки
[guest@localhost castle_wars-master]$ python3-pylint castle_wars.py
No config file found, using default configuration
************* Module castle_wars
W: 70, 0: TODO: BONUS SKILLS (fixme)
W: 84, 0: TODO: remove log function (fixme)
W: 92, 0: TODO: use placeholders for constant values (fixme)
C:201, 0: Line too long (96/80) (line-too-long)
C:305, 0: Line too long (96/80) (line-too-long)
C:320, 0: Line too long (96/80) (line-too-long)
C:361, 0: Line too long (95/80) (line-too-long)
C:388, 0: Line too long (95/80) (line-too-long)
C:429, 0: Line too long (83/80) (line-too-long)
C:430, 0: Line too long (87/80) (line-too-long)
C:436, 0: Line too long (87/80) (line-too-long)
C:455, 0: Line too long (85/80) (line-too-long)
C:462, 0: Line too long (90/80) (line-too-long)
C:465, 0: Line too long (83/80) (line-too-long)
C:466, 0: Line too long (98/80) (line-too-long)
C:467, 0: Line too long (84/80) (line-too-long)
C:468, 0: Line too long (89/80) (line-too-long)
C:469, 0: Line too long (86/80) (line-too-long)
C:470, 0: Line too long (87/80) (line-too-long)
C:479, 0: Line too long (88/80) (line-too-long)
C:480, 0: Wrong continued indentation.
self.players[player].unit_attack_speed_lvl))
^ | (bad-continuation)
C:480, 0: Line too long (91/80) (line-too-long)
C:485, 0: Wrong continued indentation.
self.players[player].castle_income_lvl))
^ | (bad-continuation)
W:540, 0: Unnecessary semicolon (unnecessary-semicolon)
C:550, 0: Line too long (90/80) (line-too-long)
W:551, 0: Unnecessary semicolon (unnecessary-semicolon)
C:561, 0: Line too long (94/80) (line-too-long)
W:562, 0: Unnecessary semicolon (unnecessary-semicolon)
C:609, 0: Line too long (84/80) (line-too-long)
C:611, 0: Exactly one space required after comma
choice = self.computer_choice(random.randint(1,max_rand), strategy)
^ (bad-whitespace)
C:683, 0: Line too long (88/80) (line-too-long)
C:726, 0: Line too long (94/80) (line-too-long)
C:727, 0: Line too long (95/80) (line-too-long)
C: 1, 0: Missing module docstring (missing-docstring)
W: 90, 0: Redefining built-in 'help' (redefined-builtin)
C: 87,46: Invalid variable name "f" (invalid-name)
C:156, 0: Missing function docstring (missing-docstring)
C:159, 0: Missing function docstring (missing-docstring)
C:172, 8: Invalid attribute name "hp" (invalid-name)
C:166, 0: Missing class docstring (missing-docstring)
C:171, 4: Missing method docstring (missing-docstring)
C:176, 4: Missing method docstring (missing-docstring)
E:177,21: Instance of 'GameObject' has no 'max_hp' member (no-member)
E:178,23: Instance of 'GameObject' has no 'regen' member (no-member)
E:172, 8: Access to member 'hp' before its definition line 174 (access-member-before-definition)
E:173,11: Access to member 'hp' before its definition line 174 (access-member-before-definition)
W:174,12: Attribute 'hp' defined outside __init__ (attribute-defined-outside-init)
C:181, 0: Missing class docstring (missing-docstring)
R:181, 0: Too many instance attributes (8/7) (too-many-instance-attributes)
W:182, 4: __init__ method from base class 'GameObject' is not called (super-init-not-called)
R:182, 4: Too many arguments (6/5) (too-many-arguments)
W:182, 0: Unused argument 'regen' (unused-argument)
C:192, 4: Missing method docstring (missing-docstring)
C:225, 0: Missing class docstring (missing-docstring)
R:225, 0: Too many instance attributes (27/7) (too-many-instance-attributes)
W:265,33: Used * or ** magic (star-args)
W:263,16: Unused variable 'unit' (unused-variable)
C:275, 4: Missing method docstring (missing-docstring)
C:281, 4: Missing method docstring (missing-docstring)
C:287, 4: Missing method docstring (missing-docstring)
C:291, 4: Missing method docstring (missing-docstring)
C:295, 0: Missing class docstring (missing-docstring)
R:295, 0: Too many instance attributes (9/7) (too-many-instance-attributes)
W:296, 4: __init__ method from base class 'GameObject' is not called (super-init-not-called)
R:296, 4: Too many arguments (7/5) (too-many-arguments)
C:309, 4: Missing method docstring (missing-docstring)
C:312, 4: Missing method docstring (missing-docstring)
W:316, 8: Else clause on loop without a break statement (useless-else-on-loop)
C:319, 4: Missing method docstring (missing-docstring)
C:323, 0: Missing class docstring (missing-docstring)
R:324, 4: Too many arguments (6/5) (too-many-arguments)
C:341, 4: Missing method docstring (missing-docstring)
C:344, 4: Missing method docstring (missing-docstring)
C:347, 4: Missing method docstring (missing-docstring)
C:350, 4: Missing method docstring (missing-docstring)
C:374, 4: Missing method docstring (missing-docstring)
C:391, 4: Missing method docstring (missing-docstring)
C:395, 4: Missing method docstring (missing-docstring)
C:408, 4: Missing method docstring (missing-docstring)
C:411, 4: Missing method docstring (missing-docstring)
C:416, 4: Invalid attribute name "hp" (invalid-name)
C:416, 4: Missing method docstring (missing-docstring)
C:423, 0: Missing class docstring (missing-docstring)
R:423, 0: Too many instance attributes (9/7) (too-many-instance-attributes)
C:435, 4: Missing method docstring (missing-docstring)
C:438, 4: Missing method docstring (missing-docstring)
C:454, 4: Missing method docstring (missing-docstring)
C:461, 4: Missing method docstring (missing-docstring)
R:461, 4: Method could be a function (no-self-use)
C:473, 4: Missing method docstring (missing-docstring)
C:492, 4: Missing method docstring (missing-docstring)
W:500,12: No exception type(s) specified (bare-except)
R:492, 4: Too many branches (15/12) (too-many-branches)
C:533, 4: Missing method docstring (missing-docstring)
R:533, 4: Method could be a function (no-self-use)
C:537, 4: Missing method docstring (missing-docstring)
C:569, 4: Missing method docstring (missing-docstring)
C:576, 4: Missing method docstring (missing-docstring)
R:576, 4: Method could be a function (no-self-use)
C:581, 4: Missing method docstring (missing-docstring)
R:581, 4: Too many branches (15/12) (too-many-branches)
C:630, 4: Missing method docstring (missing-docstring)
C:637, 4: Missing method docstring (missing-docstring)
W:644,12: Unused variable 'tick' (unused-variable)
R:637, 4: Too many branches (17/12) (too-many-branches)
C:707, 4: Missing method docstring (missing-docstring)
C:729, 4: Missing method docstring (missing-docstring)
R:729, 4: Method could be a function (no-self-use)
C:749, 4: Missing method docstring (missing-docstring)
R:749, 4: Method could be a function (no-self-use)
C:752, 4: Missing method docstring (missing-docstring)
C:758, 4: Missing method docstring (missing-docstring)
W:436, 8: Attribute 'warline' defined outside __init__ (attribute-defined-outside-init)
W:447, 8: Attribute 'warline' defined outside __init__ (attribute-defined-outside-init)
R:423, 0: Too many public methods (21/20) (too-many-public-methods)
C:767, 4: Invalid constant name "game" (invalid-name)
Report
======
522 statements analysed.
Messages by category
--------------------
+-----------+-------+---------+-----------+
|type |number |previous |difference |
+===========+=======+=========+===========+
|convention |78 |78 |= |
+-----------+-------+---------+-----------+
|refactor |16 |16 |= |
+-----------+-------+---------+-----------+
|warning |18 |18 |= |
+-----------+-------+---------+-----------+
|error |4 |4 |= |
+-----------+-------+---------+-----------+
Messages
--------
+--------------------------------+------------+
|message id |occurrences |
+================================+============+
|missing-docstring |47 |
+--------------------------------+------------+
|line-too-long |24 |
+--------------------------------+------------+
|no-self-use |5 |
+--------------------------------+------------+
|too-many-instance-attributes |4 |
+--------------------------------+------------+
|invalid-name |4 |
+--------------------------------+------------+
|unnecessary-semicolon |3 |
+--------------------------------+------------+
|too-many-branches |3 |
+--------------------------------+------------+
|too-many-arguments |3 |
+--------------------------------+------------+
|fixme |3 |
+--------------------------------+------------+
|attribute-defined-outside-init |3 |
+--------------------------------+------------+
|unused-variable |2 |
+--------------------------------+------------+
|super-init-not-called |2 |
+--------------------------------+------------+
|no-member |2 |
+--------------------------------+------------+
|bad-continuation |2 |
+--------------------------------+------------+
|access-member-before-definition |2 |
+--------------------------------+------------+
|useless-else-on-loop |1 |
+--------------------------------+------------+
|unused-argument |1 |
+--------------------------------+------------+
|too-many-public-methods |1 |
+--------------------------------+------------+
|star-args |1 |
+--------------------------------+------------+
|redefined-builtin |1 |
+--------------------------------+------------+
|bare-except |1 |
+--------------------------------+------------+
|bad-whitespace |1 |
+--------------------------------+------------+
Global evaluation
-----------------
Your code has been rated at 7.47/10 (previous run: 7.47/10, +0.00)
Statistics by type
------------------
+---------+-------+-----------+-----------+------------+---------+
|type |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module |1 |1 |= |0.00 |0.00 |
+---------+-------+-----------+-----------+------------+---------+
|class |6 |6 |= |0.00 |0.00 |
+---------+-------+-----------+-----------+------------+---------+
|method |53 |53 |= |28.30 |0.00 |
+---------+-------+-----------+-----------+------------+---------+
|function |6 |6 |= |66.67 |0.00 |
+---------+-------+-----------+-----------+------------+---------+
Raw metrics
-----------
+----------+-------+------+---------+-----------+
|type |number |% |previous |difference |
+==========+=======+======+=========+===========+
|code |586 |85.05 |586 |= |
+----------+-------+------+---------+-----------+
|docstring |55 |7.98 |55 |= |
+----------+-------+------+---------+-----------+
|comment |15 |2.18 |15 |= |
+----------+-------+------+---------+-----------+
|empty |33 |4.79 |33 |= |
+----------+-------+------+---------+-----------+
Duplication
-----------
+-------------------------+------+---------+-----------+
| |now |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines |0 |0 |= |
+-------------------------+------+---------+-----------+
|percent duplicated lines |0.000 |0.000 |= |
+-------------------------+------+---------+-----------+
[guest@localhost castle_wars-master]$