📜 ⬆️ ⬇️

Sandbox for programmers

Hi, Habrahabr!

I want to play a game with you.


')
But to be precise, I want to present to you the result of my work over the past couple of months. The code name is a sandbox.

What is it?


The essence of this system is simple: it is a sandbox for programmers. Here you can and should write artificial intelligence for your bots and play with bots of other participants. What to play? It's simple - a fool. Yes, yes, a card game.

This system has grown from a small project to study permishenov in Java. Initially, I was just wondering how the delineations of the executable code work, how the plug-in architecture is built, etc. But in the end I wanted to wrap it all in a finished product - that's how it all happened.

Who cares, let's take a closer look at the system itself.

First of all, I want to say that all of the below can be found on the Intro page in the system itself. There is also more or less complete guidance, it will allow to overcome the already low threshold of entry. I also want to note that the project stage is MBT, but this in no way affects the functionality. Everything planned for release is already on board. Ahead just finish the hotelok and polishing.

How does the system work?


The life cycle of the player is very simple. After registering and activating your account *, you have access to all functions of the system. And now you, as a player, can write, compile and load your bot.

After loading, a round occurs against the system itself. This is called qualification. The only goal is to check the bot code for lice. If a bot does not play honestly or does not know how to play, and maybe even tries to cheat, it automatically receives a penalty and cannot continue to play. To continue it, you need to fix it and re-fill it.

Following the qualification bot can already participate in the tournament. Players for the tournament are selected according to the Swiss system. Games are held every hour. The tournament lasts a week. Results are summed up every Sunday. Points are distributed according to the Elo rating formula. And the first three falls into the history of tournaments. For all the winners there is a summary - Hall of Fame.

* Please note here that Google activation letters may be marked as spam. Unfortunately, this problem could not be overcome. DNS set up in full, but still, for reasons I do not understand, trust is not up to par.

How to use?


Interface


I think it would be superfluous to comment on the screenshots, so I will try to attract attention with pictures.

Hall of Fame



Tournament History



Player Statistics



Game log (start)



Boot loading form (remember it, this is the entry point to the tournament)



Bot


The code you want to write depends entirely on you. You can implement a simple strategy, like the opponent in the qualifying round, and you can develop your own. For writing you need: java + maven + editor.

The bot interface itself contains only two methods, which the system pulls alternately during the game, depending on the role of the player. The object that arrives at the input to each of the methods contains all the necessary information about the current state of the game, and on its basis it is necessary to draw conclusions and make moves.

public interface Ai { /** * Called by executor every move when your role is Attacker * @param table cards on the table * @return attacking card */ Card onAttack(Table table); /** * Called by executor every move when your role is Defender * @param table cards on the table * @return defending card */ Card onDefence(Table table); } 


What for?


For you, this is a way to compete. After all, it's not like every programmer, but even every person likes to compete and prove his primacy.

For me, this is the experience of supporting the system in production. I hope the knowledge gained will allow us to further develop what we have begun (if of course it will be interesting).

Where to play?


Ssylochka here - sandbox.x-lab.space

Hosting is not fancy, so at the same time and the provider will check whether it can withstand the phenomenon called habraeffektom.

Thank you all for your attention. I am waiting for your questions, feedback and constructive criticism, for me it is important.

PS


If you made a mistake with a hub or a resource (I thought myself much better, here or at geektimes), tell me, I will transfer.

Source: https://habr.com/ru/post/280914/


All Articles