Trikalabs
  • Home
  • Best online TDD videos
  • Book Suggestions
  • About Me
  • Contact
Trikalabs
No Result
View All Result

Game of life Kata

by fragi
May 12, 2019
in Code Kata, TDD
Share on FacebookShare on Twitter

Game of life is a Kata in which we can practise Functional Programming:

The rules are simple:

 

The world is a two dimensions array. Each cell of the array represents a cell.

If the value is 0 the cell is dead, and if the value is 1 the cell is alive.

The cell interacts with all his 8 neighbours.

In each generation the rules of life are the following:

  • If the cell is alive and has 0 or 1 alive neighbours, then the cell dies
  • If the cell is alive and has 2 or 3 alive neighbours, then the cell lives
  • If the cell is alive and had 4 or more alive neighbours, then the cell dies
  • If the cell is dead and has 3 alive neighbours, then the cell becomes alive.

 

Github Solution in Swift:

https://github.com/Fragki/Game-of-life-kata

 

 

fragi

fragi

Related Posts

What is TDD?
TDD

XCTestCase lifecycle

May 25, 2021

XCTestCase has many methods as part of its lifecycle. It has a class setup method that executes only once before...

What is TDD?
TDD

Make your tests more readable

May 23, 2021

In the FizzBuzz code challenge, we had to write the following test method: Although the test is easy to...

What is TDD?
TDD

@testable

May 16, 2021

At the beginning of the FizzBuzz code challenge , we deleted the @testable line of code. What does this @testable...

What is TDD?
TDD

What is SUT

May 16, 2021

In many articles about TDD, you will find the term SUT, which refers to the System Under Test. Using SUT...

What is TDD?
TDD

Why unit testing is valuable

May 16, 2021

There are many benefits of writing unit tests. The test we write can serve as a documentation of what the...

What is TDD?
TDD

Cyclomatic complexity

November 11, 2021

According to Wikipedia (https://en.wikipedia.org/wiki/Cyclomatic_complexity): Cyclomatic complexity is a software metric used to indicate the complexity of a program. It is...

Next Post
How to test Errors in Swift

How to test Errors in Swift

FizzBuzz Throw Kata

FizzBuzz Throw Kata

Roman Numerals

Roman Numerals

  • Advertise
  • Privacy & Policy
  • Contact

© 2019 Trikalabs Ltd. All rights reserved.

No Result
View All Result
  • Home
  • About Me
  • A curated list with the best free online TDD videos
  • Book Suggestions
  • Pinner Code Club

© 2019 Trikalabs Ltd. All rights reserved.