91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

java課程設(shè)計(jì)大作業(yè)寫(xiě)的 推箱子小游戲(含說(shuō)明文檔) java課程設(shè)計(jì)大作業(yè)寫(xiě)的 推箱子小游戲(含說(shuō)明文檔)

資源截圖

代碼片段和文件信息

package?controller;

import?entity.immobile.Immobile;
import?entity.mobile.Box;
import?entity.mobile.Mobile;
import?exception.CannotUndoException;

/**
?*?Created?by?caojiajun?on?2018/3/24.
?*/
public?class?History?{
????private?Node?current;
????private?static?History?history;

????private?History()?{
????????this.current?=?new?Node(null?null);
????}

????public?static?History?getHistory()?{
????????if?(history?==?null)?{
????????????history?=?new?History();
????????}
????????return?history;
????}

????public?static?void?restart()?{
????????history?=?null;
????}

????public?void?addRecord(Immobile?from?Immobile?to?Mobile?mobileInstance)?{
????????HistoryRecord?newRecord?=?new?HistoryRecord(from?to?mobileInstance);
????????Node?newNode?=?new?Node(current?newRecord);
????????current?=?newNode;
????}

????private?void?undoHelper()?{
????????HistoryRecord?record?=?current.record;
????????int?rowFrom?=?record.from.getPositionRow();
????????int?colFrom?=?record.from.getPositionCol();
????????int?rowTo?=?record.to.getPositionRow();
????????int?colTo?=?record.to.getPositionCol();
????????record.mobileInstance.move(rowTo?colTo?rowFrom?colFrom);
????????current?=?current.pre;
????}

????public?void?undo()?throws?CannotUndoException?{
????????if?(current?==?null?||?current.record?==?null)?{
????????????throw?new?CannotUndoException(“已經(jīng)到了初始狀態(tài),不能進(jìn)行回退!“);
????????}

????????if?(current.pre?!=?null?&&?current.pre.record?!=?null?&&?current.pre.record.mobileInstance?instanceof?Box)?{
????????????undoHelper();
????????????undoHelper();
????????}?else?{
????????????undoHelper();
????????}
????}

????private?class?HistoryRecord?{
????????final?Immobile?from;
????????final?Immobile?to;
????????final?Mobile?mobileInstance;

????????protected?HistoryRecord(Immobile?from?Immobile?to?Mobile?mobileInstance)?{
????????????this.from?=?from;
????????????this.to?=?to;
????????????this.mobileInstance?=?mobileInstance;
????????}
????}

????private?class?Node?{
????????Node?pre;
????????final?HistoryRecord?record;

????????protected?Node(Node?pre?HistoryRecord?record)?{
????????????this.pre?=?pre;
????????????this.record?=?record;
????????}
????}
}

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????目錄???????????0??2018-03-31?05:54??Sokoban-master\
?????文件?????????130??2018-03-31?05:54??Sokoban-master\README.md
?????目錄???????????0??2018-03-31?05:54??Sokoban-master\Sokoban\
?????目錄???????????0??2018-03-31?05:54??Sokoban-master\Sokoban\.idea\
?????文件?????????273??2018-03-31?05:54??Sokoban-master\Sokoban\.idea\misc.xml
?????文件?????????254??2018-03-31?05:54??Sokoban-master\Sokoban\.idea\modules.xml
?????文件????????8792??2018-03-31?05:54??Sokoban-master\Sokoban\.idea\uiDesigner.xml
?????文件???????33859??2018-03-31?05:54??Sokoban-master\Sokoban\.idea\workspace.xml
?????文件?????????423??2018-03-31?05:54??Sokoban-master\Sokoban\Sokoban.iml
?????目錄???????????0??2018-03-31?05:54??Sokoban-master\Sokoban\maps\
?????文件??????????76??2018-03-31?05:54??Sokoban-master\Sokoban\maps\1.map
?????文件??????????59??2018-03-31?05:54??Sokoban-master\Sokoban\maps\2.map
?????文件?????????113??2018-03-31?05:54??Sokoban-master\Sokoban\maps\3.map
?????文件??????????67??2018-03-31?05:54??Sokoban-master\Sokoban\maps\4.map
?????文件??????????92??2018-03-31?05:54??Sokoban-master\Sokoban\maps\5.map
?????文件??????????93??2018-03-31?05:54??Sokoban-master\Sokoban\maps\6.map
?????文件?????????125??2018-03-31?05:54??Sokoban-master\Sokoban\maps\7.map
?????文件?????????126??2018-03-31?05:54??Sokoban-master\Sokoban\maps\8.map
?????文件??????????70??2018-03-31?05:54??Sokoban-master\Sokoban\maps\9.map
?????目錄???????????0??2018-03-31?05:54??Sokoban-master\Sokoban\src\
?????目錄???????????0??2018-03-31?05:54??Sokoban-master\Sokoban\src\controller\
?????文件????????2199??2018-03-31?05:54??Sokoban-master\Sokoban\src\controller\History.java
?????文件????????4389??2018-03-31?05:54??Sokoban-master\Sokoban\src\controller\Main.java
?????目錄???????????0??2018-03-31?05:54??Sokoban-master\Sokoban\src\entity\
?????文件????????4254??2018-03-31?05:54??Sokoban-master\Sokoban\src\entity\Map.java
?????目錄???????????0??2018-03-31?05:54??Sokoban-master\Sokoban\src\entity\immobile\
?????文件????????1272??2018-03-31?05:54??Sokoban-master\Sokoban\src\entity\immobile\Immobile.java
?????目錄???????????0??2018-03-31?05:54??Sokoban-master\Sokoban\src\entity\mobile\
?????文件????????1264??2018-03-31?05:54??Sokoban-master\Sokoban\src\entity\mobile\Box.java
?????文件????????2394??2018-03-31?05:54??Sokoban-master\Sokoban\src\entity\mobile\Mobile.java
?????文件????????1108??2018-03-31?05:54??Sokoban-master\Sokoban\src\entity\mobile\Player.java
............此處省略3個(gè)文件信息

評(píng)論

共有 條評(píng)論

相關(guān)資源