Skip to content

Commit 2e4b7e4

Browse files
authored
Create Palantir-Terrain-Classification.py
1 parent a2195bd commit 2e4b7e4

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
9+
10+
11+
#
12+
# Complete the 'findTerrainTypes' function below.
13+
#
14+
# The function is expected to return a STRING_ARRAY.
15+
# The function accepts following parameters:
16+
# 1. 2D_INTEGER_ARRAY elevations
17+
# 2. 2D_CHARACTER_ARRAY features
18+
#
19+
20+
def findTerrainTypes(elevations, features):
21+
# Write your code here
22+
if elevations == [] or features == []:
23+
return []
24+
25+
def detect_river(elevations, features):
26+
# rivers move
27+
# rivers are connected to bigger pools of water
28+
29+
# rivers have elevation descending downwards
30+
pass
31+
def detect_highland(elevations, features):
32+
# highlands have a very high elevation without any "drops"
33+
pass
34+
def detect_waterfall(elevations, features):
35+
# waterfalls are just like rivers, they have a sudden steep drop
36+
pass
37+
def detect_cliff(elevations, features):
38+
# cliffs are just like highlands however they have a sudden steep drop
39+
pass
40+
def detect_lake(elevations, features):
41+
# lake has a very similar elevation throughout
42+
pass
43+
def detect_beach(elevations, features):
44+
# beach has sand and water
45+
pass
46+
def detect_forest(elevations, features):
47+
# forest just has a bunch trees
48+
pass
49+
50+
terrain_types = []
51+
if detect_river(elevations, features):
52+
terrain_types.append("river")
53+
if detect_highland(elevations, features):
54+
terrain_types.append("highland")
55+
if detect_cliff(elevations, features):
56+
terrain_types.append("cliff")
57+
if detect_lake(elevations, features):
58+
terrain_types.append("lake")
59+
if detect_beach(elevations, features):
60+
terrain_types.append("beach")
61+
if detect_forest(elevations, features):
62+
terrain_types.append("forest")
63+
return terrain_types
64+
65+
if __name__ == '__main__':

0 commit comments

Comments
 (0)