-
Notifications
You must be signed in to change notification settings - Fork 0
Game #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Game #14
Conversation
yurii-litvinov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почти всё ок
| namespace Game; | ||
| using System; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| namespace Game; | |
| using System; | |
| namespace Game; | |
| | |
| using System; |
| namespace Game; | ||
| using System; | ||
|
|
||
| public class EventLoop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо комментарии
Game/Game/Game/EventLoop.cs
Outdated
| // Magic 68 and 4 are the coordinates of the point you need to reach in order to win | ||
| while (Console.GetCursorPosition() != (68, 4)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это часть игровой логики, про которую EventLoop как раз не имеет права знать
| private int currentPositionOnY; | ||
| private readonly string[] map; | ||
|
|
||
| public Game(int initialPositionOnX, int initialPositionOnY, string pathToFile, Action <int, int> action) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public Game(int initialPositionOnX, int initialPositionOnY, string pathToFile, Action <int, int> action) | |
| public Game(int initialPositionOnX, int initialPositionOnY, string pathToFile, Action<int, int> action) |
Game/Game/Game/Game.cs
Outdated
|
|
||
| public class Game | ||
| { | ||
| private readonly Action<int, int> action; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это далеко не лучшее имя поля и параметра конструктора. action что? :)
Game/Game/Game/Game.cs
Outdated
| private static void DrawCharacter() | ||
| { | ||
| Console.WriteLine("@"); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше через =>
Game/Game/Game/Game.cs
Outdated
|
|
||
| private static bool IsWall(char x) => x == '|' || x == '+' || x == '-' || x == '_'; | ||
|
|
||
| public void Move(Func<int, int, (int, int)> func) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут тоже, стоило бы именовать функцию так, чтобы это как-то отражало её назначение
Game/Game/Game/Game.cs
Outdated
| public void OnLeft(object? sender, EventArgs args) | ||
| { | ||
| Move((x, y) => (x - 1, y)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public void OnLeft(object? sender, EventArgs args) | |
| { | |
| Move((x, y) => (x - 1, y)); | |
| } | |
| public void OnLeft(object? sender, EventArgs args) | |
| => Move((x, y) => (x - 1, y)); |
Это просто делегация, так что даже по смыслу надо писать через =>
Game/Game/Game/Program.cs
Outdated
| public class Program | ||
| { | ||
| static void Main(string[] args) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это ненужный с появлением topp-level-операторов код
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | |
| } | |
| } | |
| } |
No description provided.