联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2019-11-20 10:42

WISCCOMPSCI200 Fall 2019/chapter/11/section/8 1/3

Students:

This content is controlled by your instructor, and is not zyBooks content. Direct questions or concerns

about this content to your instructor. If you have any technical issues with the zyLab submission

system, use the Trouble with lab button at the bottom of the lab.

11.8 Code Refactor 2: Sokoban

Sokoban is a classic puzzle game from the early days of personal computers. You are a

warehouse worker and you have to move boxes to particular locations in a warehouse. The

boxes are heavy and you can only push them.

In the text version, the worker is denoted by @. They are shown in a warehouse with

impassable walls (denoted by #). The worker must cover each goal (denoted by .) with

boxes (denoted by $). The worker can only push the boxes… so you have to navigate the

warehouse carefully or you will get stuck! When a box is placed on a goal, the symbol in the

sample run is *. If the worker is standing on a goal, the symbol + is used. The exact

characters to use will be specied

in the Cong.java

le.

So, your program should always use

the constant variable and not the literal character.

The le

XSokoban.txt (that you can download below) contains a collection of 90 levels that

can be loaded and played by the Sokoban program. (This le

was sourced from Sokoban

The beautiful world of remodels)

As with the rst

code refactor, the code your are given is working, but needs to be cleaned-up

to meet the CS 200 Style Guide and good coding practices.

There are:

missing comment blocks (le,

class, method),

poorly chosen method names,

poorly chosen variable names,

poor chosen looping structures,

literals instead of constants,

overly generic imports,

duplicate code,

redundant comparisons (e.g. == true), and

overly long methods. You should correct all these decits

by choosing appropriate

names and loops, making methods for duplicate code, adding helper methods to

shorten overly long methods, remove redundant comparisons, etc; (especially the main

method). Apply the good coding practices we've learnt throughout the course.

Also, you are limited to using Java features covered through zyBooks chapter 11.

Remember: The provided code works. The goal is to refactor, improving the code while

keeping it working.

Submit regularly and often! With every code change, submit to zyBooks to make sure it still

works correctly!

2019/11/19 11.8. Code Refactor 2: Sokoban

https://learn.zybooks.com/zybook/WISCCOMPSCI200Fall2019/chapter/11/section/8 2/3

Grading Rubric

Commenting and Documentation

Files, classes, and methods all have header comments following course standards

All methods have a JavaDoc comment with a summary, an algorithm for non-trivial

methods, and comments for parameter lists and return values

Style and Structure

Appropriate use of spacing, both vertical and horizontal

Code and comments rarely exceed 100 columns

Consistent placement of parentheses and braces

No redundant comparisons

Importing without wild cards

Helpful identier

naming that follows course conventions (e.g., methods, variables,

constants)

Appropriate code structures are used (eg., if vs if-else, for vs while)

Duplicated code refactored into reused methods

Methods with multiple meaningful code segments should be refactored into calling

smaller single-purpose methods.

Doesn't use Java features past chapter 11. Note that this includes adding class

variables.

LAB

ACTIVITY

11.8.1: Code Refactor 2: Sokoban 0 / 4

Submission Instructions

Downloadable les

Sokoban.java , Lvl3-1Box.foo , Config.java ,

XSokoban.txt , and winLevel4.sav

Compile command

javac Sokoban.java -Xlint:all

-encoding utf-8

We will use this command to compile your code

Upload your les

below by dragging and dropping into the area or choosing a le

on your

hard drive.

Sokoban.java

Drag le

here

or

Download

Choose on hard drive.

2019/11/19 11.8. Code Refactor 2: Sokoban

https://learn.zybooks.com/zybook/WISCCOMPSCI200Fall2019/chapter/11/section/8 3/3

This lab can only be submitted once every 10 minutes

Latest submission

No submissions yet

Submit for grading

Trouble with lab?


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp