library Players initializer ini
	public struct Players
		static constant integer COUNT 		 = 12
		static constant integer FIRST_HUNTER = 0
		static constant integer LAST_BEAST	 = 11
		static constant integer MARKERS      = 11
		static constant integer PASSIVE      = 15
		static constant integer HOSTILE      = 12
		static constant integer FIRST_BEAST  = 6
		static player locl
		static boolean array playing
		static boolean array aiControlled
		static boolean array alive
		static player array fromId
		static integer aliveCount 	      = 0
		static integer aiCount 		      = 0
		static integer humanCount         = 0
		static integer playingCount	      = 0
		static integer escapePressedCount = 0
	end

	function ini takes nothing returns nothing
		integer index = 0

		Players.locl = GetLocalPlayer()
		Players.fromId[Players.MARKERS] = Player(Players.MARKERS)
		Players.fromId[Players.PASSIVE] = Player(Players.PASSIVE)

		loop
			exitwhen index > (Players.COUNT - 1)
			Players.fromId[index]  = Player(index)
			Players.playing[index] = (GetPlayerSlotState(Players.fromId[index]) == PLAYER_SLOT_STATE_PLAYING) or (GetPlayerController(Players.fromId[index]) == MAP_CONTROL_COMPUTER)
			Players.alive[index]   = Players.playing[index]
			Players.aiControlled[index] = (GetPlayerController(Players.fromId[index]) == MAP_CONTROL_COMPUTER) and (GetPlayerController(Players.fromId[index]) != MAP_CONTROL_USER)

			if Players.playing[index] then
				Players.playingCount++
			end

			if Players.playing[index] and not Players.aiControlled[index] then
				Players.humanCount++
			end

			if Players.aiControlled[index] then
				Players.aiCount++
			end

			index++
		end
	end
endlibrary
