Skip to content

Game#14

Open
MinyazevR wants to merge 6 commits into
mainfrom
ConsoleGame
Open

Game#14
MinyazevR wants to merge 6 commits into
mainfrom
ConsoleGame

Conversation

@MinyazevR
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почти всё ок

Comment on lines +1 to +2
namespace Game;
using System;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace Game;
using System;
namespace Game;

using System;

namespace Game;
using System;

public class EventLoop
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо комментарии

Comment thread Game/Game/Game/EventLoop.cs Outdated
Comment on lines +13 to +14
// Magic 68 and 4 are the coordinates of the point you need to reach in order to win
while (Console.GetCursorPosition() != (68, 4))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это часть игровой логики, про которую EventLoop как раз не имеет права знать

Comment thread Game/Game/Game/Game.cs
private int currentPositionOnY;
private readonly string[] map;

public Game(int initialPositionOnX, int initialPositionOnY, string pathToFile, Action <int, int> action)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public Game(int initialPositionOnX, int initialPositionOnY, string pathToFile, Action <int, int> action)
public Game(int initialPositionOnX, int initialPositionOnY, string pathToFile, Action<int, int> action)

Comment thread Game/Game/Game/Game.cs Outdated

public class Game
{
private readonly Action<int, int> action;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это далеко не лучшее имя поля и параметра конструктора. action что? :)

Comment thread Game/Game/Game/Game.cs Outdated
private static void DrawCharacter()
{
Console.WriteLine("@");
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше через =>

Comment thread 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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут тоже, стоило бы именовать функцию так, чтобы это как-то отражало её назначение

Comment thread Game/Game/Game/Game.cs Outdated
Comment on lines +58 to +61
public void OnLeft(object? sender, EventArgs args)
{
Move((x, y) => (x - 1, y));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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));

Это просто делегация, так что даже по смыслу надо писать через =>

Comment thread Game/Game/Game/Program.cs Outdated
Comment on lines +3 to +6
public class Program
{
static void Main(string[] args)
{
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это ненужный с появлением topp-level-операторов код

Comment on lines +121 to +126
}




}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants