Coder Social home page Coder Social logo

etimo / diamonds Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 7.0 4.03 MB

Program a bot and compete to get the highest score ๐Ÿค– ๐Ÿ”ท

Home Page: http://diamonds.etimo.se/

License: MIT License

C# 42.21% HTML 0.91% CSS 2.08% JavaScript 33.19% Python 9.52% Shell 0.72% Java 11.08% Dockerfile 0.28%
bot bot-framework competition competitive-programming game maze-game

diamonds's People

Contributors

alexanderhenne avatar chargedpeptide avatar etimooscarnylander avatar indrif avatar jens-peterolsson avatar joakim-olesen avatar mihini avatar miniwa avatar niclaslindstedt avatar nightkr avatar sirscratchalot avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

diamonds's Issues

Able to register new bots with existing email/name when using MemoryStorage

Example run:

POST /bots {'name': 'Testbot', 'email': '[email protected]'}
<<< 200 {"id":null,"name":"Testbot","email":"[email protected]","token":"c1bb670c-fb46-4203-a96c-c669eebc1b90","boardToken":null}
Received token c1bb670c-fb46-4203-a96c-c669eebc1b90
POST /bots {'name': 'Testbot', 'email': '[email protected]'}
<<< 200 {"id":null,"name":"Testbot","email":"[email protected]","token":"a0d74eed-5cd4-4d5f-a3c8-6cdf9b04ab4a","boardToken":null}
Received token a0d74eed-5cd4-4d5f-a3c8-6cdf9b04ab4a

Should receive 409 status from second POST.

Environment:
MemoryStorage

Some kind of throttling for moves

We want to be able to see visually what happens on the board and not allow one bot to perform 1000 moves instantly and overload the api.

Example bot gets stuck

On several occasions the bot has got stuck on the top row constantly trying to move up north. If we can verify and fix this quickly, do it, otherwise it's not critical since it doesn't happen frequently.

Example bot crashes after game over

Receives 403 after trying to move on the board it's no longer a member of =>

Traceback (most recent call last):
File "simple.py", line 147, in
board = Board(result.json())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/models.py", line 892, in json
return complexjson.loads(self.text, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Bot game over logic

When time expires a bot should be given a score and added to high score list. How should this be determined, automatically with timer or by bot calling a /score endpoint or similar?

Highscores should be per board

Now highscores is a global collection from all games on all boards. Not anything to worry about while having one board but it would give a false picture when comparing games from a 10x10 board with 3 players vs a 100x100 board with 20 players.

Register bot

POST to /bots should return a persistent token that can be reused for multiple playing sessions

Duplicate highscore entries

Since each bot is unique we should probably overwrite the bot's previous highscore with the new one (if better).

List of boards

Implement /boards GET

Currently there should always be one active board.

OnBotExpired causes exception

api_1 |
api_1 | Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
api_1 | at Diamonds.Rest.Controllers.BoardsController.<>c__DisplayClass9_0.b__0(BoardBot b) in /app/Diamonds.Rest/Controllers/BoardsController.cs:line 114
api_1 | at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func2 predicate)
api_1 | at Diamonds.Rest.Controllers.BoardsController.OnBotExpire(Object stateObj) in /app/Diamonds.Rest/Controllers/BoardsController.cs:line 114
api_1 | at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
api_1 | at System.Threading.TimerQueueTimer.CallCallback()
api_1 | at System.Threading.TimerQueueTimer.Fire()
api_1 | at System.Threading.TimerQueue.FireNextTimers()

Cleared database and restarted environment. Ran 1 bot for a minute and received exception.

Onboarding information

Some kind of information (perhaps link to github readme) regarding how to get started and where to find implementation information. A link in the game gui?

Update diamond generation logic

Right now we generate new diamonds as soon as one is picked up. We should instead wait until there are only a few left and then generate new ones up to a specific limit.

Join board

Implement POST (or should it be PUT?) /boards/{boardId}/join

Should return board, valid token should also be returned...

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.