当前位置:首页 > 代码 > 正文

破解围棋源代码(围棋吾爱破解)

admin 发布:2022-12-19 09:57 132


今天给各位分享破解围棋源代码的知识,其中也会对围棋吾爱破解进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

求五子棋C源代码

这个是稍微好一点的了,以前没事试过

/*

五子棋

*/

#includestdio.h

#includestdlib.h

#includegraphics.h

#includebios.h

#includeconio.h

#define LEFT 0x4b00

#define RIGHT 0x4d00

#define DOWN 0x5000

#define UP 0x4800

#define ESC 0x011b

#define SPACE 0x3920

#define BILI 20

#define JZ 4

#define JS 3

#define N 19

int box[N][N];

int step_x,step_y ;

int key ;

int flag=1 ;

void draw_box();

void draw_cicle(int x,int y,int color);

void change();

void judgewho(int x,int y);

void judgekey();

int judgeresult(int x,int y);

void attentoin();

void attention()

{

char ch ;

window(1,1,80,25);

textbackground(LIGHTBLUE);

textcolor(YELLOW);

clrscr();

gotoxy(15,2);

printf("游戏操作规则:");

gotoxy(15,4);

printf("Play Rules:");

gotoxy(15,6);

printf("1、按左右上下方向键移动棋子");

gotoxy(15,8);

printf("1. Press Left,Right,Up,Down Key to move Piece");

gotoxy(15,10);

printf("2、按空格确定落棋子");

gotoxy(15,12);

printf("2. Press Space to place the Piece");

gotoxy(15,14);

printf("3、禁止在棋盘外按空格");

gotoxy(15,16);

printf("3. DO NOT press Space outside of the chessboard");

gotoxy(15,18);

printf("你是否接受上述的游戏规则(Y/N)");

gotoxy(15,20);

printf("Do you accept the above Playing Rules? [Y/N]:");

while(1)

{

gotoxy(60,20);

ch=getche();

if(ch=='Y'||ch=='y')

break ;

else if(ch=='N'||ch=='n')

{

window(1,1,80,25);

textbackground(BLACK);

textcolor(LIGHTGRAY);

clrscr();

exit(0);

}

gotoxy(51,12);

printf(" ");

}

}

void draw_box()

{

int x1,x2,y1,y2 ;

setbkcolor(LIGHTBLUE);

setcolor(YELLOW);

gotoxy(7,2);

printf("Left, Right, Up, Down KEY to move, Space to put, ESC-quit.");

for(x1=1,y1=1,y2=18;x1=18;x1++)

line((x1+JZ)*BILI,(y1+JS)*BILI,(x1+JZ)*BILI,(y2+JS)*BILI);

for(x1=1,y1=1,x2=18;y1=18;y1++)

line((x1+JZ)*BILI,(y1+JS)*BILI,(x2+JZ)*BILI,(y1+JS)*BILI);

for(x1=1;x1=18;x1++)

for(y1=1;y1=18;y1++)

box[x1][y1]=0 ;

}

void draw_circle(int x,int y,int color)

{

setcolor(color);

setlinestyle(SOLID_LINE,0,1);

x=(x+JZ)*BILI ;

y=(y+JS)*BILI ;

circle(x,y,8);

}

void judgekey()

