Giter Site home page Giter Site logo

slack-tic-tac-toe's Introduction

Slack Tic Tac Toe

Slack app built with Node.js and Express to play tic tac toe using Slack's slash commands

Valid slash command parameters:

/ttt help - displays all valid /ttt commands

/ttt play @username - starts a new game with the opponent

/ttt move # - moves to spot # on the board

/ttt status - displays the current game state

/ttt end - ends the current game

App Setup:

  1. Create and install a Slack App into your workspace. More info at Slack's API site
  2. Modify the .env file to include your Slack App settings
  3. Deploy this app to your own server or use a hosting service such as Heroku
  4. Launch the app with the command node app.js
  5. Add the /ttt slash command to your Slack App and point it to this app's URL + '/commands'

App Architecture:

######Game Manager: The Game Manager class contains in-memory objects that maintain a list of users in the workspace and the current active channel games. There exists only a single instance of the Game Manager that is instantiated in app.js.

######Commands: Valid command parameters such as /ttt play and /ttt move are routed by app.js to their respective command handler functions implemented in /commands. These handlers manipulate and extract the current game state by accessing Games via the Game Manager's API.

######Game:

The Game class maintains the state of an active game in a given channel, including the participating players User Id's and the current state of the tic tac toe board. Additionally, the Game class contains methods that implement the logic of tic tac toe. At all times, there can only exist at most one Game object for a given channel.

Potential Improvements:
  • Database integration to persist app state
  • Frequent updates to the list of workspace users and the users in each channel*
  • Logic to require a user to first accept a 'challenge' before the game can commence
  • Buttons instead of emojis to allow users to select their move
  • Comprehensive unit testing and error checking for malformed inputs

*Currently the list of workspace users is populated only once when the app is first deployed. Moreover, the current implementation only validates that the opponent specified in /ttt play @username is a member of the workspace, and not the channel as well.

slack-tic-tac-toe's People

Contributors

salemohamedo avatar

Watchers

James Cloos 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.