fr3nchk1ss / snaked Goto Github PK
View Code? Open in Web Editor NEWA snake game to demo D contract programming in regards to DO-178c
License: Other
A snake game to demo D contract programming in regards to DO-178c
License: Other
CR by Ali
In general, adding two Coordinates is suspicious to me. However, subtracting two Coordinates makes sense and should return a Distance object.
CR by Ali
Accounting for the walls with +1, -1, etc. looks scary to me.
I wonder whether the playground could be detached from the walls and you could use the familiar 0 indexed access.
Perhaps by slicing inside a bigger area or by a special type that hides that logic from us.
interface pattern for console
version (win)
version(linux)
The POST-MORTEM will describe how the Dlang code matched the requirements.
CR by Ali
The invariant line 26 in ground.d might be a 'static assert':
(invariant has runtime cost.)
CR by Ali
A random thought about 'in' and 'out' contract blocks: Instead of adding statements inside these blocks, one can use functions to give a name to the check and also use the new contract syntax. Instead of
in {
// The snake shall not backtrack on itself
assert(body[0] + unitMotion[direction] != body[1]);
}
Something like this:
bool updateBody(Direction direction)
in (!doesBackTrack(direction), "Snake backtracks")
{
// The body of the function ...
}
Describe in more details the purpose of the project
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.