Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // File: $Id:$
- // Author: Bo-Ram Hwang
- // Description: Header file for the puzzle
- // Revisions: $Log:$
- #ifndef WATERPUZZ_H
- #define WATERPUZZ_H
- #include <map>
- #include <vector>
- class WaterPuzz {
- struct Bucket {
- int capacity; // Maximum that a bucket can hold
- int current; // Amount of water that a bucket has atm
- };
- public: //
- // Name: (Constructor)
- // Description: Creates a water puzzle object with two parameters: desired amount of water; a vector of buckets.
- WaterPuzz(int goal, std::vector<int> buckets);
- // Accessor
- // Name: getNeighbors
- // Description: Takes in a node; returns the neighbors of the node (for this puzzle, it'll call various functions that return neighbors under certain conditions).
- std::vector<Bucket> getNeighbors(std::vector<int> node);
- // Accessor
- // Name: isSol
- // Description: Checks if solution has been found
- bool isSol(std::vector<int> node);
- // Mutator
- // Name: emptyBucket
- // Description: Emptys the content of a given bucket
- void emptyBucket(Bucket b);
- // Mutator
- // Name: pourBucket
- // Description: Takes the content of Bucket A and gives it to Bucket B.
- void pourBucket(Bucket A, Bucket B);
- // Mutator
- // Name: fillBucket
- // Description: Fills Bucket A to it's max capacity.
- void fillBucket(Bucket A);
- // Accessor
- // Name: isEmpty
- // Description: Tests if Bucket A is empty.
- bool isEmpty(Bucket A);
- // Accessor
- // Name: isFull
- // Description: Tests if Bucket A is full.
- bool isFull(Bucket A);
- private:
- std::map<(std::vector<Bucket>), (std::vector<Bucket>)> _map;
- std::vector<Bucket> _queue;
- int _goal;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement