软件构造Lab2-Playing Chess

  • ADT设计/实现方案
    • 主程序MyChessAndGoGame设计/实现方案

ADT设计/实现方案

对于Player、Board、Piece、Action都设计一个接口和go、chess两个继承类。以下展示接口中的方法以及类中除实现接口中已存在的方法的独立方法。
Player接口:
方法说明
public void addPiece(Piece addPiece); 用于添加棋子到玩家集合
public void removePiece(Piece removePiece); 用于从玩家集合移除棋子
public Set getPiecesSet(); 获取玩家的棋子集合
goPlayer:
方法说明
public goPlayer(String playerName) 设置棋子名
ChessPlayer:
方法说明
public chessPlayer(String playerName) 设置初始棋子集合与棋子名
Board接口:

//获取棋子
public Piece getPiece(int x,int y);//检查点
public boolean checkPoint(int x,int y);//在棋盘上添加
public void add(Piece position,int x,int y);//在棋盘上移除
public void remove(int x,int y);//在棋盘上移动
public void move(int x,int y,int x1,int y1);
goBoard:
private final int boardSize = 19;
Piece boardJuzhen[][] = new Piece[boardSize][boardSize];
goAction action1 = new goAction();

方法说明
public goBoard() 初始化棋盘
public void showGoBoard() 展示棋盘
public void showGoBoard() 展示棋盘

Chessboard:
private final int boardSize = 8;
Piece theboard[][] = new Piece[boardSize][boardSize];
chessAction action1 = new chessAction();
方法说明
public chessBoard(chessPlayer chessPlayer1, chessPlayer chessPlayer2) 调用棋盘初始化
public void initChessBoard 初始化棋盘
public void showChessBoard 展示棋盘

Piece接口:

//get the type of piece
public String getType();//get the wether the piece is used
public boolean getUsed();//set piece
public void setPiece(String pieceName);//set the wether the piece is used
public void setUsed();
public void setBackUsed();

Gopiece:
方法 说明
public goPiece(String color) 构造棋子
Chesspiece:
方法 说明
public chessPiece(String pieceName) 构造象棋棋子

Action接口:

//添加
public void add(Piece theboard[][],Piece piece1,int x,int y);//移除
public void remove(Piece theboard[][],int x,int y);//移动
public void move(Piece theboard[][],int x,int y,int x1,int y1);

goaction和chessaction都只需按照需要重写action中的方法即可。

以下是ADT中的其他类:
Position:
int x;
int y;
Piece Piece1;
方法 说明
public Position 构造位置
public int getX() 获取x
public int getY() 获取y

Game:
String gameTypeString;
List historyList = new ArrayList();
方法 说明
public Game(String gameTypeString) 初始游戏类型
private static void ChessMenu() 象棋菜单
private static void GoMenu() 围棋菜单
public void gameStart() 游戏主程序
public void showHistory() 展示游戏历史

主程序MyChessAndGoGame设计/实现方案

GAMEmenu:
GAMEmenu类用来运行游戏主界面如下:

选择分支如下:

接下来进入GAME类中执行public void gameStart()方法。
读取用户的选择,若移动棋子,再输入相应坐标,调用ADT的各个部分执行操作。

