SHARE
TWEET

Untitled

a guest Aug 12th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // File: $Id:$
  2. // Author: Bo-Ram Hwang
  3. // Description: Header file for the puzzle
  4. // Revisions: $Log:$
  5.  
  6. #ifndef WATERPUZZ_H
  7. #define WATERPUZZ_H
  8.  
  9. #include <map>
  10. #include <vector>
  11.  
  12. class WaterPuzz {
  13.  
  14. struct Bucket {
  15.     int capacity; // Maximum that a bucket can hold
  16.     int current; // Amount of water that a bucket has atm
  17. };
  18.  
  19. public: //
  20.     // Name:    (Constructor)
  21.     // Description: Creates a water puzzle object with two              parameters: desired amount of water; a vector of                buckets.
  22.     WaterPuzz(int goal, std::vector<int> buckets);
  23.  
  24.     // Accessor
  25.     // Name:    getNeighbors
  26.     // 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).
  27.     std::vector<Bucket> getNeighbors(std::vector<int> node);
  28.  
  29.     // Accessor
  30.     // Name:    isSol
  31.     // Description: Checks if solution has been found
  32.     bool isSol(std::vector<int> node);
  33.  
  34.     // Mutator
  35.     // Name:    emptyBucket
  36.     // Description: Emptys the content of a given bucket
  37.     void emptyBucket(Bucket b);
  38.  
  39.     // Mutator
  40.     // Name:    pourBucket
  41.     // Description: Takes the content of Bucket A and gives it to               Bucket B.
  42.     void pourBucket(Bucket A, Bucket B);
  43.  
  44.     // Mutator
  45.     // Name:    fillBucket
  46.     // Description: Fills Bucket A to it's max capacity.
  47.     void fillBucket(Bucket A);
  48.  
  49.     // Accessor
  50.     // Name:    isEmpty
  51.     // Description: Tests if Bucket A is empty.
  52.     bool isEmpty(Bucket A);
  53.  
  54.     // Accessor
  55.     // Name:    isFull
  56.     // Description: Tests if Bucket A is full.
  57.     bool isFull(Bucket A);
  58.  
  59. private:
  60.     std::map<(std::vector<Bucket>), (std::vector<Bucket>)> _map;
  61.     std::vector<Bucket> _queue;
  62.     int _goal;
  63. };
  64. #endif
RAW Paste Data
Top