{

int i ;

int j ;

switch(key)

{

case LEFT :

if(step_x-10)

break ;

else

{

for(i=step_x-1,j=step_y;i=1;i--)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(i1)break ;

step_x=i ;

judgewho(step_x,step_y);

break ;

}

case RIGHT :

if(step_x+118)

break ;

else

{

for(i=step_x+1,j=step_y;i=18;i++)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(i18)break ;

step_x=i ;

judgewho(step_x,step_y);

break ;

}

case DOWN :

if((step_y+1)18)

break ;

else

{

for(i=step_x,j=step_y+1;j=18;j++)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(j18)break ;

step_y=j ;

judgewho(step_x,step_y);

break ;

}

case UP :

if((step_y-1)0)

break ;

else

{

for(i=step_x,j=step_y-1;j=1;j--)

if(box[i][j]==0)

{

draw_circle(step_x,step_y,LIGHTBLUE);

break ;

}

if(j1)break ;

step_y=j ;

judgewho(step_x,step_y);

break ;

}

case ESC :

break ;

case SPACE :

if(step_x=1step_x=18step_y=1step_y=18)

{

if(box[step_x][step_y]==0)

{

box[step_x][step_y]=flag ;

if(judgeresult(step_x,step_y)==1)

{

sound(1000);

delay(1000);

nosound();

gotoxy(30,4);

if(flag==1)

{

setbkcolor(BLUE);

cleardevice();

setviewport(100,100,540,380,1);

/*定义一个图形窗口*/

setfillstyle(1,2);

/*绿色以实填充*/

setcolor(YELLOW);

rectangle(0,0,439,279);

floodfill(50,50,14);

setcolor(12);

settextstyle(1,0,5);

/*三重笔划字体, 水平放?5倍*/

outtextxy(20,20,"The White Win !");

setcolor(15);

settextstyle(3,0,5);

/*无衬笔划字体, 水平放大5倍*/

outtextxy(120,120,"The White Win !");

setcolor(14);

settextstyle(2,0,8);

getch();

closegraph();

exit(0);

}

if(flag==2)

{

setbkcolor(BLUE);

cleardevice();

setviewport(100,100,540,380,1);

/*定义一个图形窗口*/

setfillstyle(1,2);

/*绿色以实填充*/

setcolor(YELLOW);

rectangle(0,0,439,279);

floodfill(50,50,14);

setcolor(12);

settextstyle(1,0,8);

/*三重笔划字体, 水平放大8倍*/

outtextxy(20,20,"The Red Win !");

setcolor(15);

settextstyle(3,0,5);

/*无衬笔划字体, 水平放大5倍*/

outtextxy(120,120,"The Red Win !");

setcolor(14);

settextstyle(2,0,8);

getch();

closegraph();

exit(0);

}

}

change();

break ;

}

}

else

break ;

}

}

void change()

{

if(flag==1)

flag=2 ;

else

flag=1 ;

}

void judgewho(int x,int y)

{

if(flag==1)

draw_circle(x,y,15);

if(flag==2)

draw_circle(x,y,4);

}

int judgeresult(int x,int y)

