Find Jobs
Hire Freelancers

Card Guess - Haskell - open to bidding -- 2

$30-250 USD

Berlangsung
Dibuat lebih dari 9 tahun yang lalu

$30-250 USD

Dibayar ketika dikirim
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.
ID Proyek: 6405198

Tentang proyek

1 proposal
Proyek remot
Aktif 10 tahun yang lalu

Ingin menghasilkan uang?

Keuntungan menawar di Freelancer

Tentukan anggaran dan garis waktu Anda
Dapatkan bayaran atas pekerjaan Anda
Uraikan proposal Anda
Gratis mendaftar dan menawar pekerjaan
Diberikan kepada:
Avatar Pengguna
Hello There, Thank you for giving me a chance to bid on your project. i am a serious bidder here and i have already worked on a similar project before and can deliver as u have mentioned Read with all your requirement ,we could definitely assure you with your requirements . Once you agree with us for further interactions we could start immediately showing outputs .We could assure You Neither your time gets wasted nor does the quality we provide you [login to view URL] could help you in getting the work done within the time frame specified.. We guarantee a high standard for the products created and a good quality output . We could also provide you with admin functionality too. Sky-pe: technosolve. Looking forward to hear from you . with best Regards
$175 USD dalam 4 hari
0,0 (0 ulasan)
0,0
0,0

Tentang klien

Bendera AUSTRALIA
Melbourne, Australia
4,9
3
Memverifikasi Metode pembayaran
Anggota sejak Sep 3, 2014

Verifikasi Klien

Terima kasih! Kami telah mengirim Anda email untuk mengklaim kredit gratis Anda.
Anda sesuatu yang salah saat mengirimkan Anda email. Silakan coba lagi.
Pengguna Terdaftar Total Pekerjaan Terpasang
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Memuat pratinjau
Izin diberikan untuk Geolokasi.
Sesi login Anda telah kedaluwarsa dan Anda sudah keluar. Silakan login kembali.