Panaxeo Coding Arena

Competition

Competition •

Join our virtual coding contest.
Boost your ego, win cool prizes and have fun. 

Rules, tl;dr:

  • Welcome to our annual coding competition.

  • This time, your task is to code the most efficient Battleship player

  • Open to all! (No trolls, though.)

  • Player categories: Panaxeans, Juniors, Seniors

  • Deadline: 15 Dec 2023, 23:59

Prizes

Panaxeans

The best Panaxean gets €400 worth of hardware of their choice + a personal poster + eternal glory in our Hall of Fame

Juniors

The best Junior gets a year-long Skillmea membership + awesome merch

Seniors

The best Senior gets a Nintento Switch + awesome merch

Panaxeo Icon Logo

Welcome to the Coding arena

Coding Arena is a Panaxeo tradition. Every year, we measure our egos coding skills. For the second time in forever, it’s open to the public! Y’all are very welcome to enter!

This year is all about Battleships. Your goal is to win 200 matches and destroy all enemy ships by firing at coordinates in a square mesh. Unfamiliar with the basic rules of this game? Let us google that for you.

Login below, get your API token and start playing battleships with us.

Panaxeo Icon Logo

How to play?

You start a game by firing at coordinates. A new match starts immediately after the previous one ends.

You fire with API calls described below (/fire/<x>/<y>). The game ends after 200 matches.

You can play 20 games. 200 matches = 1 game. You can reset a current match series, which still counts as 1 game.

The opponent’s fleet:
Avengers Helicarrier (9 spaces), Carrier (5 spaces), Battleship (4), Destroyer (3), Submarine (3), and Patrol Boat (2).


Score and leaderboard

The total score is the number of rounds it took you to finish all 200 matches. The lower the number, the better. With more games, only the best game counts towards the final score.

There’s a twist, though

  • An Avengers Helicarrier™ has been stolen! (Along with those other ships.) When you destroy it, you’ll release the captured Avengers. One of them can help you with their unique abilities.

  • Thor can reveal 11 spaces at once with his lightning. The one you’re firing at + 10 random spaces. All in a single round.

  • Hulk can sink a whole ship at once. If you fire at a space with an actual ship and ask Hulk for help, he’ll destroy the entire ship.

  • Iron Man will use his scanners to reveal the smallest undiscovered ship.

  • You can use an Avenger ability in the next round immediately after destroying the Helicarrier. Only one Avenger is available per match, only once.

Board Placement Rules

The board is 12x12 spaces. The ships can only be placed vertically or horizontally. Diagonal placement is not allowed. No part of a ship may hang off the edge of the board. Ships may not overlap each other. No ship may be placed on another ship. No ship can touch another ship, not even diagonally. Once the guessing begins, the players may not move the ships.

Enter
the Coding Arena

Current
Leaderboard

The Battleship API

Endpoints


Getting the status of an ongoing game 📋


GET /fire
Path parameters

None

Query parameters
name allowed value required description
test yes false Query will be performed on test data for simulation, no change to real game data, user score / number of tries etc.
Headers
name type data type description
Authorization Bearer token string Authorization token copied from the UI
Responses
http code content-type response
200 application/json; charset=utf-8 FireResponse
400 application/json; charset=utf-8 {"error": "Max tries already reached"}
400 application/json; charset=utf-8 {"error": "Invalid query parameter or query parameter value supplied"}
403 application/json; charset=utf-8 {"error": "Unauthorized"}
Example cURL
 curl --request GET --url https://europe-west1-ca-2023-dev.cloudfunctions.net/battleshipsApi/fire --header 'Authorization: Bearer $token'

Firing at specified position 🎯


GET /fire/:row/:column
Path parameters
name data type required description
row integer true vertical position on the board from range [0,11]
column integer true horizontal position on the board from range [0,11]
Query parameters
name allowed value required description
test yes false Query will be performed on test data for simulation, no change to real game data, user score / number of tries etc.
Headers
name type data type description
Authorization Bearer token string Authorization token copied from the UI
Responses
http code content-type response
200 application/json; charset=utf-8 FireResponse
400 application/json; charset=utf-8 {"error": "Max tries already reached"}
400 application/json; charset=utf-8 {"error": "Invalid values for row or column"}
400 application/json; charset=utf-8 {"error": "Invalid query parameter or query parameter value supplied"}
403 application/json; charset=utf-8 {"error": "Unauthorized"}
Example cURL
 curl --request GET --url https://europe-west1-ca-2023-dev.cloudfunctions.net/battleshipsApi/fire/:row/:column --header 'Authorization: Bearer $token'


