Skip to content

Conversation

@MinyazevR
Copy link
Owner

No description provided.

Copy link

@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;

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

Choose a reason for hiding this comment

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

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

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))

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)

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)


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

Choose a reason for hiding this comment

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

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

private static void DrawCharacter()
{
Console.WriteLine("@");
}

Choose a reason for hiding this comment

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

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


private static bool IsWall(char x) => x == '|' || x == '+' || x == '-' || x == '_';

public void Move(Func<int, int, (int, int)> func)

Choose a reason for hiding this comment

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

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

Comment on lines 58 to 61
public void OnLeft(object? sender, EventArgs args)
{
Move((x, y) => (x - 1, y));
}

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 on lines 3 to 6
public class Program
{
static void Main(string[] args)
{

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
}




}

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