Skip to content
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

Branch02 #5

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open

Branch02 #5

wants to merge 41 commits into from

Conversation

iqmulator
Copy link
Collaborator

No description provided.

@@ -61,6 +61,8 @@ protected virtual bool PrintMembers(StringBuilder builder)

public int GetCellIndex(int r, int c) => r * Size + c;

public int GetCardIndex(int r, int c) => r * 9 + c;
Copy link
Owner

Choose a reason for hiding this comment

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

This function is unused.

? p with { Score = p.Score + score}
: p).ToImmutableList(),
};
public abstract string Id { get; }
Copy link
Owner

Choose a reason for hiding this comment

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

You broke formatting here.

{ }

[Service, ServiceAlias(typeof(IGameEngine), IsEnumerable = true)]
public class PointEngine : GameEngine<PointState, PointMove>
Copy link
Owner

Choose a reason for hiding this comment

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

I'd rename this to PointGameEngine, PointGameState, and PointGameMove - PointXxx is a bit confusing.

@@ -13,7 +13,7 @@
// Looks like there is no better way to set _default_ URL
builder.Sources.Insert(0, new MemoryConfigurationSource() {
InitialData = new Dictionary<string, string>() {
{WebHostDefaults.ServerUrlsKey, "http://localhost:5030"},
{WebHostDefaults.ServerUrlsKey, "http://localhost:5035"},
Copy link
Owner

Choose a reason for hiding this comment

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

This line should be reverted.

<tbody>
<tr>
@for (int i = 0; i < 2; i++)
{
Copy link
Owner

Choose a reason for hiding this comment

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

Statement brackets should be on the same line.

@@ -0,0 +1,185 @@
@attribute [MatchFor(typeof(DiceEngine), ComponentScopes.GamePlay)]
Copy link
Owner

Choose a reason for hiding this comment

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

General comment: nesting is pretty huge in this file. I'd probably extract some sub-components here.


private Task MoveAsync()
{
diceValue = GetRandomDigit();
Copy link
Owner

Choose a reason for hiding this comment

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

Hehe :) This stuff should normally happen on server, right? I mean, if your client can submit any digit it likes, pretty sure it won't be a fair game at all.

private Task MoveAsync()
{
diceValue = GetRandomDigit();
var move = new DiceMove(MyPlayerIndex, diceValue);
Copy link
Owner

Choose a reason for hiding this comment

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

Yep, diceValue shouldn't be a part of DiceMove - it should be generated on server side when you process the move there.

private Color GetDiceColor(int playerIndex)
=> playerIndex == MyPlayerIndex ? Color.Success : Color.Danger;

private int GetRandomDigit()
Copy link
Owner

Choose a reason for hiding this comment

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

So this should be a part of DiceEngine, I guess.


}

<style>
Copy link
Owner

Choose a reason for hiding this comment

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

Is it common to put style in the end of component?

Copy link
Owner

@alexyakunin alexyakunin left a comment

Choose a reason for hiding this comment

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

Overall, it looks very good now. Requested a couple small changes.

@@ -30,7 +30,7 @@ public abstract class GameEngine<TGameState, TGameMove> : IGameEngine

public virtual Game Create(Game game) => game;
public abstract Game Start(Game game);
Game IGameEngine.Move(Game game, GameMove move) => Move(game, (TGameMove) move);
Game IGameEngine.Move(Game game, GameMove move) => Move(game, (TGameMove)move);
Copy link
Owner

Choose a reason for hiding this comment

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

Space is needed here.

@@ -16,6 +20,7 @@ public ClientServicesModule(IServiceCollection services, IServiceProvider module

public override void Use()
{

Copy link
Owner

Choose a reason for hiding this comment

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

Hmm, are you sure empty line is needed here?

@attribute [MatchFor(typeof(TicEngine), ComponentScopes.GameRules)]
@inherits GameRulesBase

Just a Tic Tac Toe game... Ordindary.
Copy link
Owner

Choose a reason for hiding this comment

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

"An ordinary one."

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.

None yet

2 participants