Last active
January 3, 2020 19:07
-
-
Save mornir/46d558842c8d0cfcf0bd96a56627af1b to your computer and use it in GitHub Desktop.
GROQ Pokédex Challenges
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find the weakest Pokémon overall | |
*[]{ | |
"overall": base.HP + base.Attack + base.Defense + base["Sp. Attack"] + base["Sp. Defense"] + base.Speed, | |
"name": name.english, | |
}|order(overall)[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Return an array containing all and only the Pokémon names | |
*[].name.english |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Return counts for grass, fire and water types | |
{ | |
"Grass": count(*["Grass" in type]), | |
"Fire": count(*["Fire" in type]), | |
"Water": count(*["Water" in type]), | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Return all water type Pokémon | |
*['Water' in type && length(type) == 1]{ | |
id, | |
"name": name.english, | |
base | |
}|order(base.HP desc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Return the percentage of single type Pokémon | |
{ | |
"percentage": count(*[length(type) == 1]) * 100 / count(*[]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// List the Pokémon based on the number of letters in their English name | |
*[]{ | |
"name": name.english, | |
"length": length(name.english) | |
}|order(length desc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Group the Pokémon in three categories | |
*[]|order(base.Attack){ | |
"name": name.english, | |
"attack": base.Attack, | |
"evaluation": select( | |
base.Attack > 124 => "strong", | |
base.Attack > 83 => "average", | |
"weak" | |
)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment