#ifndef CASE_H
#define CASE_H

#include <list>
#include <queue>




struct Token
{
	int      val;
	unsigned proba;

	Token(const Token& t) : val(t.val), proba(t.proba) {}
	Token(int _v, unsigned _p) : val(_v), proba(_p) {}
	
	Token& operator=(const Token& t) {
		val = t.val; proba = t.proba;
		return *this;
	}

	friend bool operator<(const Token& t1, const Token& t2);
};

inline bool operator<(const Token& t1, const Token& t2)
{
	return t1.proba >= t2.proba;
}


struct Case
{
    int val;
    std::list<int> possible;
	std::priority_queue<Token> proba;

    Case(int v = 0) 
	{
    	if (v == 0)
    	{
	    	for (int i=1;i <10; ++i)
				possible.push_back(i);
		}
        val = v;
    }

    Case(const Case& c) 
	 : val(c.val), possible(c.possible), proba(c.proba)
	{
	}

    Case& operator=(int i) {val = i; possible.remove(i); return *this;}
    Case& operator=(const Case& c) {
		val = c.val;
		possible = c.possible;
		proba = c.proba;
		return *this;
	}

    inline bool operator==(int v) const {return val == v;}
    inline bool operator!=(int v) const {return val != v;}
    inline bool operator==(const Case& v) const {return val == v.val;}
    inline bool operator!=(const Case& v) const {return val != v.val;}
};


std::ostream& operator<<(std::ostream& out, const Case& c);
void print     (std::ostream& out, const Case& c);

#endif
