تفاصيل العمل

Creating a bot for a coloring game:

Initially, how does the game work and what is its concept?

The game consists of 4 players competing against each other for the first place. Whenever a player moves, they color the area behind them, and their paint supply decreases accordingly.

You can paint your opponents' areas, but in return, your paint supply will be reduced by twice the amount.

Throughout the game, some assistance tools appear in random areas, such as increasing your speed, increasing the amount of paint you can carry, or increasing the area of the circle you are coloring, and so on.

The game ends after the specified time, and the player with the highest winning percentage is the winner.

To create a bot to play this game, we face many challenges. First, it needs to balance between gaining new areas and maintaining its paint supply, as well as between risking and chasing after a distant assistance tool or staying to gain some progress, and between attacking opponents' areas and gaining other areas in a peaceful manner, and so on.

But the first challenge is to determine the path the player will take to reach their goal, because there are obstacles they cannot pass over, and there are areas with a different color, and so on. For this purpose, we used the A* algorithm, which is a famous algorithm for determining paths and is based on the idea of building squares, each of which obtains a value based on how close it is to the goal and how close it is to the starting point.

However, the game has a million pixels, and it is not possible to calculate all this data in a short time using the A* algorithm. Therefore, we resorted to reducing the number of squares by dividing the game into only 400 squares, and thus, the first challenge was solved.

The second challenge:

Since we have programmed the pathfinding algorithm, we now need to write an algorithm to determine the goal, and all we have to do is input it into the pathfinding algorithm. For this purpose, we came up with an idea for comparing between the squares based on calculating a number for each square, and in the end, we choose the square with the highest number. To calculate this number, we take into account some factors, such as:

1- The color of the square

2- The degree of paint for the player

3- The presence of assistance tools

4- The distance of the square from the player

5- The potential danger in the square. less

https://tecyouth123.wixsi...

بطاقة العمل

اسم المستقل Mohamed Y.
عدد الإعجابات 0
عدد المشاهدات 17
تاريخ الإضافة
تاريخ الإنجاز