https://publicpagestutorbin.blob.core.windows.net/%24web/%24web/assets/Subtract_129b70eab9.png

Haskell Programming Homework Help | Haskell Programming Assignment Help

Access 24/7 Haskell Programming homework help from TutorBin to enhance your skills in functional programming and algorithmic thinking to score an A+ grade.

https://publicpagestutorbin.blob.core.windows.net/%24web/%24web/assets/Speedometer_1d5ce85ece.png

Trusted by 1.1 M+ Happy Students

Haskell Programming Homework Help - Expert Assistance For Scoring A+ Grade

Haskell programming is like a special language that allows you to communicate with computers effectively. It's a bit different from other programming languages, and it's great for handling numbers and calculations. Haskell presents a distinctive approach to programming, focusing on pure functions, immutability, and strong typing. While these aspects make it a robust language, many students find it challenging to grasp these concepts and apply effectively. If you're facing difficulties in your Haskell assignments, don't worry. At TutorBin, we provide comprehensive expert Haskell Programming homework help to excel you in this coding language.

Whether you're struggling with functional programming, types, type systems, or the complexities of monads, we aim to equip you with the knowledge and skills needed to excel in the subject. Our tutors are Haskell experts who excel in simplifying complex concepts, ensuring they are accessible and understandable. We're not just here to assist with assignments; we aim to facilitate a profound understanding of Haskell, setting you on the path to academic excellence. With our expert guidance, you can conquer Haskell's challenges and achieve the A+ grade you're aiming for.

Haskell Programming Homework Help - Best Online Help for Students

TutorBin is the go-to place for the best Haskell programming homework help. We understand that Haskell can be tough for students, and that's why we've made our platform user-friendly. We aim to provide a seamless and enjoyable learning experience while assisting you in achieving excellent grades. Our website is easy to navigate, ensuring you can quickly access the help you need without any ado. Our team of programmers are Haskell experts and are readily available to provide personalized support tailored to your specific requirements.

That's not all – we take pride in simplifying complex Haskell concepts, making them accessible and engaging for you. With TutorBin, you get step-by-step explanations, code examples, and real-time interaction with tutors to ensure you fully understand the subject. You can also access a wealth of study materials, including informative video solutions and a comprehensive library of solved Haskell Programming questions, enriching your Haskell learning journey.

Moreover, we offer 24/7 support, allowing you to access help whenever it's most convenient for you. Say goodbye to last-minute panic; you can rely on TutorBin for fast and efficient assistance. Whether you're struggling with functional programming, tricky type systems, or the mysteries of monads, our tutors have your back. They'll not only assist you with your homework but also ensure you grasp the core principles.

Haskell Programming Homework Help

Who Can Seek Online Help With Haskell Programming?

At TutorBin, Haskell programming homework help is readily available for a diverse range of learners looking for help with Haskell Programming homework tasks. We cater to various educational levels and purposes, ensuring that students receive the support they need to excel in this complex programming language.

1. For High School Students

High school students exploring their journey into Haskell programming encounter the complexities of functional programming and complex type systems. We recognize that these concepts can appear daunting at first glance. That's why we provide the best Haskell Programming homework help tailored to high school students. Our primary objective is to clarify Haskell's fundamental principles and provide high school students with the essential groundwork to excel in their coursework. Whether you're tackling assignments or engaging in projects, our Haskell Programming help serves as a robust foundation for this valuable subject.

2. For College Students

College students, whether at the undergraduate or graduate level, dive into the realm of Haskell Programming. Haskell's distinctive functional approach and rigorous type system can present challenges, but our comprehensive Haskell Programming help is meticulously crafted to guide you through this programming language with unwavering confidence. Whether you're delving into the complexities of monads, higher-order functions, or advanced Haskell topics, our expert tutors are here to enrich your academic journey, enhance your programming skills, and ensure your academic success both within your coursework and beyond.

Haskell Programming Tutors Online - Is It Worth To Hire Them?

When it comes to Haskell programming, hiring online tutors at TutorBin can be a wise decision in your education. On our platform, you will get access to experienced tutors who are well-versed in Haskell. Our tutors can provide personalized guidance tailored to your specific needs, making it easier to grasp the complexities of the language. They not only help you with your homework but also ensure you understand the fundamental principles behind Haskell, ensuring a strong foundation for your programming journey. Additionally, the convenience of our online homework help allows you to access assistance at your own pace and schedule, eliminating the last-minute panic associated with challenging assignments.

