CS代考计算机代写 Homework 2

Homework 2
Programming Language BSL
Due Date: Friday February 5, 9pm
Purpose To write simple functions; design data; design World Programs Expectations
This will be an individual (non-pair) assignment. For this and all future assignments you must upload one .rkt file in the language specified at the top of the assignment to the Handin Server. Failure to do so invalidates your submission and will therefore, unfortunately, result in a score of 0.
Unless otherwise stated, all data and functions you design must be designed according to the data and function design recipes (DR), resp., following all four steps in each case, with the exception of functions that call big-bang, for which you need no check-expects, as justified in class. All functions used inside big-bang must have check-expects, along with the other three steps of the design recipe.
We will not walk you through the DR steps in each problem, nor request them individually and explicitly. Instead, review the data and function design recipes before starting this homework, and then have these recipes handy.
Exercise 1 Design data for a ChessPiece. There are six of them: pawn, knight, bishop, rook, queen, and king.
Exercise 2 Design a function piece-multiplicity that takes a chess piece as input and returns how many copies of each piece one player has when the game starts. (Do some research if you are not a chess player.) You can use PosInteger as the return type of your function.
Exercise 3 Different chess pieces have different (perceived) “values”. One commonly agreed scale is: in the above order, they are worth 1, 3, 3, 5, 9, and 99 points, resp. The “99 points” is the value of the king (it is really infinitely valuable, since losing it loses the game).

Design a function piece-value that returns the value of a given chess piece. You can use PosInteger as the return type of your function.
Exercise 4 Your friend (the obnoxious one from HW01) objects to this value system: “A pawn is only 1 point, but I have many of them!”
Design an all-pieces comparison function called combined-start-