• 大小: 21KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-16
  • 语言: Java
  • 标签: 软件  java  围棋  

资源简介

给出了java围棋非常详细的源代码,有兴趣的可以下载严军勇老师的看看

资源截图

代码片段和文件信息

import java.awt.*;
import java.util.*;
//import javax.swing.*;
//import java.awt.image.*;

public class Go extends Panel
{
    int whichStep;
    Hashtable myHash;
    Point pointNow;//当前的点
    Point STARTPOINT;
    int INTERVAL;
    Vector vec;
    Point robPoint;
    Point mousePoint;
    boolean errorFlag;

    //构建器
    public Go()
    {
        super();
        pointNow=new Point(10001000);//把初始红点画在外面
        errorFlag=false;//行棋错误标志
        whichStep=0;
        STARTPOINT=new Point(2020);
        INTERVAL=20;
        myHash=new Hashtable();
        robPoint=null;//打劫点
        mousePoint=new Point();//开辟鼠标点内存
        vec=new Vector();//存放校验的子
        this.initMyHash(STARTPOINTINTERVAL);
        try
        {
            jbInit();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

    }
    //初始化hashtable
    void initMyHash(Point startPointint interval)
    {
        One one;
        Point key;//逻辑点标志
        int ij;
        for(i=1;i<=19;i++)
            for(j=1;j<=19;j++)
            {
                key=new Point(ij);
                one=new One();
                one.posX=startPoint.x+(i-1)*interval;
                one.posY=startPoint.y+(j-1)*interval;
                //获取相邻点
                one.pointAround[0]=new Point(ij-1);//上
                one.pointAround[1]=new Point(ij+1);//下
                one.pointAround[2]=new Point(i-1j);//左
                one.pointAround[3]=new Point(i+1j);//右
                if(i==1)one.pointAround[2]=one.OUT;
                if(i==19)one.pointAround[3]=one.OUT;
                if(j==1)one.pointAround[0]=one.OUT;
                if(j==19)one.pointAround[1]=one.OUT;

                myHash.put(keyone);
            }
    }


    //更新盘面
    public void paint(Graphics g)
    {
        Point startPoint=STARTPOINT;
        int interval=INTERVAL;
        this.paintChessboard(gstartPointinterval);
        this.paintChessman(gstartPointinterval);
    }
    //画棋盘
    void paintChessboard(Graphics gPoint startPointint interval)
    {
        int pX=startPoint.x;
        int pY=startPoint.y;
        int LINELENGTH=interval*18;
        int i;
        for(i=0;i<19;i++)
        {
            g.drawLine(pX+i*intervalpYpX+i*intervalpY+LINELENGTH);
            g.drawLine(pXpY+i*intervalpX+LINELENGTHpY+i*interval);
        }
        g.fillOval(pX+interval*3-3pY+interval*3-3(int)(interval-14)(int)(interval-14));
        g.fillOval(pX+interval*9-3pY+interval*3-3(int)(interval-14)(int)(interval-14));
        g.fillOval(pX+interval*15-3pY+interval*3-3(int)(interval-14)(int)(interval-14));
        g.fillOval(pX+interval*3-3pY+interval*9-3(int)(interval-14)(int)(interval-14));
        g.fillOval(pX+interval*9-3pY+interval*9-3(int)(interval-14)(int)(interval-14));
        g.fillOval(pX+interval*15-3pY+interval*9-3(int)(interval-14)(int)(interval-14));
        g.fillOval(pX+interval*3-3pY+interval*15-3(int)(interval-14)(int)(interval-14));
       

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......      5591  2014-05-09 08:36  围棋源代码java\Go.class

    .......      9456  2014-05-09 08:36  围棋源代码java\Go.java

    .......       311  2014-05-09 08:36  围棋源代码java\Goapplet.class

    .......       201  2014-05-09 08:36  围棋源代码java\Goapplet.java

    .......       992  2014-05-09 08:36  围棋源代码java\Listen.class

    .......       750  2014-05-09 08:36  围棋源代码java\Listen.java

    .......       474  2014-05-09 08:36  围棋源代码java\MainWindow$1.class

    .......       474  2014-05-09 08:36  围棋源代码java\MainWindow$2.class

    .......       505  2014-05-09 08:36  围棋源代码java\MainWindow$3.class

    .......       505  2014-05-09 08:36  围棋源代码java\MainWindow$4.class

    .......       474  2014-05-09 08:36  围棋源代码java\MainWindow$5.class

    .......       472  2014-05-09 08:36  围棋源代码java\MainWindow$6.class

    .......       473  2014-05-09 08:36  围棋源代码java\MainWindow$7.class

    .......     12261  2014-05-09 08:36  围棋源代码java\MainWindow.class

    .......     17710  2014-05-09 08:36  围棋源代码java\MainWindow.java

    .......       612  2014-05-09 08:36  围棋源代码java\One.class

    .......       262  2014-05-09 08:36  围棋源代码java\One.java

     目录          0  2014-05-27 11:37  围棋源代码java

----------- ---------  ---------- -----  ----

                51523                    18


评论

共有 条评论