Giter VIP home page Giter VIP logo

refactor-tennis-game2-csharp's Introduction

重构「Tennis Game 2」

背景介绍

网球有一个比较奇怪的评分系统,对新手来说,跟踪一下有点困难。 网球协会已经签约你建立一个记分板来在网球比赛中显示当前得分。

你的任务是编写一个TennisGame类,其中包含将正确的分数输出为字符串以显示在记分板上的逻辑。 当玩家得分时,它会触发类上要调用的方法,让noir知道谁得分了。 稍后,你将从记分板上调用一个叫 score()的方法,询问其应显示什么。 此方法应返回具有当前分数的字符串。

以下是从网球积分规则中总结的一些内容:

  • 第一位赢得比赛的玩家赢得了至少4分,并且比对手多赢得了至少2分。
  • 每个游戏的得分都以网球特有的方式描述: 从零到三点的分数分别被描述为LoveFifteenThirtyForty
  • 如果每个玩家至少得到了三点,且得分相等,得分为Deuce
  • 如果每方至少得分3分,并且玩家比对手多1分,则该游戏的得分对领先的玩家来说是Advantage

你任务只需要报告当前游戏的得分。

refactor-tennis-game2-csharp's People

Contributors

wenjia-wu avatar

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.