Project Overview:

Our projects contain feautres relating to certain aspects of the game. There are databases displaying user information, tournaments, news, and also a simulation of deck creation.

What is clash royale?

Clash Royale is a popular mobile strategy game developed by Supercell. In Clash Royale, players build and customize their own decks of cards featuring various characters, and spells. The goal of the game is to destroy your opponent’s towers while defending your own. In a game you need to spend elixer to deploy a card(characters or spells). Throuhgout the game this will regenerate. Elixir is like the energy you use to play cards in battles. You start with a certain amount of elixir, and it gradually fills up over time. Each card you play costs a certain amount of elixir, so you have to budget the cards you deploy. Users create tournaments to compete with one another, and supercell hosts challanges so users can earn rewards. When users when games they gain trophies which contribute to their leaderboard ranking.

My Feature:

My feature displays data from the game clash royale in a easy way the user can interact with. The user can see the leaderboard from any given season, active tournaments, and the current challanges running. All data specific data like, tournament requirments, rewards, players, and player info like, clan, trophies, and rank will be displayed

Meeting College Board Requirments:

Instructions for input from one of the following: the user, a device, an online datas stream, a file:

When a user presses the search button it will send a request to the clash royale api and get data based on what the user asks for. For example if the user searches for season 1, the table will be populated with data for the season 1 leaderboards.

Use of at least one list (or other collection type) to represent a collection of data that is stored and used to manage program complexity and help fulfill the users purpose.

list of data based on user input(season), that contains the information applied to the table

def get_leaderboard():
    season = request.args.get('season', '1')  # Default to season 1 if not specified
    url = f'https://api.clashroyale.com/v1/locations/global/seasons/{season}/rankings/players?limit=10'
    headers = {'Authorization': f'Bearer {API_KEY}'}
    response = requests.get(url, headers=headers)
    if response.ok:
        return jsonify(response.json().get('items', []))  # Send back a list of items

At least one procedure that contirubted to the program’s intened purpose where you have defined: the name, return type, one or more parameters

name: fetch_challanges_ return value: a list of challange data or an error mesage when recieving data

def fetch_challenges():
    url = f"https://api.clashroyale.com/v1/challenges"
    headers = {'Authorization': f'Bearer {API_KEY}'}
    response = requests.get(url, headers=headers)
    if response.ok:
        data = response.json()
        challenges_list = []
        for item in data:
            challenges_list.extend(item.get('challenges', []))
        return jsonify(challenges_list)
    else:
        return jsonify({"error": "Failed to fetch data"}), response.status_code

An algorithm that includes sequencing, selection, and iteration that is in the body of the selected procedure

This iterates throught the list of data and assigns them to a part of the table where it is outputed and displayed.

    data.forEach(function(tournament) {
    $('#tournamentTable tbody').append(`
    <tr>
        <td>${tournament.name}</td>
        <td>${tournament.description}</td>
        <td>${tournament.status}</td>
        <td>${tournament.levelCap}</td>
        <td>${tournament.firstPlaceCardPrize}</td>
        <td>${tournament.capacity} / ${tournament.maxCapacity}</td>
        <td>${tournament.preparationDuration} seconds</td>
        <td>${tournament.duration} seconds</td>
        <td>${new Date(tournament.createdTime).toLocaleString()}</td>
        <td>${tournament.gameMode && tournament.gameMode.id ? tournament.gameMode.id : ''}</td>
        </tr>
        `);

Calls to your student-developed prodcedure:

This takes the tournament the user is searching for and puts that value into the procedure.

$('#searchForm').submit(function(event) {
    event.preventDefault();
    let tournamentName = $('#tournamentName').val();
    fetchTournaments(tournamentName);
    fetchChallenges();
});

Instructions for output (tactile, audible, visual, or ) based on input and program functionality:

This function takes the data recieved and outputs it in the form of a table.

 <div id="tournaments-list">
        <h2>Tournaments</h2>
        <table id="tournamentTable">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Description</th>
                    <th>Status</th>
                    <th>Level Cap</th>
                    <th>First Place Card Prize</th>
                    <th>Capacity</th>
                    <th>Preparation Duration</th>
                    <th>Duration</th>
                    <th>Created Time</th>
                    <th>Game Mode ID</th>
                </tr>
            </thead>
            <tbody>

function fetchTournaments(tournamentName) {
    $.getJSON(`${backendUrl}/tournaments?name=${encodeURIComponent(tournamentName)}`, function(data) {
    $('#tournamentTable tbody').empty();
    data.forEach(function(tournament) {
    $('#tournamentTable tbody').append(`
    <tr>
        <td>${tournament.name}</td>
        <td>${tournament.description}</td>
        <td>${tournament.status}</td>
        <td>${tournament.levelCap}</td>
        <td>${tournament.firstPlaceCardPrize}</td>
        <td>${tournament.capacity} / ${tournament.maxCapacity}</td>
        <td>${tournament.preparationDuration} seconds</td>
        <td>${tournament.duration} seconds</td>
        <td>${new Date(tournament.createdTime).toLocaleString()}</td>
        <td>${tournament.gameMode && tournament.gameMode.id ? tournament.gameMode.id : ''}</td>
        </tr>
        `);
});

Video:

Input to program:

What the user wants to search, shown in video.

At least one aspect of the functionality of your program:

The tournament functionallity shows all active tournaments with a name that the user searched and displays all information in a table.

Output Produced by Program:

A table is generated based on the list of information recieved.

My video does not have:

voice narration, distingushing information

My video is:

a .mp4, less than 1 minute in length, less than 30MB in file size.