20162328蔡文琛 实验五 数据结构综合应用

本次实验主要围绕数据结构综合应用展开,包括系统架构分析、代码编译运行及测试、系统修改等内容。通过实验,小组成员加深了对项目代码的理解,掌握了使用Android Studio编译和运行项目代码的方法,并成功实现了游戏视图界面的个性化定制。

实验五:数据结构综合应用

课程:程序设计与数据结构
班级: 1623
姓名: 蔡文琛
学号:20162328
指导教师:娄嘉鹏 王志强
实验日期:12月15日
实验密级: 非密级
预习程度: 已预习
必修/选修: 必修
实验名称: 数据结构综合应用

实验内容:

1.分析系统架构
2.编译、运行、测试系统
3.修改系统
4.分析数据结构、排序、查找算法的应用

实验要求

1.没有Linux基础的同学建议先学习《Linux基础入门(新版)》《Vim编辑器》 课程
完成实验、撰写实验报告,实验报告以博客方式发表在博客园,注意实验报告重点是 运行结果,遇到的问题(工具查找,安装,使用,程序的编辑,调试,运行等)、解决 办法(空洞的方法如“查网络”、“问同学”、“看书”等一律得0分)以及分析(从中可 以得到什么启示,有什么收获,教训等)。报告可以参考范飞龙老师的指导
严禁抄袭,有该行为者实验成绩归零,并附加其他惩罚措施。

数据结构分析

1066282-20171217230020296-439222798.jpg

这次项目我们组从一开始就严格按照老师所讲,为我们的项目设计了非常缜密的结构层次,保证详细到每个细节,让用户拥有不同的app体验。

周五实验总结
实验一

实验要求我们对小组码云项目的代码克隆和运行。
1066282-20171217230037452-204189515.png

建立个人文件夹,进入码云项目,使用bash将项目的所有代码全部克隆到自己的文件夹中。
1066282-20171217230053905-899991077.png

使用Android Studio对克隆的代码进行编译运行。

实验二

添加可以显示自己学号姓名的按钮,以及改变游戏视图界面。
1066282-20171217230111530-345152550.png

在布局文件中添加button,调整button的位置,改变button的名字,在主活动中添加要显示的信息。
1066282-20171217230130171-1602848664.png

改变设定好的游戏地图数组,显示出不同的地图。

查找算法的运用
//判断按键对象
    private boolean touch_blow_to_man(int touch_x, int touch_y, int manRow, int manColumn) {
        int width = (int) buttonWidth;
        int hight = (int) buttonHight;
        Rect belowRect = new Rect(2*width,getWidth()+2*hight,3*width,getWidth()+3*hight);
        return belowRect.contains(touch_x, touch_y);
    }

    private boolean touch_above_to_man(int touch_x, int touch_y, int manRow, int manColumn) {
        int width = (int) buttonWidth;
        int hight = (int) buttonHight;
        Rect aboveRect = new Rect(2*width,getWidth(),3*width,getWidth()+hight);
        return aboveRect.contains(touch_x, touch_y);
    }

    private boolean touch_left_to_man(int touch_x, int touch_y,  int manRow, int manColumn) {
        int width = (int) buttonWidth;
        int hight = (int) buttonHight;
        Rect leftRect = new Rect(width,getWidth()+hight,2*width,getWidth()+2*hight);
        return leftRect.contains(touch_x, touch_y);
    }

    private boolean touch_right_to_man(int touch_x, int touch_y, int manRow, int manColumn) {
        int width = (int) buttonWidth;
        int hight = (int) buttonHight;
        Rect rightRect = new Rect(3*width,getWidth()+hight,4*width,getWidth()+2*hight);
        return rightRect.contains(touch_x, touch_y);
    }
    private boolean touch_back_to_man(int touch_x, int touch_y, int manRow, int manColumn) {
        int width = (int) buttonWidth;
        int hight = (int) buttonHight;
        Rect rightRect = new Rect(4*width,0,5*width,hight);
        return rightRect.contains(touch_x, touch_y);
    }

以上代码首先用查找的方法确定每个键位的位置,也就是所谓的坐标,然后和想要实现的对象相比较,如果相等,就返回“真”,然后继续进行下一步操作。

本次实验检验了小组各个成员对于小组项目代码是否熟悉,能否自主运行并解释代码的含义。

转载于:https://www.cnblogs.com/Cai77/p/8053776.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值