# Tisbury Treasure Hunt Welcome to Tisbury Treasure Hunt on Exercism's Gleam Track. If you need help running the tests or submitting your code, check out `HELP.md`. If you get stuck on the exercise, check out `HINTS.md`, but try and solve it without using those first :) ## Introduction ## Tuples A tuple is an ordered container of values. Like all Gleam data types tuples are immutable. Each element of a tuple can be of a different type -- they can even be other tuples. Tuples are defined as comma-separated values between `#(` and `)`: `#(1, 2.0, "Three")`. ```gleam #("one", 2) // Tuple pair (2 values) #("one", 2, 3.0) // Tuple triplet (3 values) ``` Tuples with the same length and the same types (in the same order) can be compared for equality. ```gleam #(1, 2) == #(1, 2) // Same length, same types, same values, same order // -> True #(1, 2) == #(2, 1) // Same length, same types, same values, different order // -> False #(1, 2) == #(1, "2") // Same length, different types // Compile error! #(1, 2) == #(1, 2, 3) // Different length // Compile error! ``` There are three ways in which you can get the contained values out of a tuple: - Indexing. - Pattern matching with `let`. - Pattern matching with `case`. ```gleam let person = #("Jordan", 170) // Option 1: Indexing person.0 // -> "Jordan" person.1 // -> 170 // Option 2: let let #(name2, length2) = person // -> name2 = "Jordan" // -> length2 = 170 // Option 3: case case person { #(name3, length3) -> { name3 // -> "Jordan" length3 // -> 170 } } ``` ## Instructions Aazra and Rui are designing a pirate-themed treasure hunt. There is a list of treasures with map locations, the other a list of place names with map locations.
| Azara's List | Rui's List | |
|---|---|---|
| | Treasure | Location | | --------------------------- | -------- | | Amethyst Octopus | (1, F) | | Angry Monkey Figurine | (5, B) | | Antique Glass Fishnet Float | (3, D) | | Brass Spyglass | (4, B) | | Carved Wooden Elephant | (8, C) | | Crystal Crab | (6, A) | | Glass Starfish | (6, D) | | Model Ship in Large Bottle | (8, A) | | Pirate Flag | (7, F) | | Robot Parrot | (1, C) | | Scrimshaw Whale's Tooth | (1, F) | | Silver Seahorse | (4, E) | | Vintage Pirate Hat | (7, E) | | | Place Name | Location | Quadrant | | ------------------------------------- | -------- | -------- | | Seaside Cottages | (C, 1) | Blue | | Aqua Lagoon (Island of Mystery) | (F, 1) | Yellow | | Deserted Docks | (A, 2) | Blue | | Spiky Rocks | (D, 3) | Yellow | | Abandoned Lighthouse | (B, 4) | Blue | | Hidden Spring (Island of Mystery) | (E, 4) | Yellow | | Stormy Breakwater | (B, 5) | Purple | | Old Schooner | (A, 6) | Purple | | Tangled Seaweed Patch | (D, 6) | Orange | | Quiet Inlet (Island of Mystery) | (E, 7) | Orange | | Windswept Hilltop (Island of Mystery) | (F, 7) | Orange | | Harbor Managers Office | (A, 8) | Purple | | Foggy Seacave | (C, 8) | Purple | |