Our commitment to simplifying complex Haskell concepts, along with our user-friendly platform and 24/7 support, further enhances the value of our services. This ensures that you can access assistance whenever you need it, making your learning experience seamless and enjoyable. With step-by-step explanations, illustrative code examples, and real-time interaction with tutors, TutorBin is designed to provide comprehensive support. Whether you're tackling functional programming, navigating complex type systems, or unraveling the mysteries of monads, TutorBin tutors are there to guide you. So, if you're looking to excel in Haskell programming, consider hiring our online tutors to enhance your learning experience and academic performance.

Do My Haskell Programming Homework

Challenges Where Students Need Haskell Programming Assignment Help

Haskell Programming assignments present formidable challenges for students. Here are some common difficulties that students will face when working on Haskell Programming assignments:

1. Understanding Functional Programming Concepts

Haskell is a purely functional language, which means it approaches programming fundamentally differently than languages like C++ or Java. Students will struggle with concepts like immutability, higher-order functions, and lazy evaluation.

2. Syntax & Language Features

Haskell has a unique syntax and a range of powerful language features. Students can need help with pattern matching, type classes, monads, and list comprehensions.

3. Recursion

Haskell relies heavily on recursion for problem-solving. Students will face difficulty in grasping recursive thinking, significantly when solving complex problems.

4. Type System

Haskell has a solid and static type system. Understanding and utilizing types, type inference, and type classes can be challenging for students.

5. IO and Side Effects

Managing input and output in Haskell differs from traditional imperative languages. Students will need expert assistance in handling IO operations.

6. Library and Package Management

Haskell has a rich ecosystem of libraries and packages. Students will need help finding and using the right libraries for their assignments.

7. Debugging

Debugging Haskell programs can be tricky due to lazy evaluation and strong typing. Students will require help in debugging their code effectively.

Haskell Programming Topics & Concepts Covered

TOPICS CONCEPTS
Functional Programming Immutability, Recursion & Monadic Programming
Types and Type Systems Algebraic Data Types, Parametric Polymorphism
Lists, Tuples, and Data Structures Records & Field Accessors, Maps & Sets
Pattern Matching Guards, Wildcard Patterns & List Comprehensions
Functions and Recursion Tail Recursion, Closures & Currying
Input and Output File I/O & Handling Exceptions
Error Handling Error Propagation and Handling

Haskell Programming Assignment Help

What Do You Get When You Pay Someone to Do My Haskell Programming Homework?

When you decide to pay someone to do my Haskell programming homework at TutorBin, you're taking valuable assistance from our expert with your assignments. Here's what you can expect from us to receive when you hire a Haskell programming tutor:

1. Concept Clarity

Haskell programming involves complex concepts. Our programmers can simplify these concepts into easily understandable components, ensuring that you establish a strong foundation and gain confidence in applying your knowledge.

2. Guidance in Problem Solving

Haskell assignments require in-depth problem-solving skills. Our expert Haskell tutors can guide you through the process, helping you tackle complex problems, develop algorithms, and write efficient code to meet your assignment requirements.

3. Real-World Relevance

Haskell isn't just an academic exercise. Our experts can demonstrate how the concepts you're studying have real-world applications, such as in software development, data analysis, and functional programming. This helps you see the practical side of Haskell.

4. Debugging Support

Haskell programming can be challenging, especially when dealing with issues like debugging and handling errors. Our programming tutors can quickly identify and resolve coding problems, saving you time and frustration.

5. Documentation & Presentation

Effective communication is vital in programming. Our experts can assist you in creating well-structured documentation, code comments, and reports. They ensure your code is clear, precise, and properly formatted, helping you convey your ideas effectively, an essential skill in the world of programming.

TutorBin Haskell Programming Homework Help Benefits

At TutorBin, we take great pride in providing our students with a wide range of benefits when it comes to Haskell Programming homework help. Our team of Haskell programmers is dedicated to equipping you with the assistance and guidance required to succeed in your Haskell assignments. Here are some of the key advantages of opting for our Haskell Programming help services:

1. Expert Programmers

We have a team of experienced Haskell programmers who are passionate about helping students like you. Their extensive knowledge allows them to provide you with precise and optimized code explanations stepwise, along with valuable coding insights.

2. Comprehensive & Customized Solutions

Our solutions are both comprehensive and tailored to your specific needs. We don't just provide code; we also explain the logic and thinking behind it, ensuring you understand Haskell concepts thoroughly.

3. Timely Delivery

Our programmers and coders are committed to meeting your deadlines. With our quick assistance, you can submit your Haskell assignments on time, reducing the stress associated with last-minute submissions.

4. Plagiarism-Free Work

