3.3 Exercise 3
Implement a program in F# that simulates the scoring system for a single tennis game.
Each player can have either of these points in one game: 0, 15, 30, 40.
If you have 40 and you win the ball, you win the game. There are, however, some special rules to consider.
If both have 40, the players are deuce.
If the game is in deuce, the winner of a ball will have advantage and game ball. If the player with advantage wins the ball, they win the game. If the player without advantage wins, they are back at deuce.
3.1 Exercise 1
Develop an F# Program that meets the following criteria:
Given an input le nd all valid anagrams of the individual words within that le. All words provided as input should also count the amount of valid anagrams found for them and output this amount to the user.
Finally the program should conclude by printing out a list of the top ten words with the highest amount of anagrams discovered for them along with the count of the amount of valid anagrams found for each.
Download the le words.txt to use as a basis for your program. You may also nd Anagram Solver useful.
4.2.7 Exercise 7
There is a famous Computer science puzzle called the ‘Towers of Hanoi’.
The goal of the puzzle is to move all the disks from the leftmost peg to the rightmost peg. The rules of the puzzle are as follows:
Move only one disk at a time.
A larger disk may not be placed on top of a smaller disk.
All disks, except the one being moved, must be on a peg.
Exercise 7.1 Write a function in F# that works out the minimum amount of moves needed to solve Tower of Hanoi (given ‘n’ amount of discs). This should make use of the formula: 2n −1
Exercise 7.2 Write a recursive Function in F# that attempts to solve the puzzle by stating the list of moves required. For example:
Move disc from peg x to peg y
Move disc from peg x to peg z e.t.c.
Dene an appropriate construct in F# that checks whether an input string is a valid web address URL (assuming we are using HTTP), email address, ipv4 address or none of these things.
7.2.1 Exercise 1.2
Dene a program that takes in the path to a textle as input, reads the text le, and utilises the previous construct dened in Exercise 1.1 to output all valid email addresses and web addresses found within the le (along with identifying the lines that they were found on).
To get a custom written paper, place an order with us!
Additional Benefits for you
♦ 24/7 customer support
♦ On-time delivery guarantee
♦ Plagiarism-free research papers
♦ Affordable and student-friendly prices
♦ Scholarly-rich custom-written papers
♦ 100% privacy and confidentialit