Haskell代写 | Assignment 03

本次Haskell代写要求学生使用Haskell完成模拟UNO游戏的编程代码,主要分为5个part,要求全部完成并通过所有的输入输出文件。

1. Instructions

In this assignment, you will be required to write Haskell functions that simplify playing of the variation of UNO.

1.1     Data File Specification

An example of properly formatted file is shown in Figure 1.

2. One Player, One Move

The first part (onePlayerOneMove in the file csce322h0mework03part01.hs) will take in thre (3) arguments (a discard pile, a deck, and a hand) and return the state of the game (hand/deck/discard) that is the result of the player in possession of the hand playing a card. The precedence for playing a card is as follows:

  1. Extend a Wild Draw 4 if that is the most recently played (left-most) card (behind a r,-, g,-, b,-, or y,-)
  2. Extend a Draw 2 if that is the most recently played card (not behind a r,-, g,-, b,-, or y,-)
  3. Play the left-most card that matches the color of the most recently played card in the discard pile
  4. Play the left-most Wild Draw 4
  5. Play the left-most card that matches the symbol of the most recently played card in the discard pile
  6. Play the left-most Wild
  7. Draw (add to the back of the hand) the left-most card in the deck

If playing a Wild (or Wild Draw 4),  the next player needs to know which color to play next.  If the hand still contains non-Wild cards, play the card c,- (where c is the color of the left-most non-Wild card remaining in the hand). If the hand only contains Wild cards play r,-. If the hand has been emptied (and, therefore, the game won), play -,-.

In the event that you need to extend a Wild Draw 4 or Draw 2 and cannot, you must draw all of the cards (possibly) built-up from other players extending Wild Draw 4s or Draw 2s. If a Draw 4 was played, it would be directly behind a r,-, g,-, b,-, or y,-. Once you draw the number of cards required (or the size of the deck, whichever is smaller), place a copy of the a r,-, g,-, b,-, or y,- from the front of the discard pile on the front of the discard pile. This will let future players know that they must continue with a card of that color.

3. One Player, Many Moves

The second part (onePlayerManyMoves in the file csce322h0mework03part02.hs) will take in three

(3) arguments (a discard pile, a deck, and a hand), and returns the hand/deck/discard that is the result of the player in possession of the hand playing as many cards in a row as they can before emptying their hand or being unable to continue playing cards. The same rules for precedence of moves as onePlayerOneMove applies.

4. Many Players , One Move

The third part (manyPlayersOneMove in the file csce322h0mework03part03.hs) will take in three

(3) arguments (a discard pile, a deck, and a list of hands) and return the game (hands/deck/discard) that is the result of n turns being taken for a game with n players. The same rules for precedence apply, but skip and reverse cards will have these effects: if Player p plays a reverse on turn t, Player p 1 will take turn t + 1 (or Player n will take turn t + 1 if Player 1 played the reverse)

assuming the turns are proceeding in ascending order. If turns are proceeding in descending order Player p + 1 will take turn t + 1 (or Player 1 will take turn t + 1 if Player n played the reverse). If Player p plays a skip on turn t, Player p + 2 will take turn t + 1 (or Player 1 will take turn t + 1 if Player n 1 played the skip, or Player 2 will take turn t + 1 if Player n played the skip) if turns are proceeding in ascending order. If turns are proceeding in descending order, Player p 2 will take turn t + 1 (or Player n 1 will take turn t + 1 if Player 1 played the skip, or Player n will take turn t + 1 if Player 2 played the skip).

5. Many Players , Many Moves

The fourth part (manyPlayersManyMoves in the file csce322h0mework03part04.hs) will take in three (3) arguments (a discard pile, a deck, and hands) and return the game (hands/deck/discard) that is the result of a game being played to its conclusion. Instead of n players combining to take n turns, turns will be taken following the rules of manyPlayersOneMove until a player empties their hand or the player whose turn it is cannot continue the game (either by playing a card or drawing a card from the deck).

6. Naming Conventions

Your files should follow the naming convention of

csce322h0mework03part01.hs, csce322h0mework03part02.hs, csce322h0mework03part03.hs, and csce322h0mework03part04.hs.

6.1    Helpers.hs

A file named Helpers.hs has been provided with the functionality to read the .uno files into matrices. If a modified Helpers.hs file is not included with your submission, the default will be used in its place.

 

7. webgrader Note

Submissions will be tested with ghc. cse.unl.edu is currently running version 8.0.2 of ghc.

 

8. Point Allocation

 

 9. External Resources

Learn Haskell Fast and Hard

Learn You a Haskell for Great Good! Red Bean Software

Functional Programming Fundamentals The Haskell Cheatsheet


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


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

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


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

发表评论