游戏都是进行过编译,加密的无法看到源代码。如果你想查看的游戏是开源的,可以到游戏的开源网站进行查看。
查看APP应用的源代码的具体方法步骤如下:
1、首先在电脑内下载并安装获取网页源码app。
2、然后单击打开网页源码APP并在APP中的输入框内输入想要查看的网址,再在界面内找到GO选项单并单击。
3、单击后等待APP最后加载3秒就可以成功的获取APP源代码并查看了。
Android 系统源代码多大
是指sdk的源码,还是android操作系统的源码,不过都有10G左右,另外sdk的源码是用git管理的,一次下载后,用git check就可以切换到各个版本。
Android SDK是用于开发Android上JAVA应用程序的,另外发布Android NDK,可以添加一些C语言写的链接库,至于Linux代码,可以在Android源代码中找到(SDK程序中只有编译好的测试映像)。
应用程序开发用不到Linux代码(搞嵌入式开发才会用到,而SDK不负责底层开发)。
用C++编写的小游戏源代码
猜数字
建一个文本文档,输入以下代码,后缀改为frm用vb打开就可以了
以下是程序源码:
VERSION 500
Begin VBForm Form1
BorderStyle = 3 'Fixed Dialog
Caption = "猜数游戏"
ClientHeight = 3900
ClientLeft = 45
ClientTop = 435
ClientWidth = 4680
linkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3900
ScaleWidth = 4680
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VBCommandButton Command2
Caption = "重新开始"
Height = 615
Left = 2640
TabIndex = 2
Top = 2760
Width = 1095
End
Begin VBCommandButton Command1
Caption = "确定"
Height = 615
Left = 840
TabIndex = 1
Top = 2760
Width = 1095
End
Begin VBTextBox Text1
Height = 375
Left = 1200
TabIndex = 0
Top = 2040
Width = 2055
End
Begin VBLabel Label9
Caption = "戏"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000080FF&
Height = 615
Left = 3720
TabIndex = 11
Top = 240
Width = 615
End
Begin VBLabel Label8
Caption = "游"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00808080&
Height = 615
Left = 3240
TabIndex = 10
Top = 240
Width = 615
End
Begin VBLabel Label7
Caption = "数"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 495
Left = 2760
TabIndex = 9
Top = 240
Width = 615
End
Begin VBLabel Label6
Caption = "猜"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF00FF&
Height = 495
Left = 2280
TabIndex = 8
Top = 240
Width = 735
End
Begin VBLabel Label5
Caption = "入"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 615
Left = 1800
TabIndex = 7
Top = 240
Width = 855
End
Begin VBLabel Label4
Caption = "进"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 735
Left = 1320
TabIndex = 6
Top = 240
Width = 735
End
Begin VBLabel Label3
Caption = "迎"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFF00&
Height = 735
Left = 840
TabIndex = 5
Top = 240
Width = 735
End
Begin VBLabel Label2
Caption = "欢"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 615
Left = 360
TabIndex = 4
Top = 240
Width = 495
End
Begin VBLabel Label1
Caption = "我这儿有1~10的整数,你猜猜看他是多少"
Height = 375
Left = 480
TabIndex = 3
Top = 1320
Width = 3855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim x As Integer, y As Integer, z As Integer
Dim cishu As Integer
Private Sub Command1_Click()
If cishu = 3 Then MsgBox "已经猜3次了,这个数是" & x: Exit Sub
y = Val(Text1Text)
If Text1Text = "" Or Not IsNumeric(Text1Text) Then
MsgBox "输入有误!请重新输入数字", 48
Text1Text = ""
Text1SetFocus
Exit Sub
End If
cishu = cishu + 1
Select Case x - y
Case Is < 0
z = MsgBox("你猜数大了,请重猜。注意:你只有三次机会", 48 + 1)
Text1Text = ""
Text1SetFocus
Case Is > 0
z = MsgBox("你猜数小了,请重猜。注意:你只有三次机会", 48 + 1)
Text1Text = ""
Text1SetFocus
Case Else
z = MsgBox("恭喜你猜中了!", 1)
End Select
End Sub
Private Sub Command2_Click()
cishu = 0
Randomize Timer
x = Int((Rnd 10) + 1)
End Sub
Private Sub Form_Load()
cishu = 0
Randomize Timer
x = Int((Rnd 10) + 1)
End Sub
代码结束
http://hibaiducom/卓7358/
欢迎来我空间
五子棋的代码:
#include<iostream>
#include<stdioh>
#include<stdlibh>
#include<timeh>
usingnamespacestd;
constintN=15; //1515的棋盘
constcharChessBoardflag=''; //棋盘标志
constcharflag1='o'; //玩家1或电脑的棋子标志
constcharflag2='X'; //玩家2的棋子标志
typedefstructCoordinate //坐标类
{
intx; //代表行
inty; //代表列
}Coordinate;
classGoBang //五子棋类
{
public:
GoBang() //初始化
{
InitChessBoard();
}
voidPlay() //下棋
{
CoordinatePos1; //玩家1或电脑
CoordinatePos2; //玩家2
intn=0;
while(1)
{
intmode=ChoiceMode();
while(1)
{
if(mode==1) //电脑vs玩家
{
ComputerChess(Pos1,flag1); //电脑下棋
if(GetVictory(Pos1,0,flag1)==1) //0表示电脑,真表示获胜
break;
PlayChess(Pos2,2,flag2); //玩家2下棋
if(GetVictory(Pos2,2,flag2)) //2表示玩家2
break;
}
else //玩家1vs玩家2
{
PlayChess(Pos1,1,flag1); //玩家1下棋
if(GetVictory(Pos1,1,flag1)) //1表示玩家1
break;
PlayChess(Pos2,2,flag2); //玩家2下棋
if(GetVictory(Pos2,2,flag2)) //2表示玩家2
break;
}
}
cout<<"再来一局"<<endl;
cout<<"yorn:";
charc='y';
cin>>c;
if(c=='n')
break;
}
}
protected:
intChoiceMode() //选择模式
{
inti=0;
system("cls"); //系统调用,清屏
InitChessBoard(); //重新初始化棋盘
cout<<"0、退出 1、电脑vs玩家 2、玩家vs玩家"<<endl;
while(1)
{
cout<<"请选择:";
cin>>i;
if(i==0) //选择0退出
exit(1);
if(i==1||i==2)
returni;
cout<<"输入不合法"<<endl;
}
}
voidInitChessBoard() //初始化棋盘
{
for(inti=0;i<N+1;++i)
{
for(intj=0;j<N+1;++j)
{
_ChessBoard[i][j]=ChessBoardflag;
}
}
}
voidPrintChessBoard() //打印棋盘,这个函数可以自己调整
{
system("cls"); //系统调用,清空屏幕
for(inti=0;i<N+1;++i)
{
for(intj=0;j<N+1;++j)
{
if(i==0) //打印列数字
{
if(j!=0)
printf("%d ",j);
else
printf(" ");
}
elseif(j==0) //打印行数字
printf("%2d",i);
else
{
if(i<N+1)
{
printf("%c|",_ChessBoard[i][j]);
}
}
}
cout<<endl;
cout<<" ";
for(intm=0;m<N;m++)
{
printf("--|");
}
cout<<endl;
}
}
voidPlayChess(Coordinate&pos,intplayer,intflag) //玩家下棋
{
PrintChessBoard(); //打印棋盘
while(1)
{
printf("玩家%d输入坐标:",player);
cin>>posx>>posy;
if(Judgevalue(pos)==1) //坐标合法
break;
cout<<"坐标不合法,重新输入"<<endl;
}
_ChessBoard[posx][posy]=flag;
}
voidComputerChess(Coordinate&pos,charflag) //电脑下棋
{
PrintChessBoard(); //打印棋盘
intx=0;
inty=0;
while(1)
{
x=(rand()%N)+1; //产生1~N的随机数
srand((unsignedint)time(NULL));
y=(rand()%N)+1; //产生1~N的随机数
srand((unsignedint)time(NULL));
if(_ChessBoard[x][y]==ChessBoardflag) //如果这个位置是空的,也就是没有棋子
break;
}
posx=x;
posy=y;
_ChessBoard[posx][posy]=flag;
}
intJudgevalue(constCoordinate&pos) //判断输入坐标是不是合法
{
if(posx>0&&posx<=N&&posy>0&&posy<=N)
{
if(_ChessBoard[posx][posy]==ChessBoardflag)
{
return1; //合法
}
}
return0; //非法
}
intJudgeVictory(Coordinatepos,charflag) //判断有没有人胜负(底层判断)
{
intbegin=0;
intend=0;
intbegin1=0;
intend1=0;
//判断行是否满足条件
(posy-4)>0begin=(posy-4):begin=1;
(posy+4)>Nend=N:end=(posy+4);
for(inti=posx,j=begin;j+4<=end;j++)
{
if(_ChessBoard[i][j]==flag&&_ChessBoard[i][j+1]==flag&&
_ChessBoard[i][j+2]==flag&&_ChessBoard[i][j+3]==flag&&
_ChessBoard[i][j+4]==flag)
return1;
}
//判断列是否满足条件
(posx-4)>0begin=(posx-4):begin=1;
(posx+4)>Nend=N:end=(posx+4);
for(intj=posy,i=begin;i+4<=end;i++)
{
if(_ChessBoard[i][j]==flag&&_ChessBoard[i+1][j]==flag&&
_ChessBoard[i+2][j]==flag&&_ChessBoard[i+3][j]==flag&&
_ChessBoard[i+4][j]==flag)
return1;
}
intlen=0;
//判断主对角线是否满足条件
posx>posylen=posy-1:len=posx-1;
if(len>4)
len=4;
begin=posx-len; //横坐标的起始位置
begin1=posy-len; //纵坐标的起始位置
posx>posylen=(N-posx):len=(N-posy);
if(len>4)
len=4;
end=posx+len; //横坐标的结束位置
end1=posy+len; //纵坐标的结束位置
for(inti=begin,j=begin1;(i+4<=end)&&(j+4<=end1);++i,++j)
{
if(_ChessBoard[i][j]==flag&&_ChessBoard[i+1][j+1]==flag&&
_ChessBoard[i+2][j+2]==flag&&_ChessBoard[i+3][j+3]==flag&&
_ChessBoard[i+4][j+4]==flag)
return1;
}
//判断副对角线是否满足条件
(posx-1)>(N-posy)len=(N-posy):len=posx-1;
if(len>4)
len=4;
begin=posx-len; //横坐标的起始位置
begin1=posy+len; //纵坐标的起始位置
(N-posx)>(posy-1)len=(posy-1):len=(N-posx);
if(len>4)
len=4;
end=posx+len; //横坐标的结束位置
end1=posy-len; //纵坐标的结束位置
for(inti=begin,j=begin1;(i+4<=end)&&(j-4>=end1);++i,--j)
{
if(_ChessBoard[i][j]==flag&&_ChessBoard[i+1][j-1]==flag&&
_ChessBoard[i+2][j-2]==flag&&_ChessBoard[i+3][j-3]==flag&&
_ChessBoard[i+4][j-4]==flag)
return1;
}
for(inti=1;i<N+1;++i) //棋盘有没有下满
{
for(intj=1;j<N+1;++j)
{
if(_ChessBoard[i][j]==ChessBoardflag)
return0; //0表示棋盘没满
}
}
return-1; //和棋
}
boolGetVictory(Coordinate&pos,intplayer,intflag) //对JudgeVictory的一层封装,得到具体那个玩家获胜
{
intn=JudgeVictory(pos,flag); //判断有没有人获胜
if(n!=0) //有人获胜,0表示没有人获胜
{
PrintChessBoard();
if(n==1) //有玩家赢棋
{
if(player==0) //0表示电脑获胜,1表示玩家1,2表示玩家2
printf("电脑获胜n");
else
printf("恭喜玩家%d获胜n",player);
}
else
printf("双方和棋n");
returntrue; //已经有人获胜
}
returnfalse; //没有人获胜
}
private:
char_ChessBoard[N+1][N+1];
};
扩展资料:
设计思路
1、进行问题分析与设计,计划实现的功能为,开局选择人机或双人对战,确定之后比赛开始。
2、比赛结束后初始化棋盘,询问是否继续比赛或退出,后续可加入复盘、悔棋等功能。
3、整个过程中,涉及到了棋子和棋盘两种对象,同时要加上人机对弈时的AI对象,即涉及到三个对象。