At TutorBin, our experts take academic integrity seriously. Our solutions are authentic and free from plagiarism, ensuring you receive authentic and ethical help.

5. 24/7 Availability

TutorBin is here whenever you need us. Whether you have a question in the middle of the night or need assistance during the day, our expert help is available round the clock.

6. Affordable Pricing

We understand the budget constraints of students. Our pricing is competitive and designed to be affordable for students, making it accessible to everyone.

7. Flexible Scheduling

Enjoy the flexibility of setting your schedule with TutorBin. You can get help from experts online wherever you have an internet connection. It's a convenient way to learn and get the support you need for your Haskell programming assignments.

8. Direct Interaction

Our platform offers direct interaction between you and our Haskell programming tutors. This means you can discuss your assignment details, ask questions, and seek clarifications directly, ensuring a clear understanding of the solutions provided.

9. Multi-Level Expertise

Our team consists of experts with diverse levels of experience so that we can cater to both beginners and advanced Haskell programmers.

10. Revision Support

If you have any doubts or need revisions, we're here to assist. We provide unlimited revisions to ensure your satisfaction.

11. Confidentiality

Your privacy is our priority. We ensure that all your information and interactions with us are kept confidential.

Haskell Programming Assignment Help - Guiding You to Success with Expert Tutors

Do you need expert help with Haskell Programming homework tasks? Our team of expert programmers and coders is here to help you succeed in Haskell coursework. We understand the challenges that Haskell can pose, and our programming tutors are poised to provide prompt, real-time guidance to ensure you get top grades in your assignments.

Our Haskell programmers are here to make your learning journey smoother. They provide immediate responses and quick support to assist you in real time. Count on them to clarify doubts, provide Haskell programming examples, and simplify complex programming concepts. With their extensive knowledge, you'll receive the precise guidance needed to excel in your Haskell assignments. So, don't hesitate to reach out for our expert homework help and achieve your academic goals with ease.

Haskell Programming Homework Help Online - Available Anytime, Anywhere!

Whether you're in the USA or UK, our Haskell Programming homework help is easily accessible. At TutorBin, we provide 24/7 support for Haskell Programming, ensuring that you can get the assistance you need at your convenience, regardless of your global location or time zone. Whether you're struggling with Haskell assignments, looking for code explanations, or need help with complex concepts, our expert coders are readily available to guide you through your Haskell Programming challenges. With TutorBin, conquering Haskell assignments and mastering the language is within your reach, no matter where you are in the world.

Haskell Programming Help FAQs Searched By Students


What is the Haskell Programming language?

Haskell is a unique and powerful programming language known for its focus on pure functions, immutability, and strong typing, making it effective for complex numerical computations and functional programming. It presents a distinct approach to coding, emphasizing clarity and correctness in software development.


Which is the best website for Haskell Programming homework help?

As per student ratings, TutorBin is regarded as the best website for Haskell Programming assignment help.


Can I pay someone to do my Haskell Programming homework help?

Absolutely! At TutorBin, you can pay for our qualified tutors to handle your Haskell Programming assignments, leading to a better understanding and improved proficiency in the subject. Seeking assistance from online Haskell Programming tutors can significantly enhance your academic growth.


Can I get instant Haskell Programming homework help in the USA?

Of course, we provide instant Haskell Programming assignment help in the USA through our 24/7 online platform. Our Haskell Programming tutors are available around the clock to assist you.


What should I do if I need help with Haskell Programming?

If you're looking for help with Haskell Programming, you've landed at the right place. Just submit your Haskell Programming assignment on TutorBin, and our Haskell Programmers will provide the guidance you need.


Are there online Haskell Programming homework helpers available?

Yes, at TutorBin, you'll find online Haskell Programming homework helpers who can assist you with your coding assignments and provide valuable support.

Recently Asked Haskell Programming Questions

