Find Jobs
Hire Freelancers

Card Guess - Haskell - open to bidding

$30-250 USD

Ukończony
Opublikowano ponad 9 lat temu

$30-250 USD

Płatne przy odbiorze
You will write Haskell code to implement the guesser part of the game. This will require you to write a function to return your initial guess, and another to use the feedback from the previous guess to determine the next guess. The latter function will be called repeatedly until it produces the correct guess. You will find it useful to keep information between guesses; since Haskell is a purely functional language, you cannot use a global or static variable to store this. Therefore, your initial guess function must return this game state information, and your next guess function must take the game state as input and return the updated game state as output. You may put any information you like in the game state, but you must define a type GameState to hold this information. I will supply a Card module providing the Card, Rank, and Suit types and their constructors. This implementation has a few enhancements from the types presented in lectures. First, all three types are in the Eq class. All are also in the Bounded and Enum class, which means, for example, that [minBound..maxBound]::[Card] is the list of all cards in order, from 2♣to A♠, and similarly [minBound..maxBound]::[Rank] is the list of ranks from 2 to Ace, and similarly for Suit. This also means that, for example, succ (Card Club R5) == (Card Club R6) and succ (Card Heart Ace) == (Card Spade R2). Read the documentation for Bounded and Enum classes for more things you can do with them. The Rank and Suit types are also in the Ord class, so for example Ace > King and Heart < Spade. For convenience, all three types are also in the Show class so that ranks and suits are shown as a single character (10 is shown as T), and cards as two characters: rank followed by suit. All three are also in the Read class, which means that, for example, (read "[2C,AH]")::[Card] returns the list [Card Club R2, Card Heart Ace] (which would be printed as [2C,AH]). You must define following two functions, as well as the GameState type: initialGuess :: Int → ([Card],GameState) takes the number of cards in the answer as input and returns a pair of an initial guess, which should be a list of the specified number of cards, and a game state. The number of cards specified will be 2 for most of the test, and 3 or 4 for the remaining tests, as explained below. nextGuess :: ([Card],GameState) → (Int,Int,Int,Int,Int) → ([Card],GameState) takes as input a pair of the previous guess and game state, and the feedback to this guess as a quintuple of counts of correct cards, low ranks, correct ranks, high ranks, and correct suits, and returns a pair of the next guess and new game state. You must call your (main) source file [login to view URL] or [login to view URL], and it must contain the module declaration: module Cardguess (initialGuess, nextGuess, GameState) where You may divide your code into as many files as you like, as long as your main file (and the files it imports) imports all the others. But do not feel you need to divide your program into many files if it is reasonably small. I will also provide a test driver program called [login to view URL] to allow you to conveniently test your Cardguess implementation. You can specify the cards of the answer on the command line, and the program will print out each guess and the corresponding feedback and report the number of guesses needed to find the answer. The [login to view URL] is substantially similar to the test driver I will use for testing your code. You can compile and link your code for testing using the command: ghc -O2 --make Cardguesstest I will use a similar command to compile your code in preparation for testing.
Identyfikator projektu: 6405728

Informację o projekcie

2 ofert
Zdalny projekt
Aktywny 10 lat temu

Szukasz sposobu na zarobienie pieniędzy?

Korzyści ze składania ofert na Freelancer.com

Ustal budżet i ramy czasowe
Otrzymuj wynagrodzenie za swoją pracę
Przedstaw swoją propozycję
Rejestracja i składanie ofert jest bezpłatne
Przyznano:
Awatar Użytkownika
Can do it within a day or two, so text me . : )
$155 USD w 1 dzień
5,0 (5 opinii)
3,5
3,5
2 freelancerzy składają oferty o średniej wysokości $203 USD dla tej pracy
Awatar Użytkownika
Hi! I am professional C/C++/C#/Java programmer. I can do this project with highest quality! Best Regards, szymszteinsl
$250 USD w 3 dni
5,0 (5 opinii)
3,8
3,8

O kliencie

Flaga AUSTRALIA
melbourne, Australia
4,9
2
Zweryfikowana metoda płatności
Członek od wrz 3, 2014

Weryfikacja Klienta

Inne pracę od tego klienta

a java socket file programme
$30-250 USD
Dziękujemy! Przesłaliśmy Ci e-mailem link do odebrania darmowego bonusu.
Coś poszło nie tak podczas wysyłania wiadomości e-mail. Proszę spróbować ponownie.
Zarejestrowani Użytkownicy Całkowita Liczba Opublikowanych Projektów
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Wczytywanie podglądu
Udzielono pozwolenia na Geolokalizację.
Twoja sesja logowania wygasła i zostałeś wylogowany. Proszę, zalogować się ponownie.