"Oh yes. It runs on the world’s most powerful graphics chip, imagination" – Dc. Sheldon Cooper
I have improve this exercise adding a server layer and starting what is could be a console client layer.
- clean up and stabilize the client layer.
I also would like to work on:
- Persistence layer
But I'm afraid I am going out of time so I prefer to focus in finish the client layer and clean up everything
I have defined the most basic 3 layers needed for the game.
Each one of them is intentioned to be release as independent gem but for a more agile development I think is better to have them all together.
I have separate each one of them in a subfolder of the project:
gem folder we have all the elements that implements the business logic of the game.
- The models
- The surrounding Universe
- The infinite loop
The server initialize an Universe, starts it and exposes it to network request through a REST API.
cd server ruby bin/s2c_server.rb
- show universe: get "/universe"
- show planets: get "/universe/planets"
- show ships: get "/universe/ships"
- show planet: get "/universe/planet/:name"
- create planet: post "/universe/planet?name="
- build mine: post "/universe/planets/:name/mines"
- build ship: post "/universe/planets/:name/ships"
- travel: post "/universe/ships/:identity/travel?planet_name="
Please don't make a review of this part of the code since I just have write on the air and just to have something to use to interact with the server layer.
First you have to initialize the server.
cd client ruby bin/s2c_console.rb
You can check this command session, it is for the stand alone version but it should work just the same.