lecture5-6

Dice randi61ndice baddice sumdice 2 sumdice

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ay = a(:,2); az = a(:,3); bx = b(:,1); by = b(:,2); bz = b(:,3); xc(:,1) = ay.*bz - az.*by; xc(:,2) = az.*bx - ax.*bz; xc(:,3) = ax.*by - ay.*bx; end 
 
 
 Simulation
of
dropdead
dice
game
 Dropdead
is
a
dice
game
where
you
roll
five
dice
and
add
up
the
score.

But,
if
any
twos
or
fives
appear,
 the
score
is
zero
and
you
lose
those
dice.

You
keep
rolling
until
you
have
no
dice
left
with
your
final
 score
being
the
cumulative
score
of
all
the
rolls.
 We
program
this
game
from
the
bottom
up,
first
writing
a
function
that
roll
N
dice
and
reports
back
the
 score
and
the
number
of
bad
dice:
 function [score baddice] = rolldice(ndice) % rolls ndice dice and returns the score and the numbers of % 2...
View Full Document

This document was uploaded on 03/16/2014 for the course CS 106 at Mt. Holyoke.

Ask a homework question - tutors are online