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

Review the website airmail service from the smithsonian

Review the website Airmail Service from the Smithsonian National Postal Museum that is dedicated to the history of the U.S. Air Mail Service. Go to the Airmail in America link and explore the additional tabs along the le ...

Read the article frank whittle and the race for the jet

Read the article Frank Whittle and the Race for the Jet from "Historynet" describing the historical influences of Sir Frank Whittle and his early work contributions to jet engine technologies. Prepare a presentation high ...

Overviewnow that we have had an introduction to the context

Overview Now that we have had an introduction to the context of Jesus' life and an overview of the Biblical gospels, we are now ready to take a look at the earliest gospel written about Jesus - the Gospel of Mark. In thi ...

Fitness projectstudents will design and implement a six

Fitness Project Students will design and implement a six week long fitness program for a family member, friend or co-worker. The fitness program will be based on concepts discussed in class. Students will provide justifi ...

Read grand canyon collision - the greatest commercial air

Read Grand Canyon Collision - The greatest commercial air tragedy of its day! from doney, which details the circumstances surrounding one of the most prolific aircraft accidents of all time-the June 1956 mid-air collisio ...

Qestion anti-trustprior to completing the assignment

Question: Anti-Trust Prior to completing the assignment, review Chapter 4 of your course text. You are a manager with 5 years of experience and need to write a report for senior management on how your firm can avoid the ...

Question how has the patient and affordable care act of

Question: How has the Patient and Affordable Care Act of 2010 (the "Health Care Reform Act") reshaped financial arrangements between hospitals, physicians, and other providers with Medicare making a single payment for al ...

Plate tectonicsthe learning objectives for chapter 2 and

Plate Tectonics The Learning Objectives for Chapter 2 and this web quest is to learn about and become familiar with: Plate Boundary Types Plate Boundary Interactions Plate Tectonic Map of the World Past Plate Movement an ...

Question critical case for billing amp codingcomplete the

Question: Critical Case for Billing & Coding Complete the Critical Case for Billing & Coding simulation within the LearnScape platform. You will need to create a single Microsoft Word file and save it to your computer. A ...

Review the cba provided in the resources section between

Review the CBA provided in the resources section between the Trustees of Columbia University and Local 2110 International Union of Technical, Office, and Professional Workers. Describe how this is similar to a "contract" ...

  • 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