Code Monkey home page Code Monkey logo

mrdice's Introduction

MrDice

Testing

go run main.go

Project Spec

Design​ ​ the​ ​ game​ ​ described​ ​ below.​ ​ Implement​ ​ a ​ ​ method​ ​ playGame()​ ​ which​ ​ simulates​ ​ a ​ ​ game​ ​ then displays​ ​ the​ ​ winning​ ​ player​ ​ and​ ​ their​ ​ score.

Game​ ​ rules: In​ ​ this​ ​ game​ ​ players​ ​ roll​ ​ dice​ ​ and​ ​ try​ ​ to​ ​ collect​ ​ the​ ​ lowest​ ​ score.​ ​ A ​ ​ 4 ​ ​ counts​ ​ as​ ​ zero,​ ​ all​ ​ other numbers​ ​ count​ ​ as​ ​ face​ ​ value.​ ​ A ​ ​ player’s​ ​ score​ ​ is​ ​ the​ ​ total​ ​ spots​ ​ showing​ ​ on​ ​ the​ ​ dice​ ​ when​ ​ she finishes​ ​ her​ ​ turn​ ​ (excluding​ ​ fours​ ​ because​ ​ they’re​ ​ zero).​ ​ The​ ​ object​ ​ of​ ​ the​ ​ game​ ​ is​ ​ to​ ​ get​ ​ the​ ​ lowest score​ ​ possible.

The​ ​ game​ ​ is​ ​ played​ ​ as​ ​ follows​ ​ between​ ​ 4 ​ ​ players: ● Play​ ​ starts​ ​ with​ ​ one​ ​ person​ ​ randomly​ ​ being​ ​ chosen​ ​ to​ ​ start​ ​ rolling​ ​ and​ ​ proceeds​ ​ in succession​ ​ until​ ​ all​ ​ players​ ​ have​ ​ rolled. ● The​ ​ player​ ​ rolls​ ​ all​ ​ five​ ​ dice,​ ​ then​ ​ must​ ​ keep​ ​ at​ ​ least​ ​ one​ ​ dice​ ​ but​ ​ may​ ​ keep​ ​ more​ ​ at​ ​ her discretion​ ​ (She​ ​ can​ ​ stop​ ​ on​ ​ her​ ​ first​ ​ roll​ ​ if​ ​ she​ ​ so​ ​ wishes). ● Those​ ​ dice​ ​ which​ ​ are​ ​ not​ ​ kept​ ​ are​ ​ rolled​ ​ again​ ​ and​ ​ each​ ​ round​ ​ she​ ​ must​ ​ keep​ ​ at​ ​ least​ ​ one more​ ​ until​ ​ all​ ​ the​ ​ dice​ ​ are​ ​ out. ● Once​ ​ each​ ​ player​ ​ has​ ​ rolled​ ​ the​ ​ player​ ​ who​ ​ scored​ ​ the​ ​ lowest​ ​ wins.

● Repeat​ ​ for​ ​ three​ ​ more​ ​ rounds​ ​ in​ ​ succession​ ​ so​ ​ that​ ​ the​ ​ next​ ​ person​ ​ starts​ ​ rolling​ ​ first​ ​ (at the​ ​ end​ ​ each​ ​ player​ ​ will​ ​ have​ ​ started).

After​ ​ all​ ​ four​ ​ rounds​ ​ have​ ​ been​ ​ completed​ ​ the​ ​ player​ ​ with​ ​ the​ ​ lowest​ ​ combined​ ​ score​ ​ wins.

mrdice's People

Watchers

James Cloos 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.