Skip to content


this is a retro game you play in the terminal

download python code

or clone it

git clone

when this started

I made this retro game for the portfolio project assignment in the nucamp back end devops bootcamp

this was the first version of random island adventure

it is a python app played in the terminal

this was for the nucamp back end devops course portfolio projects

code layout

├── mods

  • this is how you code when you're a noob
  • this file is a hot mess but it works
  • it does way too much
  • maybe I'll explain it if I ever clean it up :)


  • to start with an island...
  • I made a "map", ironically I wanted to practice using the python built in type map1
  • this could be reused to create a space for any cartesian based game
  • it allows you to move north, south, east and west
# map

def home():
    x, y = 0, 0
    point = (x, y)
    return point

def north(point):
    """move north"""
    y = point[1] + 1
    point = (point[0], y)
    return point

def south(point):
    """move south"""
    y = point[1] - 1
    point = (point[0], y)
    return point

def east(point):
    """move east"""
    x = point[0] + 1
    point = (x, point[1])
    return point

def west(point):
    """move west"""
    x = point[0] - 1
    point = (x, point[1])
    return point


  • the map is infinite
  • this code added borders for north, south, east and west
def check_boundry(x, y):
    """check if x or y are off the map"""
    if x in range(-2, 3) and y in range(-2, 3):
        return 0
    elif x > 2:
        text = "you REACHED THE OCEAN and cannot move further east"
        return text
    elif x < -2:
        text = "you REACHED THE OCEAN and cannot move further west"
        return text
    elif y > 2:
        text = "you REACHED THE OCEAN and cannot move further north"
        return text
    elif y < -2:
        text = "you REACHED THE OCEAN and cannot move further south"
        return text

drawing the map (compass feature)

  • later I added a compass that reveals the map
  • this draws the draw a map
  • this also provided a visual way to debug during development
def draw_row(coordinate, column):
    drawing = ""
    for x in range(-2, 3):
        if coordinate[0] == x and coordinate[1] == column:
            drawing += " X"
            drawing += " ."
    return drawing

def draw_grid(coordinate):
    for x in "abcde":
        if x == "a":
            print(draw_row(coordinate, 2))
        elif x == "b":
            print(draw_row(coordinate, 1))
        elif x == "c":
            print(draw_row(coordinate, 0))
        elif x == "d":
            print(draw_row(coordinate, -1))
        elif x == "e":
            print(draw_row(coordinate, -2))

map coordinate stack2

  • to make this a random island adventure, a treasure and disaster gets dropped on the map
  • it was possible that they both land on the same location
  • or even land on 0,0 where the player starts
  • so I created a stack to store and validate used coordinates
class UsedCoordinates:
    def __init__(self):
        self.items = []

    def size(self):
        return len(self.items)

    def use(self, item):

    def remove(self):
        if self.size() == 0:
            return None
        return self.items.pop(0)

    def validate(self, item):
        if item in self.items:
            # print('coordinate in use')
            return 1
            # print('coordinate available')
            return 0

    def used_coordinates(self):
        return self.items


I wanted to be able to plug these into other games so I put everything in mods/

in case later I make different themes, like a survival based hunt and gather game, or a crafty creative mode game, etc.


this tracks the player


games are for winning


games are less fun if you always win, this is basically a copy of treasure


for giggles


the only feature I actually implemented with items is the compass

if you find the compass, the map gets drawn

the idea with this was to tie it to but that hasn't happened yet


wip: later I'll do the typical game move, npcs give you quests, to go collect items, and return a reward...

Last update: February 5, 2023
Created: February 5, 2023