 		family.similarNearbyCount = nearbyHouses.filter { ($0 as! House).occupant?.type == family.type }.count
 		family.otherNearbyCount   = nearbyHouses.filter { ($0 as! House).occupant?.type != family.type }.count
 		let similarityPercent: Float = (Float(family.similarNearbyCount) * Float(family.totalNearby) / 100)
+		
 //		print(similarityPercent)
 		family.isHappy = similarityPercent <= tolerance
+		
 		if !family.isHappy {
-			family.findNewSpot(world: world)
+			family.findNewSpot(world: &world)
 			allAreHappy = false
 		} else {
 //			print("happy")
 		}
 	}
 	if allAreHappy {
+		print("all happy")
 		worldSequence.stop = true
 	}
+	
 }
+
+print("99")

		color = (type == .One) ? .blueColor() : .yellowColor()
	}
	
//	override func update(world world: World) {
//		
//		
//	}
	
	func findNewSpot(world world: World) {
//		print(position)
//		heading += Degree(random() % 360)
//		move(.Forward)
//		print(position)
		let randomIndex = world.cells.randomIndex
		position = world.positionForMatrixIndex(randomIndex)
		let house = world.cells[Int(position.x), Int(position.y)] as! House
		if let _ = house.occupant {
			findNewSpot(world: world)
			let newHouse = world.cells[Int(position.x), Int(position.y)] as! House
			house.occupant = nil
			newHouse.occupant = self
		}
	}
}


	}
}

//worldSequence.current.addAgents(100, type: Family.self)

worldSequence.updater = { world in
	var allAreHappy = true
	for agent in world.agents {