Expert help when you need it
  • Q1:1. a)Write a program that allows a user to select a number between 1 and 5 and then prints a famous quote (quotes are of your choosing). After printing the quote, the program will ask whether the user would like another. If the user enters n, the program ends; otherwise, the user gets another quote. The program repeats until the user enters n. Try to use lazy evaluation and treat the user input as a list rather than recursively calling main at the end. b) The following Haskell functions each take predicate function and a list as input and remove certain items from the list based on the predicate function. They each have this signature: (a -> Bool) -> [a] -> [a] a. 1trim removes all items from the start of the list that satisfy the predicate function. b. rtrim removes all items from the end of the list that satisfy the predicate function. c. trim removes all items from both the start and end of the list that satisfy the predicate function. Implement these functions and demonstrate the result.See Answer
  • Q2:2. Using Haskell: a)Write a function rotabc that changes a's to b's, b's to c's and c's to a's in a string. Only lowercase letters are affected. b) Implement a Haskell function that deletes the first occurrence of an element from a list. c) Write a function in Haskell that times execution of a function. d) Write a function in Haskell that formats the time of daySee Answer
  • Q3:Implementation, Test File and Report In addition to your solutions to these programming challenges, you are asked to submit an additional Tests.hs file with your own tests, and a report: You are expected to test your code carefully before submitting it and we ask that you write a report on your development strategy. Your report should include an explanation of how you implemented and tested your solutions. Your report should be up to 1 page (400 words). Note that this report is not expected to explain how your code works, as this should be evident from your commented code itself. Instead you should cover the development and testing tools and techniques you used, and comment on their effectiveness. Your report should include a second page with a bibliography listing the source(s) for any fragments of code written by other people that you have adapted or included directly in your submission. Submission and Marking Your Haskell solutions should be submitted as a single plain text file Challenges.hs. Your tests should also be submitted as a plain text file Tests.hs that includes a main function. Finally, your report should be submitted as a PDF file, Report.pdf. The marking scheme is given in the appendix below. There are up to 5 marks for your solution to each of the programming challenges, up to 5 for your explanation of how you implemented and tested these, and up to 5 for your coding style. This gives a maximum of 40 marks for this assignment, which is worth 40% of the module. Your solutions to these challenges will be subject to automated testing so it is important that you adhere to the type definitions and type signatures given in the supplied dummy code file Challenges.hs. Do not change the list of functions and types exported by this file. Your code will be run using a command line such as stack ghc -e "main" CW2Tests.hs, where CW2Tests.hs imports Challenge.hs. You should check before you submit that your solution compiles and runs as expected. The supplied Parsing.hs file will be present so it is safe to import this and any library included in the standard Haskell distribution (Version 7.6.3). Third party libraries will not be present so do not import these. Your own test cases in the submitted file Tests.hs will also be run using a similar command line, so make sure this file defines a suitable main function that runs your tests and reports the results.See Answer
  • Q4:5.1 Submission For submission, you must submit three files (slip.hs, tests.slip, and rapport.tex) through the Moodle (also known as StudiUM) page of the course. Make sure the report compiles correctly on ens.iro (which you can connect to via SSH). 6 Details - The grade will be divided as follows: 25% for the report, 60% for the code (divided between s21, hinsert, and eval), and 15% for the tests. - Any use of material (code or text) borrowed from someone else (found on the web,...) must be properly cited, otherwise it will be considered as plagiarism. - The code must in no case exceed 80 columns. - Check the course web page for any errata, and other additional instructions. - The grade is based on two parts: automatic tests, reading of the code, and the report. The most important criterion is that your code should behave correctly. Next comes the quality of the code: the simpler, the better. If there are many comments, it is usually a sign that the code is not clear; but of course,See Answer
  • Q5:3. The Y combinator: The following famous term is called the Y combinator. Y=At. (Art (22)) (Az.t (22)) This term looks almost like the self-application of sa, but it is different in that it involves an additional function t in a subtle way. Consider an application Yt and let us see what we can learn about it using 3-reduction: Yt = (Az.t (z)) (Az.t (22)) ((Art (12)) (Art (22))) by 3-reduction noticing that the inner term is Yt t(Yt) So, Yt is equal to the function t applied to itself! One can use this to repeatedly unfold Yt. Yt=t(Yt)=t(t (Yt)) = t (t (t (Yt))) = --- This might seem like another form of an infinite loop, but it is actually quite useful. In fact, it is used to encode recursive functions in the lambda calculus. Consider the recursive definition of a function such as the factorial: define factorial = An. if (=n 1) 1 (*n (factorial (-1)) On the surface, this is a circular definition and cannot be expressed in lambda calculus. To resolve the difficulty, we first treat the right hand side of the definition as a function of "factorial": define define factorial = T factorial T=Af. An. if (n1)1 (*n (f(-1)) The definition of T is quite normal, but the first line is still a circular definition. However, this is exactly the kind of circularity that the Y combinator allows us to capture. The Y combinator satisfies the equality YT=T(YT). So, we can just say that factorial is YT and we get what we want without any circular definitions. Does this actually work? Here is a sample calculation: (YZ) 2 (YT) 1See Answer
  • Q6: TP #1 IFT-2035 1 Overview This lab aims to improve the understanding of functional programming by using a functional programming language (Haskell) and writing a part of an interpreter for a functional programming language (in this case a kind of Lisp). The steps of this work are the following: 1. Improve your knowledge of Haskell. 2. Read and understand this data. This will probably take a significant portion of the total time. 3. Read, find, and understand the important parts of the provided code. 4. Complete the provided code. 5. Write a report. It should describe your experience during the previous points: problems encountered, surprises, choices you had to make, options you consciously rejected, etc. The report should not exceed 5 pages. This work is to be done in groups of two. The report, in LATEX format only (compilable on ens.iro) and the code are to be submitted by electronic submission before the indicated date. No delay will be accepted. Clearly indicate your name at the beginning of each file. Those who want to do this work alone must first obtain permission, and the evaluation of their work will not take it into account. Groups of 3 or more are excluded. e ::= n |x | (Axe) | (e0 e1 ... en) | (ref! e) |(get ! e) | (set! e1 e2) |+| - | * |/ Signed Decimal Integer A variable A function with an argument A curried function call Construction of a ref-cell Find the value of the ref-cell e Change the value of the ref-cell e1 Predefined arithmetical operations |< | > | = | <= | >= Boolean operations on integers | (if e1 e2 e3) If e1 then e2 else e3 |(let x e1 e2) Simple local declaration | (letrec ((x1 e1) ... (xn en)) e) Recursive local declarations Fig 1. Slip syntax 2 Slip: A kind of Lisp In this project, you will work on the implementation of a functional language whose syntax is inspired by the Lisp language. The syntax of this language is described in Figure 1. It is important to note that, as always with Lisp-style syntax, parentheses are significant. The let form is used to give a name to a non-recursive local definition. The letrec form is a more complex variant that allows for multiple simultaneous local definitions, which can also be recursive, including mutually recursive, as in the Haskell let. 2.1 Dynamic semantics Slip, like Lisp, is a dynamically typed language, meaning that its variables can contain values of any type. There is therefore no static semantics (typing rules). The values manipulated at runtime by our language are integers, functions, booleans, and references that point to ref-cells, which are memory cells whose contents can be modified (the rest of the values manipulated by Slip are immutable). A ref-cell is constructed with ref!(), which takes the initial value of the cell as an argument, allocates the cell somewhere in memory, and returns a reference (its address). The current value of the cell can then be retrieved with get!() and the value changed with set!(). (λ p (set! p (+ 1 (get! p)))) is a function that increments a cell by adding 1. The fundamental evaluation rules are as follows: ((Axe) v) (let x v e) هارد e[v/x] e[v/x] (letrec ((1 v1)... (In Un)) e) W e[v1, Un/1,, In] (eg €1 en) (eo) for + ((eo €1)... en) Co Where the notation e[v/x] represents the expression e in an environment where the variable x takes the value v. The use of v in the rules above indicates that it is indeed a value rather than an expression that has not yet been evaluated. For example, the v in the first rule indicates that when calling a function, the argument must be evaluated before entering the body of the function, i.e. we use call by value. In addition to the two ẞ rules above, the different arithmetic primitives behave as expected: ~ mi — m2 - n1—N2 (+ n₁ n₂) (- n₁ n₂) ~ (* n1 n₂) ← n1 x n2 ... So it is a variant of the X-calculus, no big surprise. The scope is static and the order of evaluation is by value. However, the reduction rules below do not take into account the presence of impure operations ref !, get !, and set !, which require the use of more complex reductions where we consider not only the expression to be reduced but also the state of the memory (also sometimes called the heap). More specifically, the rules above have the form ee' but should actually be of the form (M; e)(M; e'). Thus, the impure rules can be defined as follows: (M; (ref! v)) > (M, e 7⇒ v; e) e is a new address ~> (M; (get! )) (M; v) M(e) = v (M; (set ! & v)) ~> (M' ; v) M' = M, e 7 → v Haskell code remains pure and will therefore follow these semantic rules in a fairly straightforward way: the eval function will receive an argument that represents this M which will be modified in a pure way. 3 Implementation The implementation of the language works in several phases: 1. A first phase of lexical and syntactic analysis transforms the source code into a representation described below, called Sexp in the code. This is not yet a complete abstract syntax tree (it actually resembles XML). 2. A second phase, called s21, completes the syntactic analysis and begins compilation, by transforming this tree into a true abstract syntax tree in the representation called Lexp in the code. In a sense, this phase already begins compilation since the Lexp language is not identical to our source language. 3. Finally, an eval function proceeds to the evaluation of the expression by interpretation. A portion of the implementation is already provided: the first phase as well as various pieces of the others. Your task will be to fill in the gaps. 3.1 Lexical and syntactic analysis: Sexp The lexical and syntactic analysis is already implemented for you. It is more permissive than necessary and accepts any expression of the following form: e ::= n | × | '(' {e} )' n is a signed decimal integer. It is represented in the Haskell tree by: Snum n. x is a symbol that can be composed of any number of alphanumeric and/or punctuation characters. For example, '+' is a symbol, '<=' is a symbol, 'voiture' is a symbol, and 'a+b' is also a symbol. In the Haskell tree, a symbol is represented by: Ssym x. '('{e}')' is a list of expressions. In the Haskell tree, lists of expressions are represented by simply linked lists consisting of pairs Scons left right and the end marker Snil. left is the first element of the list and right is the rest of the list. For example, the parser transforms the expression (+ 2 3) into the following Haskell tree: Snode (Ssym "+") [Snum 2, Snum 3] The lexical analyzer considers that a ';' character starts a comment, which ends at the end of the line. 3.2 The Lexp intermediate representation This intermediate representation is a kind of abstract syntax tree. In this representation, +, -, ... are simply predefined variables. 3.3 The execution environment The provided code also defines the initial execution environment, which contains the predefined functions of the language such as addition, subtraction, etc. It is defined as a table that associates to each predefined identifier the value (of type Value) associated. 3.4 Evaluation The evaluator uses the initial environment to reduce an expression (of type Lexp) to a value (of type Value). It also takes an argument that represents the memory state M and which is returned (possibly modified) with the value resulting from the evaluation of the expression.See Answer
  • Q7: COM2108 FUNCTIONAL PROGRAMMING GRADING ASSIGNMENT This is a grading assignment, hence worth 60% of your overall mark if you pass the threshold assessment. The flip side is that if you pass the threshold assessment, you get 40% for the module even if you get 0 on this assignment. The grading assignment deadline is before the later threshold assessment attempt sittings, so you should aim to attempt this assignment even if you have not yet passed the threshold assessment. The work you do on this assignment should improve your understanding of threshold concepts and so help you perform better on the threshold assessment. INTRODUCTION This programming assignment is based around the game of dominos. The first thing to do, if you are not already familiar with the game, is to learn about it. Wikipedia can help you here: http://en.wikipedia.org/wiki/Dominos Here is an example of a dominos board part-way through a game left end right end Board1 . • If the next player has in her hand the following: Hand1 at the left end or Then she may play at the right end of the above board. The other dominos may not be played. Some dominos games allow plays up and down as well as left and right from a double, otherwise known as a "spinner", but we will not allow such moves. A standard set of dominos contains all the permutations from to, 28 in all. There are many variations on the games of dominos and how it is scored. In this assignment you will implement fives-and-threes dominos players (details to follow) and test them against each other by playing simulated matches. Some hints are provided about good play. You should experiment with your dominos players to see if implementing each hint does indeed improve the player's game. You are not expected to program all the hints and you may try other tactics. PLAYING A ROUND OF FIVES-AND-THREES DOMINOS To play a round of fives-and-threes dominos, you proceed as follows: • • • Each player starts with a hand of N dominos. The remaining dominos take no part in this round – they are 'sleeping'. N is usually 7, but a variation of the rules uses 9 dominos if there are only two players. Players add a domino to the board ('dropping' a domino) in turn and accumulate the fives-and-threes scores of their 'drops'. See below for details of how the score is calculated after each drop. The player who drops the first domino gets the fives-and-threes score of its total spots (e.g. if the first drop is which we will represent by (4,5), the player who dropped it scores 3 - full details of how to calculate the score are provided below). If a player does not have a domino that they can play on the current board, they 'knock' to indicate that they are skipping their turn. They cannot knock if they have a domino that they can play. Play continues until neither player can play (either because each player has run out of dominos or is knocking). If a player 'chips out' (plays a domino so that they have no dominos left in their hand) they score one point for this (on top of whatever they score for playing the tile). SCORING FOR Fives-and-THREES DOMINOS After a player has added a domino to the layout, the pips (number of dots) on the two open ends are added up. Points are awarded as follows: Pip total Score Justification 3 1 One 3 5 1 One 5 6 2 Two 3s 9 3 Three 3s 10 2 12 4 15 8 Two 5s Four 3s Five 3s and Three 5s 18 6 Six 3s 20 4 Four 5s Other values 0 Not a multiple of 5 or 3 PLAYING A MATCH OF FIVES-AND-THREES DOMINOS A 2-player fives-and-threes dominos match is organised as follows: A match consists of N games, typically 3 in a real-life setting. The winner is the player who has won most games. With our tireless computer players, N can be much greater than 3. • Each game involves a sequence of rounds (as defined above). The two players take it in turns to drop first in each round. COM2108: Functional Programming - Autumn 2023 2 • A game terminates when one player or the other wins by achieving an accumulated score, over the rounds, of exactly V, where V is the target value. V is typically 61, but a different value can be chosen, such as 31 or 121. At the end of a round, if neither player has reached V, a new round starts, and the scores obtained within this round are added on to the scores after the last round. You must finish exactly, for example if your target is 61 and your score is 59, you need to play a domino which scores 2 to win the game... but if that domino is your last domino, you need to score just 1 from the domino that you play, because you also get a point for “chipping out." If you score more than the target ('going bust'), your score remains the same (e.g. if the target is 61, your score is 59 and you play a domino which scores 4, your score remains at 59). WHAT IS BEING ASSESSED In this assignment, we are not looking at who can write code to produce the best fives-and-threes dominos player. If you would like to try that challenge, you will have that opportunity at the end of semester, but that will not impact upon your mark for this module. What we are assessing here is: 1. The design of your solution, demonstrating that you have given some thought to the design of your player. It should be clear that you have given thought to the functional decomposition, and that you have experimented with the suggested strategies. (20%) 2. The testing of your solution, evidencing that you have tested your code thoroughly. You should not provide a random set of test data and output. You should give a rationale for the test cases that you have chosen. You may illustrate you testing with a carefully selected set of examples demonstrating that a function is working as intended, but make sure that it is clear to the reader why this set has been chosen. (30%) 3. The implementation of your solution, for both correctness and clarity. Your code should do what it is intended to do, but it should also be well-presented and understandable by others. This means sensible layout, code presented in a logical order, good choice of function and parameter names, consistency in style, clear comments (header documentation, function documentation, inline documentation where it is needed). (40%) 4. Your critical reflection about what you have learned when studying functional programming. (10%) More detail on each of these points is provided towards the end of this document. DOMSMATCH.HS You should take a copy of DomsMatch.hs from Blackboard and add your code to the bottom of this file. Note that near the top of this file there is the line "import System.Random”. System.Random is a library which is not installed by default, but it is essential in this project. You need to install it outside of ghci, at the command/terminal prompt, using the command: cabal install --lib random Once you have done this, start ghci, then type import System.Random COM2108: Functional Programming - Autumn 2023 3 at the Haskell prompt. If you don't get an error, you have successfully installed the library. This is the only library that you should install this way. If you try to use any other libraries that you have installed this way, your code will not run when it is submitted. This will result in a score of 0 for the implementation. DATATYPES The key datatypes are provided for you in the file DomsMatch.hs. You should not change these datatypes. These are: • Domino - representing a domino tile. • DominoBoard - which contains a current board state - - either the initial (that is, empty) board, or the current state, represented by: the left-most domino (with left-most pips in the first position in the tuple), the right-most domino (with right-most pips in the second position in the tuple), and the history of the game. • History - the layout of the board from left at the start of the list to right at the end of the list, where each domino is combined with which player played it and which turn at which it was played. • Player - essentially two labels to identify the individual players. • End indicating the end at which a tile is placed. • Scores - a tuple of scores representing (player 1's score, player 2's score) MoveNum to keep track of what was played when. • • Hand a set of dominos • DomsPlayer - this is the type of a function. A function of this type will return the move that it will make given the current Hand, Board, and Scores (Player is also an argument, indicating which player this player is, which may be useful if you wish to refer to the History when deciding on your move.) You can add extra datatypes if you wish. SCAFFOLDING FUNCTIONS A number of scaffolding functions are provided for you in DomsMatch.hs. The top-level function is domsMatch which as the name implies, plays a dominos match. It takes six arguments: the number of games to play in a match, the initial number of dominos in a hand, the target score, the two player functions, and a seed for the random number generator. Lower-level functions play a dominos game and a dominos round. Right now, these functions don't work properly, because they depend upon scoreBoard, blocked and playDom which are currently incorrectly implemented. The first thing you need to do is implement these functions. SCORING A BOARD The first function you must implement is scoreBoard. scoreBoard takes a Board and a Bool as arguments, where the Bool is True if the domino just played was the last domino from the hand, and False otherwise, and returns the score that would be received by creating this board state. For example, if the first player played (4,5), the board would contain just this domino, and so would score 3 (three threes - unless for some weird reason you were playing with an initial hand size of 1, in which case the score would be 2). If the next domino played was a (5,1) (which could only be played to the right end), the score on this board ([(4,5)(5,1)]) would be 1 (4+1 = 5; one five – again, unless you were playing with an initial hand size of 2...). COM2108: Functional Programming - Autumn 2023 4 Currently this function simply returns 0 for every input. CHECKING IF A PLAYER IS BLOCKED The next function to implement is blocked. blocked takes a Hand and a Board and is meant to return True only if there is no domino in the hand that can be played on the board. Currently this function always returns True. PLAYING A DOMINO Now you need to implement playDom, which given a Domino, a Board and an End, should play the domino at the given end if it is possible to play it there. The return type should be a Maybe Board. (See Errors and Uncertainty recording.) Currently this function always returns Nothing, but it should only return Nothing if it is not possible to play that domino at that end on the board. OTHER POSSIBLE BASIC FUNCTIONS Some other functions that might be useful include: • canPlay: a predicate (function that returns True or False) given a Domino, an End and a Board, returns True if the domino can be played at the given end the board. • played: a predicate returning True if a given Domino has already been played on a given Board. • • possPlays: given a Hand and a Board, return all the Dominos which may be played at the left End and all those that may be played at the right End. The return type should be a pair, where each item in the pair is a list of dominos. doms2scoreN: given a Board and an Int n, return all the Dominos not already played which could be played to give a fives-and-threes score of n and the End at which to play each one. You do not have to implement these functions; and before you even think about implementing them, you should complete your design and identify where (if anywhere) they will be used. You are certainly going to need to implement other functions than these as well. CREATING A SIMPLE PLAYER In DomsMatch.hs, you are provided with a data type for a DomsPlayer. This type is for a function that, given a particular Hand, Board, Player and Scores it returns a tuple (Domino, End) indicating the domino to be played and the end at which to play it. You must implement a function that will play a valid move when called. You should not attempt to implement any sophisticated reasoning at this stage. Your function must be called simplePlayer and it must be of type DomsPlayer. You do not have to check is it is possible to play a domino; you can assume that this function will only be called if the player has at least one domino in their hand that can be played on the current board. Remember, just one simple opponent is all that is needed at this stage. CREATING A "Smart” PlayER COM2108: Functional Programming - Autumn 2023 5See Answer
View More

Popular Subjects for Haskell Programming

You can get the best rated step-by-step problem explanations from 65000+ expert tutors by ordering TutorBin Haskell Programming homework help.

Get Instant Haskell Programming Solutions From TutorBin App Now!

Get personalized homework help in your pocket! Enjoy your $20 reward upon registration!

Claim Your Offer

Sign Up now and Get $20 in your wallet

Moneyback

Guarantee

Free Plagiarism

Reports

$20 reward

Upon registration

Full Privacy

Full Privacy

Unlimited

Rewrites/revisions

Testimonials

TutorBin has got more than 3k positive ratings from our users around the world. Some of the students and teachers were greatly helped by TutorBin.

After seeking Haskell Programming homework help from TutorBin, I must say that their programmers are nothing short of amazing. They not only assisted me in completing my assignment but also provided me with a deep understanding of the Haskell programming language. I now feel more confident in my coding skills, all thanks to TutorBin expert guidance.

Sophia

The expert tutors at TutorBin are true Haskell wizards. They helped me unravel the complexities of Haskell programming and made the learning process enjoyable. With their guidance, Haskell assignments went from daunting to doable. I'm grateful for the knowledge I've gained with their assistance.

Lillian

I cannot express how thankful I am for TutorBin incredible Haskell homework help. The programmers there are not only knowledgeable but also patient and understanding. They clarified my doubts, provided Haskell Programming examples, and turned Haskell from a struggle into a fascinating subject. Thank you, TutorBin, for making Haskell so much more accessible.

Hudson

TutorBin Haskell tutors are brilliant. With their guidance, Haskell ceased to be a roadblock in my studies. They provided prompt assistance and ensured that I not only completed my assignments but also comprehended the underlying principles. TutorBin is my go-to place for Haskell help, and I couldn't be happier with the support I've received.

Lucas

TutorBin Haskell Programming tutors were incredibly helpful! They spared me numerous hours of frustration and confusion by simplifying complicated Haskell concepts. The assistance I received went beyond assignment completion; it significantly improved my understanding of Haskell. I wholeheartedly recommend TutorBin to any programming student.

Audrey

TutorBin helping students around the globe

TutorBin believes that distance should never be a barrier to learning. Over 500000+ orders and 100000+ happy customers explain TutorBin has become the name that keeps learning fun in the UK, USA, Canada, Australia, Singapore, and UAE.