{

int j,k,n1,n2 ;

while(1)

{

n1=0 ;

n2=0 ;

/*水平向左数*/

for(j=x,k=y;j=1;j--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*水平向右数*/

for(j=x,k=y;j=18;j++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*垂直向上数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;k=1;k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*垂直向下数*/

for(j=x,k=y;k=18;k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*向左上方数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;j=1,k=1;j--,k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*向右下方数*/

for(j=x,k=y;j=18,k=18;j++,k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

/*向右上方数*/

n1=0 ;

n2=0 ;

for(j=x,k=y;j=18,k=1;j++,k--)

{

if(box[j][k]==flag)

n1++;

else

break ;

}

/*向左下方数*/

for(j=x,k=y;j=1,k=18;j--,k++)

{

if(box[j][k]==flag)

n2++;

else

break ;

}

if(n1+n2-1=5)

{

return(1);

break ;

}

return(0);

break ;

}

}

void main()

{

int gdriver=VGA,gmode=VGAHI;

clrscr();

attention();

initgraph(gdriver,gmode,"c:\\tc");

/* setwritemode(XOR_PUT);*/

flag=1 ;

draw_box();

do

{

step_x=0 ;

step_y=0 ;

/*draw_circle(step_x,step_y,8); */

judgewho(step_x-1,step_y-1);

do

{

while(bioskey(1)==0);

key=bioskey(0);

judgekey();

}

while(key!=SPACEkey!=ESC);

}

while(key!=ESC);

closegraph();

}

急求 用c++编写的人机对弈的围棋的程序代码,最好有注释!谢啦!!

int Count = 600;

AnsiString CaTimer(int Value)

{

AnsiString ss;

ss.printf("%02d:%02d:%02d",Value/(60*60), (Value%(60*60))/60,Value%60);

return ss;

}

//---------------------------------------------------------------------------

void __fastcall TForm1::Timer1Timer(TObject *Sender)

{

Count--;

Label1-Caption = CaTimer(Count) ;

}

// 要设置计时器 1秒钟 一次。 Timer1-Interval = 1000; (毫秒)

// 打开关闭 可以设置 Timer1 的属性 Enabled 为true , false

围棋java源代码

就给你一个吧,只不过没有添加棋子,你自己搞吧。import java.applet.*;

import java.awt.*;

import java.awt.event.*;

class ChessPad extends Panel implements MouseListener,ActionListener

{int x=-1,y=-1,棋子颜色=1;

Button button=new Button("重新开局");

TextField text_1=new TextField("请黑棋下子"),

text_2=new TextField();

ChessPad()

{setSize(440,440);

setLayout(null);setBackground(Color.pink);

addMouseListener(this);add(button);button.setBounds(10,5,60,26);

button.addActionListener(this);

add(text_1);text_1.setBounds(90,5,90,24);

add(text_2);text_2.setBounds(290,5,90,24);

text_1.setEditable(false);text_2.setEditable(false);

}

public void paint(Graphics g)

{for(int i=40;i=380;i+=20)

{g.drawLine(40,i,400,i);

}

g.drawLine(40,400,400,400);

for(int j=40;j=380;j+=20)

{g.drawLine(j,40,j,400);

}

g.drawLine(400,40,400,400);

g.fillOval(97,97,6,6);g.fillOval(337,97,6,6);

g.fillOval(97,337,6,6);g.fillOval(337,337,6,6);

g.fillOval(217,217,6,6);

}

public void mousePressed(MouseEvent e)

{if(e.getModifiers()==InputEvent.BUTTON1_MASK)

{x=(int)e.getX();y=(int)e.getY();

ChessPoint_black chesspoint_black=new ChessPoint_black(this);

ChessPoint_white chesspoint_white=new ChessPoint_white(this);

int a=(x+10)/2,b=(y+10)/2;

if(x/202||y/202||x/2019||y/2019)

{}

else

{

if(棋子颜色==1)

{this.add(chesspoint_black);

chesspoint_black.setBounds(a*20-7,b*20-7,16,16);

棋子颜色=棋子颜色*(-1);

text_2.setText("请白棋下子");

text_1.setText("");

}

else if(棋子颜色==-1)

{this.add(chesspoint_white);

chesspoint_white.setBounds(a*20-7,b*20-7,16,16);

棋子颜色=棋子颜色*(-1);

text_1.setText("请黑棋下子");

text_2.setText("");

}

}

}

}

public void mouseReleased(MouseEvent e){}

public void mouseEntered(MouseEvent e){}

public void mouseExited(MouseEvent e){}

public void mouseClicked(MouseEvent e){}

public void actionPerformed(ActionEvent e)

{this.removeAll();棋子颜色=1;

add(button);button.setBounds(10,5,60,26);

add(text_1);text_1.setBounds(90,5,90,24);

text_2.setText("");text_1.setText("请黑棋下子");

add(text_2);text_2.setBounds(290,5,90,24);

}

}

class ChessPoint_black extends Canvas implements MouseListener

{ChessPad chesspad=null;

ChessPoint_black(ChessPad p)

{setSize(20,20);chesspad=p;addMouseListener(this);

}

public void paint(Graphics g)

{g.setColor(Color.black);g.fillOval(0,0,14,14);

}

public void mousePressed(MouseEvent e)

{if(e.getModifiers()==InputEvent.BUTTON3_MASK)

{chesspad.remove(this);

chesspad.棋子颜色=1;

chesspad.text_2.setText("");chesspad.text_1.setText("请黑棋下子");

}

}

public void mouseReleased(MouseEvent e){}

public void mouseEntered(MouseEvent e){}

public void mouseExited(MouseEvent e){}

public void mouseClicked(MouseEvent e)

{if(e.getClickCount()=2)

chesspad.remove(this);

}

}

class ChessPoint_white extends Canvas implements MouseListener

{ChessPad chesspad=null;

ChessPoint_white(ChessPad p)

{setSize(20,20);addMouseListener(this);

chesspad=p;

}

public void paint(Graphics g)

{g.setColor(Color.white);g.fillOval(0,0,14,14);

}

public void mousePressed(MouseEvent e)

{if(e.getModifiers()==InputEvent.BUTTON3_MASK)

{chesspad.remove(this);

chesspad.棋子颜色=-1;

chesspad.text_2.setText("请白棋下子");chesspad.text_1.setText("");

}

}

public void mouseReleased(MouseEvent e){}

public void mouseEntered(MouseEvent e){}

public void mouseExited(MouseEvent e){}

public void mouseClicked(MouseEvent e)

{if(e.getClickCount()=2)

chesspad.remove(this);

}

}

public class Chess extends Frame

{ChessPad chesspad=new ChessPad();

Chess()

{setVisible(true);

setLayout(null);

Label label=new Label("单击左键下子,双击吃子,右击棋子悔棋",Label.CENTER);

add(label);label.setBounds(70,55,440,26);

label.setBackground(Color.orange);

add(chesspad);chesspad.setBounds(70,90,440,440);

addWindowListener(new WindowAdapter()

{public void windowClosing(WindowEvent e)

{System.exit(0);

}

});

pack();setSize(600,550);

}

public static void main (String args[])

{Chess chess=new Chess();

}

}

求围棋软件C++源代码,不要很复杂的,能够人机对弈就行,能在Vc++6.0下编译运行,十分感谢

GNU GO.

参考:.

关于GNU GO 的水平,请参考:

初步估计:围棋人机对弈软件GNU GO的真实水平

求围棋的VB源代码~

来~加 我 的QQ405557154 我做了一个,还有一同学做的,还有一是网上的朋友做的呵呵

Private Sub Timer1_Timer()

Dim ms As Boolean

Dim Info, temp As String

Dim p, p1, p2, i As Integer

Dim Ch

' Begin of Time Show Process

If ModemState LOGIN And SocketState CONNECTED Then

'it is not a multiusers game

Exit Sub

Else

If (S_R = 1) And (TURN = BLACKP) Then

Black_Time = Black_Time + Time - Start_Time

TimeB.Caption = CDate(Black_Time / 200)

Else

If (S_R = 1) And (TURN = WHITEP) Then

White_Time = White_Time + Time - Start_Time

TimeW.Caption = CDate(White_Time / 200)

Else

If (S_R = 0) And (TURN = WHITEP) Then

Black_Time = Black_Time + Time - Start_Time

TimeB.Caption = CDate(Black_Time / 200)

Else

If (S_R = 0) And (TURN = BLACKP) Then

White_Time = White_Time + Time - Start_Time

TimeW.Caption = CDate(White_Time / 200)

End If

End If

End If

End If

End If

'End If

' End of Time Show Process

'Begin of winsockt process

If SocketState = CONNECTED And Begin_Flag = 1 Then

ms = Net.Message_Exist

If ms = False Then

Exit Sub

End If

Info = Net.WaitForValue(Chr$(26), 5)

If g_ErrorCode = 1 Then

'Some error such as Timeout occured

Exit Sub

End If

p1 = InStr(Info, "B")

p2 = InStr(Info, "E|;")

If p1 = 0 Or p2 = 0 Then

Exit Sub

End If

temp = Mid$(Info, p1 + 1, p2 - p1 - 1)

ParseLine (temp)

Msg(Msg_No).No = CInt(ParseArray(1))

Msg(Msg_No).Color = CInt(ParseArray(2))

If IsNumeric(ParseArray(3)) Then

Msg(Msg_No).X = CInt(ParseArray(3))

Msg(Msg_No).Y = CInt(ParseArray(4))

Else

Msg(Msg_No).X = ParseArray(3)

Msg(Msg_No).Y = ParseArray(4)

End If

If Msg(Msg_No).Color = GIVEUP Then

Beep

MsgBox ("对方已经认输了")

Net.Winsock1.SendData ("R_O" + Chr$(26))

Pause 3

Call Begin_Click

Exit Sub

End If

If Side = BLACKP Then

p = Draw_Point(Msg(Msg_No).X, Msg(Msg_No).Y, WHITEP)

Record(Step).Color = WHITEP

step_show.Cls

step_show.Print Step

TURN = BLACKP

Else

p = Draw_Point(Msg(Msg_No).X, Msg(Msg_No).Y, BLACKP)

Record(Step).Color = BLACKP

step_show.Cls

step_show.Print Step

TURN = WHITEP

End If

Record(Step).X = Msg(Msg_No).X

Record(Step).Y = Msg(Msg_No).Y

Step = Step + 1

S_R = 1

R_R = 0

p = Count_All_Gas

If (Msg(Msg_No).X 0 And Msg(Msg_No).Y 0 _

And Msg(Msg_No).X 20 And Msg(Msg_No).Y 20) Then

Board(Msg(Msg_No).X, Msg(Msg_No).Y).Current = True

Refresh_Board

Board(Msg(Msg_No).X, Msg(Msg_No).Y).Current = False

End If

Msg_No = Msg_No + 1

Pause 1

Net.Winsock1.SendData ("R_O" + Chr$(26))

Exit Sub

End If

'End of process of winsocket

'Begin of modem process

If ModemState LOGIN Or R_R 1 Then

'It isn't a Inter_Modem Game

Exit Sub

End If

ms = Modem_F.Exist_Msg

If ms = False Then

'IO Port don't have any message

Exit Sub

End If

Info = Modem_F.WaitForValue(Chr$(26), 5)

'Wait a playing message

If g_ErrorCode = 1 Then

'Some error such as Timeout occured

Exit Sub

End If

p1 = InStr(Info, "B")

p2 = InStr(Info, "E|;")

If p1 = 0 Or p2 = 0 Then

Exit Sub

End If

temp = Mid$(Info, p1 + 1, p2 - p1 - 1)

ParseLine (temp)

Msg(Msg_No).No = CInt(ParseArray(1))

Msg(Msg_No).Color = CInt(ParseArray(2))

If IsNumeric(ParseArray(3)) Then

Msg(Msg_No).X = CInt(ParseArray(3))

Msg(Msg_No).Y = CInt(ParseArray(4))

Else

Msg(Msg_No).X = ParseArray(3)

Msg(Msg_No).Y = ParseArray(4)

End If

Modem_F.Comm1.InBufferCount = 0

'Clear Buffer

If Msg(Msg_No).Color = LOGOUT Then

Beep

MsgBox ("对方已经退出了")

Modem_F.Comm1.InBufferCount = 0

Modem_F.Comm1.Output = "R_O" + Chr$(26)

Cls

Step = 0

Start_Time = Time

Black_Time = 0

White_Time = 0

Exit Sub

End If

If Msg(Msg_No).Color = FINISHED Then

Beep

Ch = MsgBox("对方要求结束比赛,可以吗?", vbYesNo)

Modem_F.Comm1.InBufferCount = 0

If Ch = 6 Then

Modem_F.Comm1.Output = "YESR_O" + Chr$(26)

Else

Modem_F.Comm1.Output = "NOR_O" + Chr$(26)

Exit Sub

End If

PlayState = FINISHED

Count_Area.Enabled = True

End If

If Msg(Msg_No).Color = GIVEUP Then

Beep

MsgBox ("对方已经认输了")

Modem_F.Comm1.InBufferCount = 0

Modem_F.Comm1.Output = "R_O" + Chr$(26)

Call Begin_Click

Exit Sub

End If

If Msg(Msg_No).Color = TALK Then

Beep

MsgBox (Modem_F.His_Name.Text "说: " Msg(Msg_No).X)

Modem_F.Comm1.InBufferCount = 0

Modem_F.Comm1.Output = "R_O" + Chr$(26)

Exit Sub

End If

If Msg(Msg_No).Color = UNDO Then

Step = Step - 1

Beep

Modem_F.Comm1.InBufferCount = 0

Modem_F.Comm1.Output = "R_O" + Chr$(26)

Draw_Board

Ini_Board

For i = 1 To Step - 1

Board(Record(i).X, Record(i).Y).Current = False

p = Draw_Point(Record(i).X, Record(i).Y, Record(i).Color)

step_show.Cls

step_show.Print Step

p = Count_All_Gas

Next i

Board(Record(Step - 1).X, Record(Step - 1).Y).Current = True

Refresh_Board

Board(Record(Step - 1).X, Record(Step - 1).Y).Current = False

S_R = 1

R_R = 0

TURN = Side

Exit Sub

End If

Modem_F.Comm1.InBufferCount = 0

Modem_F.Comm1.Output = "R_O" + Chr$(26)

If Side = BLACKP Then

p = Draw_Point(Msg(Msg_No).X, Msg(Msg_No).Y, WHITEP)

Record(Step).Color = WHITEP

step_show.Cls

step_show.Print Step

Else

p = Draw_Point(Msg(Msg_No).X, Msg(Msg_No).Y, BLACKP)

Record(Step).Color = BLACKP

step_show.Cls

step_show.Print Step

End If

Record(Step).X = Msg(Msg_No).X

Record(Step).Y = Msg(Msg_No).Y

Step = Step + 1

S_R = 1

R_R = 0

p = Count_All_Gas

If (Msg(Msg_No).X 0 And Msg(Msg_No).Y 0 _

And Msg(Msg_No).X 20 And Msg(Msg_No).Y 20) Then

Board(Msg(Msg_No).X, Msg(Msg_No).Y).Current = True

Refresh_Board

Board(Msg(Msg_No).X, Msg(Msg_No).Y).Current = False

End If

Msg_No = Msg_No + 1

End Sub

Private Sub Timer2_Timer()

ShowS.Cls

ShowS.Print " :-):-):-):-):-) " + Show_String(C1) + " (:-(:-(:-(:-(:-"

C1 = C1 + 1

If C1 = 10 Then

C1 = 0

End If

Game_Time.Cls

Game_Time.Print " 现在时间: " Time

End Sub

Private Sub Set_Hand(h As Integer)

'设置让子(1-9)

Dim p As Integer

If h = 1 Then

'Not a Handicap game

Exit Sub

End If

部分代码。。

破解围棋源代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于围棋吾爱破解、破解围棋源代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/6311.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载