deblasis / saga-alien-invasion

SAGA "Alien Invasion"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Alex's Saga Alien Invasion

Build and Tests

This repository contains the source-code of the saga-alien-invasion CLI.

Demo

Demo.mp4

Usage

saga-alien-invasion [number of aliens invading] [flags]

Flags

  -h, --help                     help for saga-alien-invasion
      --mapfile string           the file containing the map of the 🌍, [relative path] (default "map.txt")
      --maxTurns int             the number of turns before the mothership calls the aliens back home and the program ends (default 10000)
      --numAliensForBattle int   the number aliens required to start a battle that will end up destroying a city (default 2)
      --verbose                  if True, sets the loglevel to show DEBUG messages

Documentation

In this repository we leverage GoDoc and Docker, in order to view a self-hosted GoDoc site, run:

make godoc

and navigate to http://localhost:6060/pkg/github.com/deblasis/saga-alien-invasion/

Run the application

You have a few options, Dockerized executable or compiled locally

Dockerized

You just have to build the container image with

make docker/build

and then execute the command

docker run deblasis-saga-alien-invasion saga-alien-invasion [number of aliens invading] [flags]

If you want to pass in a different map that's on your filesystem you can do that using a volume, something like:

docker run -v $(pwd)/anothermap.txt:/go/src/github.com/deblasis/saga-alien-invasion/map.txt deblasis-saga-alien-invasion saga-alien-invasion [number of aliens invading] [flags]

if you know your way around Docker there are other ways too! Feel free to PR a documentation change if this step can be simplified/improved in your opinion ;)

Compiled

make build
./saga-alien-invasion [number of aliens invading] [flags]

Run from source with logging for debug/dev purposes

go run ./... X --verbose

where X is the number of aliens you want to spawn

Tests

make test

and

make test/nocache

to make sure that there is no smoke and mirrors with the random stuff

Coverage
make test/cover

and then navigate to http://localhost:8080/

About

SAGA "Alien Invasion"


Languages

Language:Go 97.6%Language:Makefile 2.0%Language:Dockerfile 0.4%