Game in MATLAB?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nick Haufler
el 25 de En. de 2016
Comentada: Walter Roberson
el 27 de En. de 2016
I'm making Yahtzee in Matlab, and I'm focusing on getting the scoring set up. I get scores to come back in an array, but they don't seem to be correct. I've looked over my code several times, but just cant seem to figure out what went wrong. I'm desperate at this point, and need help. I attached my code along with this post. Any help is appreciated. Thanks! You guys are awesome.
2 comentarios
Respuesta aceptada
Walter Roberson
el 25 de En. de 2016
Hint: instead of using size(something==value) you can use sum(something==value)
Your code is counting some things multiple times. For example, a full house is counted but so is its value as 3 of a kind. Likewise, Chance should only apply if nothing else matched.
For 3 of a kind or 4 of a kind, you are using a score of sum(diceValues), which is not correct: you should be counting only the dice that match.
Your points array could be numeric instead of a cell array.
8 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!