GithubHelp home page GithubHelp logo

heal's Introduction

Elixir Game

All files/commits are also hosted on Github here.

Files

All source code is located in the game directory. Inside of that folder, there is a folder named lib that contains all of the code for the project (the purpose of each file is detailed in the writeup). There is an additional folder called test that has a number of files for unit tests. There's also a config folder which came with the Mix project (I didn't touch it), and a build folder that contains the compiled binaries for the project.

The other directories are self-explanatory: proposal contains the documents of the proposal and the writeup, and client contains a simple Python program that will query the elixir server and give a constantly-updated view of everyone's health (including the boss's, whose name is Charlie) to help with playing the game.

Running

The project uses no external Elixir libraries, since it's pretty simple, but it does require the Elixir compiler itself, and the build tools that come with it. Those can be acquired with brew install elixir or apt-get install elixir or from the Elixir website.

Then, in order to compile the project, you cd into the game directory and run mix compile, which will store the binaries in the aforementioned build folder. Then, mix run will start up the Elixir server, and it'll be available to log into.

Playing

The game is very simple, since making it intricate or particularly engaging wasn't really the point of the project. Once the server is running, you can log in by using telnet 127.0.0.1 6666, which should give you a shell for the game, and then make a new player for yourself using signup $name with $name being your character (no spaces).

Then, you can submit a heal command as $name heal $target $amount, with $target being the name of the person you'd like to heal, and $amount being some integer (higher numbers means more healing, and there's no downside -- not a very balanced game). Or, you can spend your time damaging the boss, by typing $name damage $amount, in a similar way. Balance is important, since the boss does a damaging "stomp" every 10 seconds. You can also heal the boss, Charlie, but it's not recommended.

Other commands include:

  • status, which outputs a mapping of all player names and their current HP values
  • kill $name, which kills the process belonging to player $name. Since the process is immediately restarted, this has no effect :)

Note, the game isn't very robust, because I wanted to spend more time getting the message-passing and supervision protocols right. This means that some simple things, like having multiple "healing" moves of varying power or players "dying" once they reach 0 health, aren't implemented.

Testing

To run the unit tests, just comment out line 16 of mix.exs (sorry, it's to make sure the program gets on with the tests and doesn't wait around listening for telnet connections) so that it looks like the following:

def application do
	[
		# mod: {GAME, []},
		extra_applications: [:logger]
	]
end

Then, just run mix test --trace to see all the tests (hopefully) pass.

heal's People

Contributors

pickledish avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.