public bool VerifySolution(Code code, int numPeople, int numHats)
		{
			var possibleCombinationsOfHats = this.GenerateAllPossibleHatAssignments(
				numPeople, 
				numHats,
				1);

			var numPeopleInSmallerLine = code.Code1.OneWaySignals.First().Signal.Assignment.Length;
			var numPeopleInLargerLine = code.Code2.OneWaySignals.First().Signal.Assignment.Length;

			foreach (var combination in possibleCombinationsOfHats)
			{
				var signalFromSmallerLineMembers = new IndividualAssignment[numPeopleInSmallerLine];
				var signalFromLargerLineMembers = new IndividualAssignment[numPeopleInLargerLine];
				for(int i=0; i< numPeopleInSmallerLine; i++)
				{
					signalFromSmallerLineMembers[i] = new IndividualAssignment { 
						CitizenId = combination.Assignment[i].CitizenId, 
						HatColor = combination.Assignment[i].HatColor 
					};
				}
				for(int i=0; i<numPeopleInLargerLine; i++)
				{
					signalFromLargerLineMembers[i] = new IndividualAssignment
					{
						CitizenId = combination.Assignment[i + numPeopleInSmallerLine].CitizenId,
						HatColor = combination.Assignment[i + numPeopleInSmallerLine].HatColor
					}; 
				}
				var signalFromSmallerLine = new HatAssignment { Assignment = signalFromSmallerLineMembers };
				var signalFromLargerLine = new HatAssignment { Assignment = signalFromLargerLineMembers };

				var responseFromSmallerLine = code.Code2.OneWaySignals.Single(c => c.Signal.Equals(signalFromLargerLine)).Response;
				var responseFromLargerLine = code.Code1.OneWaySignals.Single(c => c.Signal.Equals(signalFromSmallerLine)).Response;

				if(!(this.PairContainsAtLeastOneMatchingHat(signalFromSmallerLine, responseFromSmallerLine)
					|| this.PairContainsAtLeastOneMatchingHat(signalFromLargerLine, responseFromLargerLine)))
				{
					return false;
				}
			}
			return true;
		}
		public bool PairContainsAtLeastOneMatchingHat(HatAssignment assignment1, HatAssignment assignment2)
		{
			if(assignment1.Assignment.Length != assignment2.Assignment.Length)
			{
				throw new InvalidOperationException("the rows being compared must contain the same number of people");
			}

			for(int i=0; i<assignment1.Assignment.Length; i++)
			{
				if (assignment1.Assignment[i].CitizenId != assignment2.Assignment[i].CitizenId)
				{
					throw new InvalidOperationException("the memberIds don't line up");
				}

				if (assignment1.Assignment[i].HatColor == assignment2.Assignment[i].HatColor)
				{
					return true;
				}
			}
			return false;
		}
		public HatAssignment GetResponseFromSignal(HatAssignment signal, OneWayCode code, List<HatAssignment> keySetOfFirstCode)
		{
			var responsesToMatch = new List<HatAssignment>();
			foreach (var oldSignal in code.OneWaySignals)
			{
				if (!this.PairContainsAtLeastOneMatchingHat(signal, oldSignal.Response))
				{
					responsesToMatch.Add(oldSignal.Signal);
				}
			}

			foreach (var possibleResponse in keySetOfFirstCode)
			{
				if (responsesToMatch.All(r => this.PairContainsAtLeastOneMatchingHat(possibleResponse, r)))
				{
					
					return possibleResponse;
				}
			}
			return null;			
		}