Skip to main content

Code challenge: Dice Decision

Updated 1 min readMarkdown
Part of seriesCoding Exercises. Exercicios de Algoritmo/Programação
Code challenge: Dice Decision

[Desafio Decisão nos Dados] O Zeca e a Aninha precisam decidir quem lava a louça hoje, e eles farão isso com dados comuns de seis lados (D6). Serão 3 partidas sendo que em cada uma eles lançarão 1 dado cada um, vencendo a partida quem tirar o maior número. A disputa será no estilo "melhor de 3". Mas eles estão com um problema: eles não tem nenhum dado D6!
Escreva um programa que simule este confronto e simule o comportamento aleatório do dado D6. Resolva na sua linguagem preferida!

[EN] [Code Challenge: Dice Decision] Zack and Annie need to decide who will wash the dishes tonight, and they will make that using common dices of six sides, D6. Who gets the higher number wins the turn. The confront will be decided in 3 turns, and who loses will wash the dishes. Write a program that simulates this confront, and simulates the randomness of the dice. Use your prefered language!

A Solution in C\C++

https://gist.github.com/tictackode/8beca2043ce001844149b28bec18025b

https://gist.github.com/tictackode/8beca2043ce001844149b28bec18025b


A Solution in Common Lisp

https://gist.github.com/tictackode/fb637adb442e61cf839802d7fa6a306a

https://gist.github.com/tictackode/fb637adb442e61cf839802d7fa6a306a


A Solution in Python

https://gist.github.com/tictackode/e4cb36d38d6f8813c95205e7b770ba14

https://gist.github.com/tictackode/e4cb36d38d6f8813c95205e7b770ba14

2 views

About the author

  • I'm an Information Systems Bachelor that writes code even by hobby, and now got into a mathematics degree for teaching. Sou formado em Sistemas de Informação, estou cursando Licenciatura em Matemática pela UFF-CEDERJ, e amo programar.

No comments yet. Be the first to comment.

Coding Exercises. Exercicios de Algoritmo/Programação

Part 7 of 9

Nesta série postarei desafios de algoritmo originais e resoluções em diversas linguagens de programação. In this series I will post coding exercises and solutions in many programming languagens.

Up nextGuess The Number Game[Desafio Adivinhe o Número] Escreva um programa que gere um número aleatório entre 1 e 100 e o mantenha apenas na memória, e o usuário terá 5 chances para adivinhar o número e vencer o jogo. Se o palp

More from this blog