Giter VIP home page Giter VIP logo

hangman's Introduction

Hangman

A simple hangman game built with Elixir and Phoenix LiveView. In future I would like this to be a game Twitch streamers can play with their viewers.

How It Works

lib/hangman contains all the game-specific code, which is essentially just the Hangman.Game module for now. In future, I would like game state to be stored in a GenServer that can share its data with multiple clients.

lib/hangman-web contains the client code that produces the user interface. page_live.html.leex is the single view that renders different output depending on @game.state. While a game is in progress, @game.guesses is mapped into the buttons that allow the user to guess letters, with simple <p> tags rendered if Map.get(guesses, letter) is true. Interactions with the buttons are handled by page_live.ex, which call Game.guess_letter with the current game object to handle letter guessing.

Deploying is managed by Dokku running on a Digital Ocean Droplet. Every push to the master branch triggers a GitHub Action that deploys the updated code to Dokku.

There is still a lot of cleanup and refactoring that can be done to this code, as I am new to Elixir and functional programming with pattern matching. I aim to work on this project as a service to those who may enjoy it and also to sharpen my skills with Elixir and Phoenix.

hangman's People

Contributors

brendonovich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hangman's Issues

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.