Assignment #1 Solution

$30.00 $24.90

Description

Where there are three heaps of stones and you can take any non-zero number from one heap each turn.
The goal is to force the opponent to take the last stone and lose.

requirement 1) Write a Boolean function called Bool Win(int A, int B, int C) that returns True if there exists a
forced win from this position for the player whose turn it is to move.

There is no need to consider the decision procedure to determine the move to make.
Also, do not consider efficiency nor memory requirements.
requirement 2) The algorithm must be RECURSIVE.

requirement 3) Either submit a typed or handwritten description of the algorithm written in pseudo-code.
requirement 4) Make sure that each step of the algorithm is operational and include comments.

It is recommended that you follow the “meta-algorithm” described in class that was applied to develop the
definition of Win for the simple 2 heap NIM.

Simple problem-> solutions: Identify the set of simplest problems and then return their solutions
Problem reduction: Identify all possible sub-problems that could be generated from the initial problem
Solution construction: How will the solution to the main call be computed from the solutions to the sub-problems?