谢了!已经完成~
如果搞成动画就更好了!
如果赢了之后,能出现美女图片,就更完美了!!!
也好!
LZ作完算法我贴出来我帮你完成动画这一步(只负责TC下的)
robin_008 老兄负责找美女图片就行了
做程序得倡导团体合作么
/*大家看看...*/
#include<stdio.h>
#include <time.h>
#include <stdlib.h>
int main()
{
int Iopponent,Iyouself,All_count=0,Win_count=0,Draw_count=0;
char flag;
srand(time(NULL));
while(1)
{
printf("输入你出的手势(1.石头2.剪刀3.布):");
scanf("%d",&Iyouself);
Iopponent=rand()%3+1;
if(Iyouself==Iopponent-1||Iyouself==Iopponent+2)
{
printf("第%d局你赢了.\n",All_count+1);
Win_count++;
}
else
{
if(Iyouself==Iopponent)
{
printf("第%d局平局.\n",All_count+1);
Draw_count++;
}
else
{
printf("第%d局你输了.\n",All_count+1);
}
}
All_count++;
getchar();
printf("\n是否继续(Y/N):");
scanf("%c",&flag);
if(flag!='Y'&&flag!='y')
{
break;
}
printf("\n");
}
printf("\n赢 平 输\n");
printf("%-5d%-5d%-5d\n",Win_count,Draw_count,All_count-(Win_count+Draw_count));
return(0);
}
[此贴子已经被作者于2006-9-10 10:26:49编辑过]
这是我在这个游戏中的算法
先帖一部分
int Game()
{
char ME,Cp_Chose,R;
while(GAME)
{
MouseMove();
if((ME=MouseEvent(1))&&GetMouseS()==1)
{
draw_64k_view(SJB_FName[ME-1],DRAW_SJB_X+150,DRAW_SJB_Y,1);
Cp_Chose=random(3);
draw_64k_view(SJB_FName[Cp_Chose],DRAW_SJB_X,DRAW_SJB_Y,1);
R=ME-1-Cp_Chose;
if(R)
{
if(R==-1||R==2)
{
WinSorce();
}
else
{
LoseSorce();
}
}
else
{
Deuce();
}
if(SORCE<=0)
GAME=0;
if(SORCE>=WIN_SORCE)
WinGame();
}
if(kbhit())
if(bioskey(0)==283)
end();
}
LoseGame();
}