Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Homework Help/Study Tips Expert

Testing your implementation

In addition to implementing your solution, you are also required to submit a suite of test cases that can be used to test your Question 2 make_move_capture function.

You should aim to make your test cases as complete as possible. That is, it should be sufficient to pick up invalid moves. Your suite of test cases may assume that the input passed to your function will be of the correct type and will be well-formed, in that the first argument will be a string of the correct length, containing valid characters ( ' x ' , ' o' , and ' . ' ), and the second and third arguments will be tuples containing the coordinates of start and end coordinates. However, you should not assume that the moves described by these inputs are necessarily valid.

Your test cases suite will be evaluated by running it on several known incorrect implementations, in which it should detect incorrect behaviour; ie, failure to reject invalid input or failure to accept valid input. One of your marks will be allocated on the basis of this evaluation.

Further, we will run a tournament in which each test you submit is used to test every other Question 2 submission, to generate a "leaderboard" of whose test case suites best managed to detect incorrect behaviour in other submissions. Note that this will be run anonymously, you will not know whose submissions were incorrect, simply how many incorrect submissions your test case suite was able to detect. There is a possible bonus mark for accurately detecting incorrect Question 2 submissions!

You should specify your test cases as a series of calls to the function test_make_move_capture( ( board_string, start, end ) , expected_return_value), where board_string and expected_return_value are board string representations of the initial and final boards, and start and end are 2-tuples of positions, as in Question 2. That is, you specify both the arguments and return value for make_move_capture as arguments to test_make_move_capture.

Write a function make_move_sequence(board_string, move_sequence) that validates a sequence of moves constituting part of a game. This sequence may contain both normal and capture moves. This function should take as arguments a string representation of the initial board state, and a list of tuples containing the start and end coordinates corresponding to a sequence of successive moves.

The return value of this function is a string representation of the final board state (ie, after executing all moves in the sequence) if the sequence of moves are valid, or None if an invalid move is made at any point in the sequence.

Assumptions: It can be either black or white's turn for any initial given board state.
>>> print(make_move_sequence('xxxx 0000', [((1, 0), (1, 1)), ((2, 3), (1, 2))]))
'x.xx.x...o..00.o'
>>> print(make_move_sequence('x.xx.x...o 00.o', [((1, 2), (2, 1)), ((1, 1), (1, 3))]))
'x.xx..o ..... ox.o'

We have provided to you a reference implementation of the make_move_normat ( boa rd_st ri ng, start, end) function from Question 1 and make_move_capture (boa rd_stri ng, start, end) function from Question 2 that you can use here. You can use our reference irnplemenation of the function make_move_normal (boa rd , start, end) or make_move_captu re (boa rd , start, end) by adding this code at the beginning of your code:
from reference import make_move_capture, make_move_normal

VVriteafunctimmake_move_capture(board_string, start, end) that takes as input a string representation of the current board state, a tuple representing the initial position of the piece to be moved (start), and a tuple representing the end position (end) the piece is to be moved to. This function will validate if the move is valid and if so, execute the move.

The function should return a string representation of the board reflecting the position of the pieces after the move if the move is valid, or None if the move is invalid.

Note: This is the hardest question in Project 2! If you get stuck, you may want to go on to Questions 3 and 4 first. Remember that you can get marks for your approach, even if you don't get the green diamond!

Attachment:- assignment.zip

Homework Help/Study Tips, Others

  • Category:- Homework Help/Study Tips
  • Reference No.:- M92808154
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question?


Related Questions in Homework Help/Study Tips

Assignment -professional development and mentoring planin

Assignment -Professional Development and Mentoring Plan In this assignment, you will research and locate (you may use the Internet, the Argosy University online library resources, and, most likely, a combination of both ...

Question 1 based on historical data sales for a particular

Question: 1. Based on historical data, sales for a particular cosmetic line follow a continuous uniform distribution with a lower limit of $2,500 and an upper limit of $5,000. A. What are the mean and standard deviation ...

Question emergency management procedurebullfrom the

Question: Emergency Management Procedure • From the e-Activity, analyze the major hazards or risks that are present in the community you have researched. Speculate on whether or not you believe your researched location i ...

Multiple relationship presentationthere are many situations

Multiple Relationship Presentation There are many situations that may present in counseling as multiple relationships or boundary issues. In order to deliver the best quality of care for your clients, it is important to ...

Question as the human resources manager it is your

Question: As the human resources manager, it is your responsibility to keep all human resources employees informed about current employment law. You want to empower employees with resources that they can use independentl ...

Question write an 1500 words essay about the chosen plant

Question: Write an 1500 words essay about the chosen plant (Basil) following the prompt below: Scientific and Medical Evidence( Chosen plant; Basil) Herbs and plants contain chemical compounds; some of them are effective ...

Assignmentresearch microsoft excel the statistical package

Assignment Research Microsoft Excel, the statistical package for the social sciences (SPSS), and the legal and ethical aspects of surveys and data collection. Answer the following questions separately and completely: • D ...

Question recently new york state increased minimum wages to

Question: Recently, New York State increased minimum wages to $10.50/hr with a plan to increase over the next 3 years to $16/hr. What are the intended and unintended consequences of such a public policy? The response mus ...

Assessment 1 - present optionsperformance

Assessment 1 - Present options Performance objective Demonstrate the skills and knowledge required to analyse strategic and operational plans in order to present remuneration and benefit options to management. Assessment ...

Question one highlight in the life of a parent is when

Question: One highlight in the life of a parent is when their child says their first word. Soon after this celebratory event, language acquisition will accelerate faster than at any other time in life. For some hints on ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As