Javascript代写 | Assignment 02  CSCE 322

本次Javascript代写是按照要求完成一个Peg Solitaire的游戏

Assignment 02
CSCE 322
THIS ASSIGNMENT IS ONLY WORTH 10% OF YOUR FINAL GRADE.
1 Instructions
In this assignment, you will be required to write JavaScript functions that simplify playing of the
variation of Peg Solitaire.
1.1 Data File Specification
An example of properly formatted file is shown in Figure 1. The first file encodes a game and the
second file encodes the moves to be made.
part01test01.game.eps
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
part01test01.moves.eps
d ,d ,r ,r ,d ,d ,r ,d ,u ,r ,u ,u ,r ,l ,u ,l
Figure 1: A properly formatted encoding
2 One Player, One Move
The first part (onePlayerOneMove in the file csce322a02part01.js) will take in one (1) argument
(a game) and return a function that takes in one (1) argument (a move), and returns the game
that is the result of Player 1 moving an x into the player’s space in a given direction. An example
is provided below
part01test01.game.eps
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
part01test01.moves.eps
d ,d ,r ,r ,d ,d ,r ,d ,u ,r ,u ,u ,r ,l ,u ,l
1
part01test01.solution
game
[ ’x ’, ’x ’ , ’x ’, ’x ’, ’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 ’ ]
3 One Player, Many Moves
The second part (onePlayerManyMoves in the file csce322a02part02.js) will take in one (1)
argument (a game) and return a function that takes in one (1) argument (an arry of moves), and
returns the game that is the result of Player 1 playing each move in succession (following the rules
of onePlayerOneMove) until all of the moves in the array have been played, or Player 1 has no valid
moves remaining (no x can jump over another x to land in the space occupied by 1).
part02test01.game.eps
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
part02test01.moves.eps
d ,d ,u ,u ,u ,u ,u ,r ,u ,d ,u ,l ,l ,u
part02test01.solution
game
[ ’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 ’ ]
4 Many Players , One Move
The third part (manyPlayersOneMove in the file csce322a02part03.js) will take in one (1) argument
(a game) and return a function that takes in one (1) argument (an arry of moves), and
returns the game that is the result of each player in the game making exactly one move until each
player has completed a move or no player can complete a valid move. Player 1 moves into 1, Player
2 moves into 2, etc. (you may assume the highest number in the provided game is the number of
players in the game). The moves are made in the order they appear in the moves array.
part03test01.game.eps
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 ,2 , x
x ,x ,x ,x ,x ,x ,x , x
part03test01.moves.eps
l ,u ,l ,u ,r ,r ,d ,d ,u ,d ,l ,r ,r ,l
Page 2
part03test01.solution
game
[ ’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 ’, ’2’, ’x ’ ]
[ ’x ’, ’x ’ , ’x ’, ’x ’, ’x ’, ’x ’, ’x ’, ’x ’ ]


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:itcsdx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank

发表评论