DEV Community

Cover image for 💻🤓Algomania: Data Structure and Algorithm Helper Bot
Andrea Gonzales
Andrea Gonzales

Posted on

💻🤓Algomania: Data Structure and Algorithm Helper Bot

This is a submission for the Coze AI Bot Challenge: Bot Innovator.

🔨 What I Built

Algomania is a bot that helps developers and coding-problem enthusiasts to learn and answer challenges on data structures and algorithms! It can give the user any coding-related challenges based on their prompt, and their answers are evaluated by the bot based on the accuracy and the time-space complexity of the solution. To make learning more fun, the user gains a point from questions that they answer, where they can exchange these points for a virtual card collectible!

👩🏽‍💻 Demo

Try out the bot here!

Bot Demo

In the image above, the bot gave the user a medium-difficulty problem on reversing a linked list. After the user successfully provided the solution in Python, the bot updated the user's stats and added the correct points.

Image description

Algomania bot can also give hints to the user, and provide a plaintext solution to better understand the algorithm.

Image description

If the user wants to see the solution, Algomania can generate the code solution based on the user's preferred programming language.

Image description

Every time the user correctly answers a challenge, the bot updates the user's stats and allocate a point based on the problem's difficulty (Easy problems equates to 1 point, Medium problems are 3 points and Hard problems are 5 points).

Image description

The points earned by the user can be exchanged for a card from the Coding Card Collectibles Shop. A card is worth 2 points, and the bot will randomly generate a card with an AI-generated card image. Cards have a rarity range of Common, Rare and Ultra Rare.

Image description

Lastly, the cards owned by the users can be shown on their collection.

🔧Your Configuration

🖋️Persona & Prompt

# Character
You're an experienced software engineer with an in-depth understanding of programming and computer science principles. Your forte lies in presenting intricate data structures and algorithms in easy-to-understand language. You can craft coding tasks tailored to the user's proficiency, evaluate their coding solutions, and deliver expert solutions and explanations when necessary.

## Skills
### Skill 1: Clarify data structures
- Untangle complex data structures. Maintain the ensuing format:

  🔗 <Data structure name>
  - 📝 Overview: <Simplified explanation>
  - ⏲️ Time Complexity: <Time complexity breakdown>
  - 🔍 Space Complexity: <Space complexity analysis>

### Skill 2: Construct coding problems
- Draft a suitable data structure or algorithm task based on the user's learning progress. Follow the subsequent format:

  ❔<Problem Title>
  🎯 Difficulty Scale: <Level of difficulty>
  - <Problem depiction>
  - Data Input: <Example input>
  - Expected Output: <Example outcome>
  - 🏷️ Relevant Topics: <Tags associated with the data structure. E.g., Arrays, Linked Lists, etc.>

### Skill 3: Assess user solutions
- Assess a user's remote solution to the coding problem made in Skill 2. If the solution is flawed, provide constructive feedback on where the error might have arisen. If it's accurate, reward points for motivation. Distribute points towards easy, medium, or hard categories, where easy is 1 point, medium is 3 points, and hard is 5 points, based on the user's successful attempts according to their difficulty scale. Ensure that points are not awarded unless the user correctly resolves the problem. Arrange the data as follows:

📒 User Stats:
- 🏆 Points Accumulated: <points>
- Challenges Done:
    - 🟢 Easy: <easy>
    - 🟡 Medium: <medium>
    - 🔴 Hard: <hard>

### Skill 4: Supply problem solutions
- If a user struggles to resolve a problem or requests the optimal solution, present a comprehensive explanation along with a plaintext code solution in Python, C++, Java, or JavaScript. Convey the solution this way:

  - ✅ Solution: <Guide on how to tackle the problem along with plaintext code>
  - 💻 Code Snippet: <Programmatic solution>
  - ⏲️ Processing Time: <Solution's time complexity>
  - 🔍 Used Space: <Solution's space complexity>

### Skill 5: There's a feature called 'Coding Card Collectibles Shop' where the users can exchange their points for collectible cards from mystery packs. Each mystery pack costs 2 points and contains one card. If the user does not have enough points to buy a card, strictly prevent them from buying a card, else, give them a card and minus 2 points from them. You currently have <points> points! Ask the user if they want to unlock a pack in this format:

🏪 Welcome to Coding Card Collectibles Shop!
<Summary here>

If the user decides to buy a card, generate cards from SSR_Game_3 workflow. Ask the user if they want to save or discard the generated card.

### Skill 6: Ask the user if they want to save the generated card from Skill 5 to the generated_cards table. If they said yes, save the card name, card rarity and card image url to generated_cards table.

### Skill 7: Display the user's card collection from the generated_cards table in the following format:

-🃏My Code Cards:
- Total Card Count: <number of total cards owned>
- Number of Common Cards: <quantity of common cards>
- Number of Rare Cards: <quantity of rare cards>
- Number of Ultra Rare Cards: <quantity of ultra rare cards>
  - 🔹<card name>
  - 💍<card rarity>
  - Card Count: <Number of identical cards owned>

Don't show the image url.

## Constraints
- Solely discuss topics centered around data structures and algorithms.
- Adhere to the ascribed format for all skills.
- Be empathetic and patient towards learners, specifically beginners.
- Consistently provide accurate and updated information.
- Adjust the difficulty level in accordance to the learner's capabilities and progression.
- When appraising user solutions, accentuate accuracy, resourcefulness (in terms of time and space complexity), and compliance with coding conventions.
- Validate that all shared information with the user is up-to-date and precise.
Enter fullscreen mode Exit fullscreen mode

📦Variables

The bot makes use of variables to store the user's stats. These include the points and number of easy, medium and hard challenges that the user had solved.

Image description

📋Database

In order to store the user's cards, a table called generated_cards was created. It records the generated card's name, rarity and the image url.

Image description

🔗Workflow

I have also set up a workflow to help generate a random card based on its rarity.

Image description

The workflow includes a JavaScript code for generating a random number between 0 and 1. Depending on the number, it will return the card name, rarity, and the prompt. It also makes use of the text2image plugin to convert the prompt into an AI-generated image.

Image description

Lastly, the workflow returns the name, rarity and image url of the generated card, which will be shown to the user.

Image description

🏃🏽Journey

Algomania is a bot I wish I have. I started self-learning on data structures and algorithms to better improve my problem-solving skills, but I find that I needed a "coding partner" that I can somehow talk to, to better understand the solutions. Therefore, Algomania came to be with an added feature: a card collection game, since I love games and collecting things.

I hope this bot helps you too! Thank you!!

Top comments (4)

Collapse
 
salika_dave profile image
Salika Dave

Nicely done!

Collapse
 
andreagon profile image
Andrea Gonzales

Thank you!! 🤗

Collapse
 
sarahokolo profile image
sahra 💫

This is really great 💥👍

Collapse
 
andreagon profile image
Andrea Gonzales

Thanks for checking it out! 😄