Giter Club home page Giter Club logo

bubbletea-tictactoe's Introduction

Tic Tac Toe!

Command line demo app built using Bubbletea for playing tic tac toe in the command line!

Currently, it is playable with a friend, over a simple TCP connection.

Player X Player O

Getting started

TODO: write this part.

TODO:

  • initialize connection in main before starting the game
  • randomly decide between X and O
  • handle the TCP moveMsg in Update
  • block playing when it's not your turn
  • add sending of the message upon playing a move
  • add bottom panel to View printing the player and playerTurn
  • detect and report a tie
  • add getting started

Advanced features

  • enable standalone mode
  • add the other players cursor
  • send cursor moves to the other player
  • receive cursor moves and move the cursor
  • have real random X, O assignment*
  • detect a tie even sooner (if it not possible for either side to win)

*Each player chooses a nonce, sends the hash to the other, once the player receives the hash, sends its nonce, receives the opponent's nonce, it checks if the hash is from the received nonce, (nonce1 + nonce2) % 2 == 0 -> X else O

Refactoring

  • make View use StringBuilder
  • extract "x" and "o" as constants
  • decide which functions should be model's methods and which should be standalone
  • make each model's method change only one model property (meaning extract switchPlayer as a method and don't make handlePlayerEnter do it)
  • add more log statements
  • don't send moves when no action was taken
  • capitalize x and o to X and O

bubbletea-tictactoe's People

Contributors

vedrankolka avatar vedran-kolka avatar

Watchers

 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.