A <- sample(c("剪刀", "石头", "布"),1)
B <- sample(c("剪刀", "石头", "布"),1)
N=3; result=rep(1,N)
for (i in 1:N)
{
fun <- function(A,B)
{
if ((A=='石头'&&B=='剪刀')|(A=='剪刀'&&B=='布')|(A=='布'&&B=='石头'))
{
print("Awin")
}
else if ((B=='石头'&&A=='剪刀')|(B=='剪刀'&&A=='布')|(B=='布'&&A=='石头'))
{
print("Bwin")
}
else if ((A=='石头'&&B=='石头')|(A=='剪刀'&&B=='剪刀')|(A=='布'&&B=='布'))
{print("平手")}
}
fun(A,B)
}
result[i]= fun(A,B)
}