Roll.m

From Cohen Courses
Jump to navigationJump to search
function [ face ] = roll(d,ld,upTo5,upTo6)
tmp1 = upTo6;
tmp2 = (ld==1)*6 + (ld==2).*upTo5;
tmp3 = (ld==1)*1 + (ld==2).*(upTo5 + 1);
face = (d==1).*tmp1 + (d==2).*tmp2 + (d==3).*tmp3;
end