我要写出一个代码,要求玩家选择哪个bin,除非它不会“在7到12之间选择珠子”。当我设置播放器== 2并输入binNum 13.我也非常非常困惑在bindrop上我不认为我正确设置那个应该将珠子放入垃圾箱以供玩家选择并移动到另一个箱子。如果你无法帮助我,我很抱歉这个混乱,因为我想不出一个正确的方法来要求你得到最好的帮助。
void binSelection(int beadArray[MAX], int player, int &binNum)
{
cout<<"Choose bin.";
cin>>binNum;
while((player==1 && (binNum<0||binNum>5)) || beadArray[binNum]<1)
{
cout<<"Make selection with beads between 0 and 5.";
cin>>binNum;
}
while((player==2 && (binNum>12||binNum<7)) || beadArray[binNum]<1)
{
cout<<"Make selection with beads between 7 and 12.";
cin>>binNum;
}
}
void binDrop(int beadArray[MAX])
{
int bin=0;
int hand=0;
hand=beadArray[bin];
int player=2;
cout<<"Choose bin";
while(hand>0)
{
bin++;
if (player==1&& bin==13)
{
bin=0;
}
if (player==2&& bin==6)
{
bin=7;
}
beadArray[bin]++;
hand--;
}
}