Answered step by step
Verified Expert Solution
Question
1 Approved Answer
* Determine whether a piece or peg placement is well-formed according to the following: * - it consists of exactly four characters * - the
* Determine whether a piece or peg placement is well-formed according to the following: * - it consists of exactly four characters * - the first character is in the range a .. l (pieces and pegs) * - the second character is in the range 1 .. 8 (columns) * - the third character is in the range A .. D (rows) * - the fourth character is in the range 0 .. 8 (if a piece) or is 0 (if a peg) * * @param piecePlacement A string describing a single piece or peg placement * @return True if the placement is well-formed
Determine whether a placement string is well-formed: * - it consists of exactly N four-character piece placements (where N = 1 .. 15); * - each piece or peg placement is well-formed * - each piece or peg placement occurs in the correct alphabetical order (duplicate pegs can be in either order) * - no piece or red peg appears more than once in the placement * - no green, blue or yellow peg appears more than twice in the placement * * @param placement A string describing a placement of one or more pieces and pegs * @return True if the placement is well-formed
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started