软件构造Lab2-Playing Chess相关推荐

  1. 软件构造lab2 - 实验报告

    软件构造lab2 - 实验报告 1.实验目标概述 2.环境配置 3.实验过程 3.1Poetic Walks 3.1.1Get the code and prepare Git repository ...

  2. 哈工大2020软件构造Lab2 Problem3 Playing Chess 架构设计思路

    哈工大2020春软件构造实验2 Problem 3 Playing Chess 架构设计思路 问题简述 整体结构 ADT功能设计 功能实现路径 问题简述: 设计一款棋类游戏,同时支持国际象棋(Ches ...

  3. 软件构造Lab2总结

    2020年春季学期 计算机学院<软件构造>课程 Lab2实验报告 ·· 1 3.1 Poetic Walks· 1 3.1.1 Get the code and prepare Git r ...

  4. 哈工大2020软件构造Lab2实验报告

    本项目于3.17日实验课验收,请放心参考 参考时文中有给出一些建议,请查看 基本更新完成 2020春计算机学院<软件构造>课程Lab2实验报告 Software Construction ...

  5. HIT 软件构造 lab2实验报告

    2020年春季学期 计算机学院<软件构造>课程 Lab 2实验报告 学号 1180300223 班号 1803002 目录 1 实验目标概述 1 2 实验环境配置 1 3 实验过程 1 3 ...

  6. HIT 软件构造 lab2

    1 实验目标概述··· 1 2 实验环境配置··· 1 3 实验过程··· 1 3.1 Poetic Walks· 1 3.1.1 Get the code and prepare Git repos ...

  7. 软件构造 Lab-2 Report

    文章目录 1 实验目标概述 2 实验环境配置 3 实验过程 3.1 Poetic Walks 3.1.1 Get the code and prepare Git repository 3.1.2 P ...

  8. 2020春软件构造Lab2 ADT and OOP

    ADT and OOP 1 实验目标概述 2 实验环境配置 3 实验过程 3.1 Poetic Walks 3.1.1 Get the code and prepare Git repository ...

  9. HIT软件构造lab2报告

    1. 实验目标概述 本次实验训练抽象数据类型(ADT)的设计.规约.测试,并使用面向对象 编程(OOP)技术实现 ADT.具体来说: l 针对给定的应用问题,从问题描述中识别所需的 ADT: l 设计 ...

  10. 软件构造LAB2心得

    目录   1 实验目标概述 2 实验环境配置 3 实验过程 3.1 Poetic Walks 3.1.1 Get the code and prepare Git repository 3.1.2 P ...

最新文章

  1. spark 中的RDD编程:基于Java api
  2. 使用 postman 进行接口测试
  3. Python《搞事情==蜂-鸟-图-片(一)》
  4. 从零开始学前端:形变(小游戏:3D翻滚盒子) --- 今天你学习了吗?(CSS:Day21)
  5. [译]GLUT教程 - 整合代码3
  6. Nodejs在Debian和Ubuntu上安装
  7. kux格式怎么转换成mp3_怎么快速无损地把视频转换成mp3格式?三种方法了解一下吗?...
  8. OpenGL 视椎体剔除算法
  9. html显示vbs变量,VBS 读取 对象某属性已连接的变量的变量名
  10. 2020牛客暑期多校训练营(第八场)A.All-Star Game(线段树+带撤销并查集)
  11. 1、库中齿轮凸台拉伸
  12. 【安卓小笔记】自己制作一个Launcher
  13. ABeam中国2022社招 | ABeam旗下艾宾信息技术开发(大连) 最新招聘信息
  14. 流放之路 剧情 第六章
  15. java笔记--多敲代码四
  16. js encodeuricomponent php解码,JS中encodeURIComponent函数用php 解码
  17. 社会知觉:我们如何理解他人
  18. POI导出百万数据 EXCEL addMergedReigon 合并单元格慢的问题解决
  19. 《SpringBoot框架学习二之HTTP协议》
  20. 针对百度绿萝算法的规避方法

热门文章

  1. rtx3090ti什么水平 rtx3090ti显卡什么级别 rtx3090ti显卡怎么样
  2. 手动安装jenkins默认插件
  3. 灵思科电子科技—室内定位技术有哪些_七大室内定位技术详解
  4. S3C2410中文芯片手册-11.串口
  5. 火箭联盟修改车重教程,国服Wegame平台和外服Steam平台通用方法
  6. 2021第六届数维杯大学生数学建模竞赛题目
  7. “华为杯”研究生数学建模竞赛2020年-【华为杯】B题:降低汽油精制过程中的辛烷值损失模型(附获奖论文)
  8. ​寒武纪思元370系列与飞桨完成II级兼容性测试,联合赋能AI落地实践
  9. 假期北京旅游请注意了!
  10. 什么是标准化,规范化,系统化?