JavaScript writes, writes JavaScript programming jobs, writes in JavaScript, Maze, JavaScript.

Source: Internet
Author: User
Tags naming convention

1 instructions
In this assignment, you'll be required to write JavaScript functions that simplify navigating an
Elaborate maze.
1.1 Data File Specification
An example of properly formatted file was shown in Figure 1. The first file encodes a maze, the
Second file encodes the directions Inwhich to be moved.
1
Part01test01.maze.emf
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, X, X
X,-,-, X,-,-, X,-, X,-,-,-,-,-, X,-,-,-, X,-,-,-,-,-,-,-,-,-,-,-,-,-,--, X
X,-,-,-,-, X,-,-,-,-,-, X, X,-,-,-, X,-,-,-,-,-,-,-,-,-,-,-, X
x,-, x, X,-,-, X,-,-, X,-,-,-, x, x, x, x, X, X,-, X,-, X,-,-, X, X,-, X
x,-, x, X, X,-,-,-,-,-,-, X,-, x, x, x, x, X, X,-, X,-,-,-,-,-, X,-, X
X,-,-,-,-,-,-, X,-,-, X,-,-,-,-,-,-,-,-,-, X,-, X
x, X,-, x, X,-,-,-,-, X,-, x, X,-, x, X,-,-, X,-,-,-, x, x, X, X,-, X
X,-,-,-,-,-, X,-,-, X,-,-,-,-,-, X,-,-,-,-,-,-,-,-,-,-,-,-,-, X
x,-, X,-, X,-,-,-,-, X,-, x, X, X,-,-,-,-,-,-, x, X, X,-, X
X,-,-,-,-,-, X,-,-,-,-,-,-,-,-,-,-,-,-,-,-, X,-,-, X,-,-,-,-,-,-,-,-, X
X,-,-, X,-,-,-,-, X,-, X,-,-, X,-,-,-,-,-, X,-,-,-, X,-,-,-,-, X
X,-,-, X,-, X,-,-,-,-,-,-,-,-,-,-,-, X,-,-, X, X,-,-
X,-,-,-,-,-,-, X,-,-,-,-, X,-,-, X,-,-,-,-,-, x, X, X,-, X
x, x, X,-, X,-,-, X,-, X,-,-,-, X,-, x, X,-,-, X, X,-, X,-,-,-,-,-, X
X,-,-,-,-,-,-,-,-,-,-, X,-,-,-,-, X,-,-,-, X,-,-,-, X,--,-, X, X
X,-,-,-,-, 1,-,-, X,-,-,-, X, X,-, X,-,-, X,-,-, X, X,-, X,--,-, X
x, X,-,-, X,-, X,-,-,-, X,-,-,-,-,-,-,-, X, X,-, X
X,-,-,-,-,-,-, X,-, x, X,-,-, X, X,-, X,-, X,-,-, X,-,-, X,-, x, X, X
x, X,-, X,-,-,-, X,-,-,-,-,-,-,-,-,-,-,-,-, X,-,-,-,-,-,-,-,-,-, x, X, X
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, X, X
Part01test01.moves.emf
L, R, L, D, R, R, L, u
Figure 1: A properly formatted encoding
2 One Player, one Move
The first part (Oneplayeronemove in the file csce322homework02part01.js) would take in one (1)
Argument (a maze) and return a function that takes in one (1) argument (a move), and returns the
Maze that's the result of moving Player 1 in the given direction.
The rules for moving is
? If a player is immediately blocked by a wall (x) or another player, they does not move
? A player continues to move in a given direction as long as "forward" and "backward" is
Their only options to move in
"Forward" is at the direction of travel and "backward" are opposite the direction of travel
? If a player encounters an obstacle (a wall or another player) while moving, they would attempt
To-change their-direction (with the priority given to up, down, left, and right on that order), but
Would not reverse their direction.
? A player would stop moving once they reach the goal (g), a dead-end where their only option
is to reverse their direction, or when they reach a location where they has more options for
Travel than just "forward" and "backward".
Page 2
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, X, X
X,-,-, X,-,-, X,-, X,-,-,-,-,-, X,-,-,-, X,-,-,-,-,-,-,-,-,-,-,-,-,-,--, X
X,-,-,-,-, X,-,-,-,-,-, X, X,-,-,-, X,-,-,-,-,-,-,-,-,-,-,-, X
x,-, x, X,-,-, X,-,-, X,-,-,-, x, x, x, x, X, X,-, X,-, X,-,-, X, X,-, X
x,-, x, X, X,-,-,-,-,-,-, X,-, x, x, x, x, X, X,-, X,-,-,-,-,-, X,-, X
X,-,-,-,-,-,-, X,-,-, X,-,-,-,-,-,-,-,-,-, X,-, X
x, X,-, x, X,-,-,-,-, X,-, x, X,-, x, X,-,-, X,-,-,-, x, x, X, X,-, X
X,-,-,-,-,-, X,-,-, X,-,-,-,-,-, X,-,-,-,-,-,-,-,-,-,-,-,-,-, X
x,-, X,-, X,-,-,-,-, X,-, x, X, X,-,-,-,-,-,-, x, X, X,-, X
X,-,-,-,-,-, X,-,-,-,-,-,-,-,-,-,-,-,-,-,-, X,-,-, X,-,-,-,-,-,-,-,-, X
X,-,-, X,-,-,-,-, X,-, X,-,-, X,-,-,-,-,-, X,-,-,-, X,-,-,-,-, X
X,-,-, X,-, X,-,-,-,-,-,-,-,-,-,-,-, X,-,-, X, X,-,-
X,-,-,-,-,-,-, X,-,-,-,-, X,-,-, X,-,-,-,-,-, x, X, X,-, X
x, x, X,-, X,-,-, X,-, X,-,-,-, X,-, x, X,-,-, X, X,-, X,-,-,-,-,-, X
X,-,-,-,-,-,-,-,-,-,-, X,-,-,-,-, X,-,-,-, X,-,-,-, X,--,-, X, X
X,-,-,-,-, 1,-,-, X,-,-,-, X, X,-, X,-,-, X,-,-, X, X,-, X,--,-, X
x, X,-,-, X,-, X,-,-,-, X,-,-,-,-,-,-,-, X, X,-, X
X,-,-,-,-,-,-, X,-, x, X,-,-, X, X,-, X,-, X,-,-, X,-,-, X,-, x, X, X
x, X,-, X,-,-,-, X,-,-,-,-,-,-,-,-,-,-,-,-, X,-,-,-,-,-,-,-,-,-, x, X, X
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, X, X
L, R, L, D, R, R, L, u
Figure 2:before Oneplayeronemove
Page 3
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
X-X--x-x----X---X-------x-x
X---X-----XX---X-------XX--X
X-XX-X-X---Xxxxxx-x-X--Xx-x
X-xxx------x-xxxxxx-x-----x-x
X-----X-X---------x-xxx---X
XX-XX----x-xx-xx-X---XXXX-XX
X------X-------X--------gxx--X
X-x-X----x-xxx------Xxx-xxx-x
X-----X---------x-x-X-----x-x
X-X----x-x-X-----X---XX---×
X--x-x-----------X--XX------XX
X------X----X--X------xxx-x--X
Xxx-x--x-x---x-xx--xx-x------X
X-----------X----X---X---X--XX
X---1--X---Xx-x-X--Xx-x---×
XX--x-x--X--------xx-xx-----X
X------x-xx--xx-x-X--X--x-xxx
Xx-x---X-------------X-----XXX
Xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Figure 3:after Oneplayeronemove
3 One Player, many Moves
The second part (oneplayermanymoves in the file csce322homework02part02.js) would take in one
(1) argument (a maze) and return a function that takes in one (1) argument (an array of moves),
and returns the maze that's the result of the Player 1 making all of the moves. If The maze is solved
Before the list of moves is completely processed and the resulting maze is returned.
Page 4
x, x, x, x, x, x, x, x, x, X, X
x,-, X,-,-,-,-,-, X,-, X
X,-,-,-,-, X,-,-, X,-, X
X,-,-,-,-,-,-,-,-,-, X
x, x, X,-,-, X,-, x, X,-, X
X,-,-,-,-,-, X,-,-,-, X
x, X,-,-,-,-,-, X,-,-, X
x,-, X,-, X,-,-, G,-,-, X
x,-, X,-,-,-, X, X,-, X, X
X,-,-,-, X,-,-, X,-,-, X
x,-, X,-, x, X,-, x, X,-, X
x,-, x, X,-,-,-,-,-,-, X
X,-,-,-,-,-, X,-, X,-, X
x,-, X,-, X,-,-,-,-, X, X
X,-,-,-, X,-,-, X,-, X, X
X,-,-, x, X, X,-, X,-,-, X
X,-,-,-,-,-,-,-, 1,-, X
X,-,-, X,-,-,-, X,-,-, X
X,-,-,-,-, X,-,-,-, X, X
x,-, x, X,-,-, X,-,-,-, X
X,-,-,-,-,-, X,-,-,-, X
x, x, x, x, x, x, x, x, x, X, X
R, D, D, L, U, L, R, L, R, R, R, U, r
Figure 4:before Oneplayermanymoves
Page 5
Xxxxxxxxxxx
X-x-----x-x
X----×--x-x
X---------X
XXX--x-xx-x
X----X---×
XX----X--×
X-x-X-G--×
X-x---XX-XX
X---X---
X-x-Xx-xx-x
X-XX------X
X-----x-x-X
X-x-X----XX
×---X--x-xx
X--Xxx-x--X
X------ -1-x
×-X---X--×
X---×---XX
X-XX--X---X
X----X---×
Xxxxxxxxxxx
Figure 5:after Oneplayermanymoves
4 Many Players, one Move
The third part (Manyplayersonemove in the file csce322homework02part03.js) would take in one
(1) argument (a maze) and return a function that takes in one (1) argument (a move), and returns
The maze that's the result of the Player 1 making that move. This differs the
There'll is more than than one (1) player in the maze.
Page 6
x, x, x, x, x, x, x, x, x, x, x, x, X, X
x, x, X, X,-,-,-,-,-,-, X,-,-, X
x,-, X,-,-,-, X, 1, X,-, X,-,-, X
X,-,-,-, X,-,-,-,-,-,-, X,-, X
X,-,-,-,-, X,-,-, X,-,-,-,-, X
x,-, x, X, X,-,-,-,-,-,-,-,-, X
x, X,-, X,-,-,-, X, X,-, X,-,-, X
x, X,-,-, X, X,-, x, X,-,-,-, X, X
X,-,-,-,-,-,-, x, x, X, X,-, 3, X
x,-, x, X,-, x, x, x, x, x, X, X,-, X
x, X,-, X,-,-, x, X, X,-,-,-,-, X
X,-,-,-, X,-, x, X, X,-, X,-,-, X
x,-, X,-,-,-,-, X, X,-, x, X,-, X
X,-,-,-, X, X,-, x, X,-,-,-,-, X
X,-,-, X, X,-,-, X, X,-, X,-,-, X
x, X,-,-,-,-,-,-, X, 2,-,-,-, X
x, x, X, X,-,-, X,-, x, x, X, X,-, X
X,-,-,-,-,-,-,-, x, x, X, X,-, X
X,-,-, X,-, X,-, x, x, x, X, X,-, X
x, X,-,-,-,-,-,-,-,-, X,-,-, X
X,-,-, X,-, X,-,-, X,-,-,-, X, X
x, X,-,-,-,-,-, X,-,-, X,-,-, X
x, x, X,-,-,-, X, X,-,-,-,-,-, X
X,-,-, X,-,-,-,-, X,-, x, X,-, X
x,-, x, X,-,-,-,-,-,-,-, X,-, X
X,-,-,-,-, X,-, X,-, X,-,-,-, X
X,-,-,-,-,-,-, X,-,-,-,-, X, X
X,-,-, X,-,-,-,-,-, G,-,-, X, X
x, x, x, x, x, x, x, x, x, x, x, x, X, X
D, D, R, D, D, R, L, R, U, D, D, D, R, L, R
Figure 6:before Manyplayersonemove
Page 7
Xxxxxxxxxxxxxx
XXXX------X--×
X-x---x-x X--×
×---X--1---x-x
X---X-X----×
X-xxx--------X
Xx-x---xx-x--X
XX--xx-xx---XX
X------xxxx-3 X
X-xx-xxxxxxx-x
Xx-x--xxx----X
X---x-xxx-x--X
X-x----Xx-xx-x
X---xx-xx----X
X--XX--xx-x--X
XX------X2---X
XXXX--x-xxxx-x
X--------Xxxx-x
X--x-x-Xxxxx-x
XX---------X--×
X--x-x-X---XX
XX----X-X--×
xxx---XX-----X
X--X----x-xx-x
X-XX-------x-x
X----x-x-X---×
X------X----XX
X--X-----G--XX
Xxxxxxxxxxxxxx
Figure 7:after Manyplayersonemove
5 Many Players, many Moves
The fourth part (manyplayersmanymoves in the file csce322homework02part04.js) would take in
One (1) argument (a maze) and return a function that takes in one (1) argument (a list of moves),
and returns the maze that's the result of each player making the next move in the list in turn
(Starting with Player 1). If The maze has already been solved, the maze are returned in this state.
Page 8
x, x, x, x, x, x, x, x, x, x, X, X
X,-,-,-,-,-,-,-,-, 2,-, X
x,-, x, X, X,-, X,-,-, X,-, X
x,-, X,-,-,-,-,-, X, X,-, X
X,-,-,-, X,-,-,-, X,-,-, X
x,-, X,-,-,-, X,-,-,-,-, X
x, X,-, x, X,-,-,-, X, X,-, X
X,-,-,-,-,-, x, X, G,-,-, X
x,-, x, x, x, x, X, X,-, X,-, X
X,-,-, X, X,-,-,-,-,-,-, X
x, X,-,-,-,-, X,-,-,-, 1, X
x, x, x, x, x, x, x, x, x, x, X, X
U, D, D, L, R, L, D, R, D, L, l
Figure 8:before Manyplayersmanymoves
Xxxxxxxxxxxx
X------2---X
X-xxx-x--x-x
X-x-----Xx-x
X--X---X.
X-x---X-----×
XX-XX---Xx-x
X-----XXG--X
X-xxxxxx-x-X
X--XX------X
XX----x-1--X
Xxxxxxxxxxxx
Figure 9:after Manyplayersmanymoves
6 Naming conventions
Your files should follow the naming convention of
Csce322homework02part01.js, Csce322homework02part02.js, Csce322homework02part03.js,
and Csce322homework02part04.js.
6.1 Helpers.js
A file named Helpers.js have been provided with the functionality to read the. emf files into
Matrices. If a modified Helpers.js file is not included with your submission, the default would be
Used in it place.
Page 9
7 Webgrader Note
Submissions'll is tested with node. JS, note the browser. Cse.unl.edu is currently running
Version 4.8.4 of node.
8 Point Allocation
Component Points
Csce322homework02part01.js
Test Cases 1x20
Total 20
Csce322homework02part02.js
Test Cases 1x20
Total 20
Csce322homework02part03.js
Test Cases 1x30
Total 30
Csce322homework02part04.js
Test Cases 1x30
Total 30
Total 100
9 External Resources
JavaScript Tutorial
Http://www.daixie0.com/contents/14/1250.html