Firing at specified position with help of avenger 🦸‍♂


GET /fire/:row/:column/avenger/:avenger
Path parameters
name data type required description
row integer true vertical position on the board from range [0,11]
column integer true horizontal position on the board from range [0,11]
avenger string true use the power of specified avenger (hulk, ironman or thor)
Query parameters
name allowed value required description
test yes false Query will be performed on test data for simulation, no change to real game data, user score / number of tries etc.
Headers
name type data type description
Authorization Bearer token string Authorization token copied from the UI
Responses
http code content-type response
200 application/json; charset=utf-8 AvengerFireResponse
400 application/json; charset=utf-8 {"error": "Max tries already reached"}
400 application/json; charset=utf-8 {"error": "Invalid values for row or column"}
400 application/json; charset=utf-8 {"error": "Invalid value for avenger"}
400 application/json; charset=utf-8 {"error": "Avenger unavailable"}
400 application/json; charset=utf-8 {"error": "Invalid query parameter or query parameter value supplied"}
403 application/json; charset=utf-8 {"error": "Unauthorized"}
Example cURL
 curl --request GET --url https://europe-west1-ca-2023-dev.cloudfunctions.net/battleshipsApi/fire/:row/:column/avenger/:avenger --header 'Authorization: Bearer $token'

Reset ongoing game ↻

Calling this endpoint results in resetting the ongoing game, but your attempt will be counted as one full game without saving the score.



GET /reset
Path parameters

None

Query parameters
name allowed value required description
test yes false Query will be performed on test data for simulation, no change to real game data, user score / number of tries etc.
Headers
name type data type description
Authorization Bearer token string Authorization token copied from the UI
Responses
http code content-type response
200 application/json; charset=utf-8 {"availableTries": number }
400 application/json; charset=utf-8 {"error": "Max tries already reached"}
400 application/json; charset=utf-8 {"error": "No ongoing game found"}
400 application/json; charset=utf-8 {"error": "Invalid query parameter or query parameter value supplied"}
403 application/json; charset=utf-8 {"error": "Unauthorized"}
Example cURL
 curl --request GET --url https://europe-west1-ca-2023-dev.cloudfunctions.net/battleshipsApi/reset --header 'Authorization: Bearer $token'


Response models


FireResponse


Model details
name data type description
grid string 144 chars (12x12 grid) representing updated state of map, '*' is unknown, 'X' is ship, '.' is water.
cell string Result after firing at given position ('.' or 'X'). This field may be empty ('') if player calls /fire endpoint or tries to fire at already revealed position.
result boolean Denotes if fire action was valid. E.g. if player calls /fire endpoint or fire at already revealed position, this field will be false.
avengerAvailable boolean Avenger availability after the player's move.
mapId integer ID of the map, on which was called last player's move. This value will change when player beats current map.
mapCount integer Fixed number of maps which are required to complete before completing one full game.
moveCount integer Number of valid moves which were made on the current map. Invalid moves such as firing at the same position multiple times are not included.
finished boolean Denotes if player successfully finished currently ongoing game => if player completed mapCount maps. Valid move after getting true in this field results in new game (or error if player has already achieved max number of tries).
Example
{
    "grid": "*...**********************XX.**********************************.***********.***********.***********************************************.********",
    "cell": "X",
    "result": true,
    "avengerAvailable": false,
    "mapId": 0,
    "mapCount": 2,
    "moveCount": 10,
    "finished": false
}


AvengerFireResponse


Model details

AvengerFireResponse includes all the fields from FireResponse and adds the following

name data type description
avengerResult {mapPoint: {x: integer, y: integer }, hit: boolean}[] mapPoint's values x (row) and y (column) denote coordinates which were affected by avenger ability. Value of hit denotes, if coordinates specified by mapPoint have hit a ship.
Example
{
    "grid": "*...**********************XX.****..****************************.***********.***********.***********************************************.********",
    "cell": ".",
    "result": true,
    "avengerAvailable": false,
    "mapId": 0,
    "mapCount": 2,
    "moveCount": 12,
    "finished": false,
    "avengerResult": [
        {
            "mapPoint": {
                "x": 9,
                "y": 2
            },
            "hit": false
        }
    ]
}

Panaxeo Icon Logo

Frequently asked
questions

We've got a partner.
They'll help you code better.

We are required to put the official competition rules here in a special document.
Read it if you’d like. (Slovak).

Any questions?