Giter Site home page Giter Site logo

nelkinda / gameoflife-kotlin Goto Github PK

View Code? Open in Web Editor NEW
11.0 4.0 0.0 1.17 MB

Game of Life in Kotlin: Solution for Coderetreat facilitators

License: GNU General Public License v3.0

Makefile 11.08% Kotlin 73.31% Gherkin 15.61%
coderetreat game-of-life kotlin coderetreat-facilitators

gameoflife-kotlin's Introduction

Game of Life

Kotlin CI with Gradle Kotlin CI with Maven

This is an example implementation of Conway's Game of Life in Kotlin. The primary focus of the implementation is cleanliness, not performance. It serves as a lose guideline for Nelkinda Coderetreat facilitators.

Rules of Conway's Game of Life

The universe of the Game of Life is an infinite, two-dimensional orthogonal grid of square cells. Each cell is in one of two possible states:

  • Alive aka populated
  • Dead aka unpopulated

Every cell interacts with its eight neighbors. The neighbors are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

  1. Underpopulation: Any live cell with fewer than 2 live neighbors dies.
  2. Survival: Any live cell with 2 or 3 live neighbors survives on to the next generation.
  3. Overpopulation Any live cell with more than 3 live neighbors dies.
  4. Reproduction (birth): Any dead cell with exactly 3 live neighbors becomes a live cell.

โ€” Conway's Game of Life - Wikipedia

Activities (aka Constraints)

This implementation of Game of Life follows the following activities and constraints:

  • Behavior Driven Development.
  • Test-Driven Development.
  • Immutable objects only. Only pure functions.
  • No variable reassignments (except for the Parser).
  • Short functions only. Most functions are expression functions. Exception: The Parser is big.
  • Domain-Specific Language: The symbol names are taken from the problem domain. A point, for example, is constructed with P(x, y) instead of Point(x, y). That makes the code shorter and easier to read.
  • Functional Core, Imperative Shell: The code is purely functional. The imperative shell is so far out that it's in the test only. The Parser implementation is imperative, but its interface and observable behavior are functional.

Quality

Testing, Mutation Test Coverage

  • The acceptance tests are written using BDD in Gherkin and executed via Cucumber.
  • The unit tests are written and executed with JUnit 5. Regular code coverage is measured using JaCoCo which reports 100% lines and condition coverage. Pitest is not used for mutation testing because it currently does not work well for Kotlin. For example, Pitest tries to mutate Kotlin intrinsics.

SonarQube

  • The project has a SonarQube analysis. The project has the best possible rating imaginable: 0 bugs, 0 vulnerabilities, 0 security hotspots, 0 debt, 0 code smells, 100% coverage, 0.0% duplications, 0 duplicated blocks.

SonarQube report The lack of coverage in the Pitest report is due to a coverage bug around enums.

References

Questions/Contact

gameoflife-kotlin's People

Contributors

christianhujer avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gameoflife-kotlin's Issues

Use of mutation testing in gameoflife-kotlin - Help needed

Hello there!

My name is Ana. I noted that you use the mutation testing tool Pit in the project.
I am a postdoctoral researcher at the University of Seville (Spain), and my colleagues and I are studying how mutation testing tools are used in practice. With this aim in mind, we have analysed over 3,500 public GitHub repositories using mutation testing tools, including yours! This work has recently been published in a journal paper available at https://link.springer.com/content/pdf/10.1007/s10664-022-10177-8.pdf.

To complete this study, we are asking for your help to understand better how mutation testing is used in practice, please! We would be extremely grateful if you could contribute to this study by answering a brief survey of 21 simple questions (no more than 6 minutes). This is the link to the questionnaire https://forms.gle/FvXNrimWAsJYC1zB9.

We apologize if you have already received message multiple times or if you have already had the opportunity to complete the survey. If you have already shared your feedback, we want to convey our appreciation, kindly disregard this message, and please accept our apologies for any inconvenience.

Drop me an e-mail if you have any questions or comments ([email protected]). Thank you very much in advance!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.