
- By Jordan Colgan
- ·
- Posted Jan 14, 2023 9:00:00 AM
Stack
In computer science, a stack is a famous abstract data type that provides certain operations on a collection of elements. Stacks have a long history,..
This kata is well suited to developers who have some familiarity with TDD basics and want to improve their algorithm design skills. It is a stateless, algorithmic version of the classic Tennis kata (where the program also holds the current score and updates its state when a player scores a new point).
Both Tennis and Bowling can also be done holding state (e.g. with a scorePoint()
method of some sort). However, when learning pure algorithmic TDD, we prefer to stay stateless as the added difficulty of maintaining state can distract from the main learning points.
Write a program that accepts two integers, and converts them to a tennis-style score.
The scoring rules of tennis (per Wikipedia) are as follows:
Start with with the following interface:
public class TennisScoreCalculator {
public string Score(int player1Points, int player2Points);
}
In computer science, a stack is a famous abstract data type that provides certain operations on a collection of elements. Stacks have a long history,..
Santa wants to increase the number of Christmas trees that he has in his allotment.
Introduction Sudokuis a very popular number-placement puzzle. The objective is to fill a 9 × 9 grid with digits so that each column, each row, and..
Join our newsletter for expert tips and inspirational case studies
Your welcome email is on its way! You can pick the emails you’d like to receive by clicking the link to the Preference Centre.
Join our newsletter for expert tips and inspirational case studies
Your welcome email is on its way! You can pick the emails you’d like to receive by clicking the link to the Preference Centre.