#Hangman implementation in Grails# Simple hangman game built in Grails. Restful, returns json, main logic is available through web service Game framework could support variety of games
##Installation##
- Install JDK 7+
- Install Grails 2.4.4
- https://github.com/dekay2323/hangman.git
##Running locally##
- Grails run-app
- Key Entry Points
- Admin user to create games http://localhost:8080/hangman/game/index
- User to start playing a game http://localhost:8080/hangman/gamePlay/index
- JSON
- Admin user to create games http://localhost:8080/hangman/game/index.json
- User to start playing a game http://localhost:8080/hangman/gamePlay/index.json
- Game can be played through URL and JSON http://localhost:8080/hangman/gamePlay/gameTurnLogic/2?guess=a
##TODO## - Word Guess - Spaces are kind of redundant - Front End - Game Domain should have Turns (possibly) - More tests (controllers and rest) - Strange cases, nulls, massive strings - Java doc - Strings used should be in .messages - Handling of special chars not perfect - Retrned object should be interface - GameLogic should be abstract or interface
- Versioning REST resources
- Griffon
- Code Coverage
- Circuit breaker
- Load Test
- Profile
- Async
- Admin console/health
##Development Steps##
-
New Computer
-
Install Grails
-
Install Java
-
Create App
-
Push to Github
-
Branch AddUser
- Install Security Plugin, which gives User, Role, Secured
- Abandon, feels a bit heavy at this point with configuration not goal of assignment
-
Main idea
- /hangman/game/1
- restful interface into game
- front end can be html or other
- game should be generic enough to handle turn based game
- Basical Diagram
-
Build Domain Classes
- Use scaffolding to see them hang together
- Get the basic domain classes correct
-
Fixed H2 bug in logging!
-
Going to rather spike a solution, REPL
- Decent results with regualr expressions, but collections with interesctions and stuffs probably better
-
Lets retry with more functional ideas
- Definitely getting somewhere
-
Abstract factory? Seems quite felxible in this case
- Service or just groovy
-
Sleeping on it: I think I am trying to hard to solve business problems we do not have.
- System does not need to support many games
- Build a good robust system
- Found some nice collection ways of resolving solution problems
- Still try keep state out of it.
- State probably HAS to be in due to picking up saved games (could put solution encrypted into parameter though to avoid state)
- User could just bookmark a game then (still can do this saving answer)
- Saving to database would give nice history of games played etc
- Grails has changed quite a bit
- Playing with new rest controller
- New spock testing
- HTML an JSON version
- Test driven solution
- Get the logic working in a serivice
- Can expose via json rest later
- Least side effects
- Build gameplay controller to play game
DAY 2
-
Uppercase/lowercase should not matter
-
New Grails doc, Groovydoc api, should be using ** Internal debate of typeing method parameters.
- Not needed, allows flexibility, whatever is passed in just needs to implement intersect or whatever function is called upon it.
- More difficult for initial people to pick up, less compiler checking
- Decided to type them
- Power assert method exists ** Add robustness with upfront power asserts, self documenting code is nice!
-
Should add is guess correct
-
Refactor tests to be more modular
-
Robustify tests
- Test for bizarre stuff
- upper lower
- nulls ** Do a version that has upper and lower case differences
-
Adding the dates for win and loose
- Getting win and loose conditions to work ** Any user can play game, game state is saved via URL
- If we had turns could use url /show/1?turn=2
-
SPIKE to figure out how to return clean json instead of all the method calls in the builder
-
Return json for logic
-
Muddling of controllers is unnecessary
#TODOLIST#