The core staff of the team mainly include Silicon Valley engineers, bat front-line engineers, domestic TOP5 master, PhD students, proficient in German English! Our main business scope is to do programming big homework, curriculum design and so on.

Our Direction field: Window Programming numerical algorithm AI Artificial Intelligence financial statistical Metrology analysis Big Data network programming Web programming Communication Programming game Programming Multimedia Linux plug-in programming API image processing embedded/Microcontroller database programming console process and thread Network security assembly language Hardware programming software Design Engineering Standard Rules. The generation of programming languages or tools including, but not limited to, the following ranges:

C/c++/c# Write

Java Write generation

It generation

Python writes

Tutoring Programming Jobs

The MATLAB Generation writes

Haskell writes

Processing Write

Linux Environment Setup

Rust Generation Write

Data Structure assginment Data structure generation

MIPS Generation Writing

Machine Learning Job Writing

Oracle/sql/postgresql/pig database Generation/Generation/Coaching

Web development, Web development, Web site jobs

Asp. NET Web site development

Finance insurace Statistics Statistics, regression, iteration

Prolog write

Computer Computational Method Generation

Because of professional, so trustworthy. If necessary, please add qq:99515681 or e-mail:[email protected]

: Codinghelp

JavaScript writes, writes JavaScript programming jobs, writes in JavaScript, Maze, JavaScript languages

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.