Code Monkey home page Code Monkey logo

2048's Introduction

#2048

##2018.07.07

1.新增重新开始按钮

##2018.06.07

  1. 修改游戏结束判断bug

##2018.06.03

  1. 增加关闭程序时进行数据保存
  2. 增加打开程序时进行数据读取
  3. 增加游戏结束的判断
  4. 修改了若干bug

##2018.6.1

  1. 完成界面模块
  2. 完成主要游戏主逻辑模块,还有bug
  3. 完成分数模块

##游戏主逻辑说明

  1. 初始生成两个值,要么2,要么4
  2. 移动(上下左右四个方向)
    1. 在行/列上找到当前行第一个为空的值,记录下该位置
    2. 再往后找到第一个不为空的值
    3. 将这两个位置交换。
  3. 合并
    1. 2.移动 中,边界值为空 当交换后的位置与交换后的位置的前一个位置(简称前一个位置)的值相等,前一个位置值*2,删除要移动的值。
    2. 2.移动 中,边界值不为空 判断边界值是否与后面第一个不为空的值相等
    3. 相等,边界值*2,删除第一个不为空的值
    4. 不相等,不做任何操作
  4. 游戏结束
    1. 如果出现2048,赢,游戏结束
    2. 当方格填满,没有合并项,失败,游戏结束

注:要记录下该位置在同一回合中是否合并过,避免同一回合多次合并

2048's People

Contributors

baifengjiu avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.