Git Product home page Git Product logo

tictactoe's Introduction

Library update status: Dependency Status (Powered by VersionEye)

Groovy/Gradle Tic Tac Toe project

This is a simple Tic Tac Toe project implemented (mostly) in Groovy (in fact it is a so called Groovlet). The project can be build and executed with Gradle.

Start

You may simply check out the project from GitHub and run the command

gradlew jettyRun

This will load all necessary stuff from the Internet, compile everything and start a Jetty Servlet Engine on localhost (Port 58080, Context /tictactoe-web).

HTTP Get Requests

Now you can connect your browser to http://localhost:58080/tictactoe-web/simple.groovy and see what happens.

The application understands a number of commands as HTTP Get Requests. Simply use the URL encoded CMD parameter, e.g. http://localhost:58080/tictactoe-web/simple.groovy?CMD=HELP:

Error handling

The simple.groovy implementation only provides restricted error handling, it only checks whether

  • a CMD is valid
  • a field is already occupied
  • a coordinate is valid
  • a stone value is valid

Output formats

Per default the simple implementation returns a single line with the Board (only used fields with their contents) or an error or other status. Only for the HELP command you will see some more lines. If the optional parameter FORMAT is set to HTML the result is sent in very simple HTML code (please, don’t validate!).

Session handling/Cookies

Since the implementation is Groovlet (the Groovy variant of Java Servlets) based, it make use of a JSESSIONID cookie to allow for multiple users to play a game on their own.

Variants

Currently there is only the simple.groovy implementation which just provides a Board and only checks that there is only one stone on a field – Nothing else!
Feel free to improve and implement other variants, e.g.,

  • HTML pretty printer which will draw a nice 3×3 playground
  • Forms or JavaScript to place stones
  • Computer player
  • URL encoded session handling
  • Socket variant
  • Plain Java

Runtime environments

The implementation has been tested on different runtimes:

tictactoe's People

Contributors

ascheman avatar msteiger avatar srose avatar deracker avatar thliedtk avatar

Stargazers

 avatar

Watchers

James Cloos avatar Sebastian J. avatar  avatar  avatar

Forkers

thliedtk

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.