completed ToH board ADT implementation

This commit is contained in:
MarcUs7i 2025-01-19 09:34:55 +01:00
parent 8386194964
commit 59a36fe5f3
2 changed files with 135 additions and 4 deletions

View file

@ -26,7 +26,9 @@ typedef enum {
LEFT,
MIDDLE,
RIGHT
} Rod;
} RodName;
typedef Disk Rod;
/** Declares type for the 'Tower of Hanoi' board */
typedef struct TohBoardData* TohBoard;
@ -62,7 +64,7 @@ bool tb_is_valid(TohBoard board);
* @param rodName The rod from which the disk shall be taken and removed.
* @return The removed disk or 0, if no disk was on the rod.
*/
TohBoard tb_pop_disk(TohBoard board, Rod rodName);
Disk tb_pop_disk(TohBoard board, RodName rodName);
/**
* Applies the given disk to the given rod, if this
@ -74,7 +76,7 @@ TohBoard tb_pop_disk(TohBoard board, Rod rodName);
* @return True if the disk could be legally placed on the rod
* (move is allowed and disk is valid), false otherwise.
*/
bool tb_push_disk(TohBoard board, Rod rodName, TohDisk disk);
bool tb_push_disk(TohBoard board, RodName rodName, Disk disk);
/**
* Provides the disk from the named rod at the given position.
@ -86,6 +88,6 @@ bool tb_push_disk(TohBoard board, Rod rodName, TohDisk disk);
* @return The addressed disk or 0, if not disk is located on the
* index position of the named rod.
*/
TohDisk tb_get_disk(TohBoard board, Rod rodName, unsigned short idx);
Disk tb_get_disk(TohBoard board, RodName rodName, unsigned short idx);
#endif