Artifact Content
Not logged in

Artifact b584e6b7fe45956b44f542c7625d149871f335d2


// code template for BFS

		State start = /*start*/;
		vector<State> Q( 1, start );
		set<State>    V; V.insert(start);

		for(int step=0; !Q.empty(); ++step)
		{
			vector<State> Qold; Qold.swap(Q);
			for(int qi=0; qi<Qold.size(); ++qi)
			{
				State& cur = Qold[qi];
				if( /*isGoal(cur)*/ )
				{
				}

				foreach(next)
				{
					if( !V.count(next) )
					{
						V.insert(next);
						Q.push_back(next);
					}
				}
			}
		}