fayti1703 / binarymatrixplayer Goto Github PK
View Code? Open in Web Editor NEWASP.NET-based Binmat Player
License: Mozilla Public License 2.0
ASP.NET-based Binmat Player
License: Mozilla Public License 2.0
BinaryMatrixEngineTest
was generated using an NUnit-Test-Framework template. It should be using Microsoft's Microsoft.NET.Test.Sdk
instead (see CommonLib).
ActionSet::lane
can take on out-of-range values (is < 0 or > 6
).
This code may infinite loop:
BinaryMatrixPlayer/BinaryMatrixEngine/CardList.cs
Lines 120 to 124 in b3d2a56
Note that newLength
never actually grows, as it keeps being reset to this.Cards.Length * 2
-- if a simple doubling of the array size doesn't result in a large enough array for the requested capacity; this code loops indefinitely.
Initialize newLength
to this.Cards.Length
, then change the statement in the loop to newLength *= 2;
BinaryMatrixEngineAccessor
has some missing/unimplemented features that would be nice to have for debugging and testing purposes, in particular:
/full-state
command that dumps the entire current game state to be inspected: BinaryMatrixPlayer/BinaryMatrixEngineAccessor/CommandExecution.cs
Lines 95 to 99 in 325aa5b
There's no check for a completed game here:
BinaryMatrixPlayer/BinaryMatrixEngine/GameContext.cs
Lines 107 to 125 in 039c835
Possible solution: at the top of the method, check for this.victor != null
, and if so, return this.victor
.
This error is actually returned when attempting to play cards to / declare combat in the pseudo a
lane.
Relates to: #18 which should prevent actually inputting invalid lanes into an ActionSet
.
@Engine/Player.cs
has too many symbols defined inside it:
enum PlayerRole
enum ActionType
struct ActionSet
interface CardSpecification
struct PlayerData
class Player
interface PlayerActor
interface ActionablePlayerActor
(deprecated)struct PlayerID
At minimum, ActionType
/ActionSet
/CardSpecification
should be moved to a separate file (this set of types is relatively isolated).
This code here:
BinaryMatrixPlayer/BinaryMatrixEngine/GameContext.cs
Lines 103 to 116 in a6129f2
Attackers
/Defenders
enumerables contain the attacking/defending players in proper action order.
However, the action order of players can change from turn to turn. It is not possible to reorder the player list in the current engine, making this impossible to implement.
Player
/ActionSet
architecture in that code to more closely resemble how the spec1 is written.PlayerID
implementation.Technically, the 'BINMAT Algorithmic Explanation' ↩
BinaryMatrixPlayer/BinaryMatrixEngine/CardList.cs
Lines 7 to 14 in 325aa5b
This comment was written before CardList::MoveAllTo
was introduced and at a time that CardList::TakeFirst
still had usages -- as such, this may be outdated. Running some benchmarks would still be good here, I think. (Particularly to figure out if this is even an area that needs attention!)
BinaryMatrixPlayer/BinaryMatrixEngine/CardList.cs
Lines 28 to 29 in 325aa5b
(calls ArrayPool::Create(int maxArrayLength, int maxArraysPerBucket)
)
Some simple benchmarking and tracking of average list lengths, along with free/used;reused/newly allocated stats would be good here. These parameters were arbitrarily chosen by a neural network (read: I made them up) instead of any hard data.
The binlog is not implemented. This is an important feature to provide feedback about the game state to players.
Internal game execution operations should already be ordered in such a way that the binlog need only record them as they occur. Any situation where this is not the case should be treated as a bug.
Several game execution methods will require some way to record log-relevant information. A possible implementation would be an additional out
argument -- e.g. combat resolution might take an out CombatLog
containing the binlog information for the resolved combat.
This would then be added to and propagated through similar structures up to the player turn execution, which would append to an array in GameContext
.
GameState
will also record this information.
All current testing was performed locally, using BinaryMatrixEngineAccessor
in a terminal session. This does not scale, nor is it particularly exhaustive.
Adding some unit tests would allow for increased confidence that the code behaves correctly, particularly after changes to the internals.
The current test suite has a test coverage of 45%, which is too low for proper confidence.
This makes refactoring certain patterns hard -- e.g.
CardList cards = declval();
cards.AddRange([ new Card(EIGHT, FORM) ]);
to
CardList cards = declval();
cards.Add(new Card(EIGHT, FORM));
(should have a warning on the upper code to replace with the lower one; and an intention to do the reverse for easy adding of elements)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.