/**
 * Given a list of players, count the number of players who are currently online.
 *
 * @param playerList A list of maps representing each player, where each map contains the player's name and their online status.
 * @return The number of players who are currently online.
 *
 * Example:
 * val playerList = listOf(mapOf("name" to "Player 1", "online" to true), mapOf("name" to "Player 2", "online" to false), mapOf("name" to "Player 3", "online" to true))
 * countPlayersOnline(playerList) => 2
 */
fun countPlayersOnline(playerList: List<Map<String, Any>>): Int {

    var count = 0
    for (player in playerList) {
        if (player["online"] == true) {
            count++
        }
    }
    return count
}
/**
 * Given a list of players, count the number of players who are currently online.
 *
 * @param playerList A list of maps representing each player, where each map contains the player's name and their online status.
 * @return The number of players who are currently online.
 *
 * Example:
 * val playerList = listOf(mapOf("name" to "Player 1", "online" to true), mapOf("name" to "Player 2", "online" to false), mapOf("name" to "Player 3", "online" to true))
 * countPlayersOnline(playerList) => 2
 */
fun countPlayersOnline(playerList: List<Map<String, Any>>): Int {
/**
 * Given a list of players, count the number of players who are currently online.
 *
 * @param playerList A list of maps representing each player, where each map contains the player's name and their online status.
 * @return The number of players who are currently online.
 *
 * Example:
 * val playerList = listOf(mapOf("name" to "Player 1", "online" to true), mapOf("name" to "Player 2", "online" to false), mapOf("name" to "Player 3", "online" to true))
 * countPlayersOnline(playerList) => 2
 */
fun countPlayersOnline(playerList: List<Map<String, Any>>): Int {

    var count = 0
    for (player in playerList) {
        if (player["online"] == true) {
            count++
        }
    }
    return count
}