My commits on the passion project

  • I made the entire front page of our website, with the exception of the background, the rain animation, and the clickabke frog that jumps across the screen when you click it. I made the image buttons through an href function and an onclick event which is pretty much the whole home page.
  • I did all the main.py in the backend which was key for linking the frontend and the backend becasue if main.py did not work, the backend site would not run, and the api connection would be impossible. This code sets up routes for different web addresses, defines functions to handle those addresses, and prepares some tasks before the first request is processed.
  • I myself also did the api connection on frontend and backend. I did this through seperate .md files for each frog, and I figured out a way to seperate the data of each frog because the backend website contained all the info on all the frogs so.
  • I also worked of frogs.py which is a model in the backend, this held all the data for the frogs in a db. This db was based on the frog species class I made.
## Buttons
<div>
        <form action="/submit" method="post">
            <button type="button" class="frog-button" id="plains-leopard-frog" onclick="redirectToPlains()">
                <img src="https://www.sdherps.org/media/206.jpg" alt="Plains Leopard Frog" class="frog-image" border="0" />
                <br>
                Plains Leopard Frog
            </button>
        </form>

<script>
            function redirectToPlains() {
                window.location.href = '/FrontendRepo/frog/Leopard';
            }
</script>
</div>
## Main.py
@app.route('/Frogs')  # connects /stub/ URL to stub() function
def Sumaco(): 
    name = request.args.get("name")
    print(name) 
    data={'name': name}  
    return render_template("2023-10-10-Sumaco.html", data=data)

@app.route('/frog')  # connects /stub/ URL to stub() function
def frog():    
    return render_template("frog.html")

@app.before_first_request
def activate_job():  # activate these items 'Flask' object has no attribute 'before_first_request
    initFrogs()
    initJokes()
    initUsers()
    initPlayers()
## API connection

---
permalink: /frog/Leopard
---


<div class="container">
  <div class="table-container">
    <!-- HTML table for displaying data -->
    <table class="hacker-theme">
      <thead>
        <tr>
          <th>Name</th>
          <th>Size</th>
          <th>Habitat</th>
          <th>Predators</th>
          <th>Diet</th>
          <th>Lifespan</th>
          <th>Toxicity</th>
          <th>Funfacts</th>
        </tr>
      </thead>
      <tbody id="result">
        <!-- Data will be populated here -->
      </tbody>
    </table>
  </div>
</div>
<script>
  const apiUrl = "http://localhost:8014/api/frog-items/";
fetch(apiUrl)
  .then(response => {
    if (!response.ok) {
      throw new Error('Network response was not ok');
    }
    return response.json();
  })
  .then(data => {
    const resultContainer = document.getElementById("result");

    data.forEach(Frog => {
      if (Frog.name === "Plains Leopard Frog (Lithobates blairi)") { // Filter by name
        const row = document.createElement("tr");
        row.innerHTML = `
          <td>${Frog.name}</td>
          <td>${Frog.size}</td>
          <td>${Frog.habitat}</td>
          <td>${Frog.predators}</td>
          <td>${Frog.diet}</td>
          <td>${Frog.lifespan}</td>
          <td>${Frog.toxicity}</td>
          <td>${Frog.fun_facts}</td>
        `;
        resultContainer.appendChild(row);
      }
    });
  })
  .catch(error => {
    console.error('Error fetching data:', error);
  });
  </script>

  <style>
/* Add this to your styles.css file or in a <style> tag in your Markdown */

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.table-container {
    overflow-x: auto;
}

table.hacker-theme {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    border: 1px solid #ddd; /* Border color for the table */
    background-color: #f3f3f3; /* Light gray background for the table */
}

table.hacker-theme th, table.hacker-theme td {
    border: 1px solid #ddd; /* Border color for cells */
    padding: 8px;
    text-align: left;
}

table.hacker-theme th {
    background-color: #4CAF50; /* Green background for header cells */
    color: white; /* White text for header cells */
}

table.hacker-theme tr:nth-child(even) {
    background-color: #f9f9f9; /* Background color for even rows */
}

table.hacker-theme tr:hover {
    background-color: #f1f1f1; /* Background color on hover */
}
# Frogs.py
class FrogSpecies(db.Model):
    __tablename__ = "FrogSpecies"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255), unique=False, nullable=False)
    size = db.Column(db.String(255), unique=False, nullable=False)
    habitat = db.Column(db.String(255), unique=False, nullable=False)
    predators = db.Column(db.String(255), unique=False, nullable=False)
    diet = db.Column(db.String(255), unique=False, nullable=False)
    lifespan = db.Column(db.String(255), unique=False, nullable=False)
    toxicity = db.Column(db.String(255), unique=False, nullable=False)
    fun_facts = db.Column(db.String(255), unique=False, nullable=False)
#    image = db.Column(db.String) 
    # db.Column(db.Integer, primaryKey=True)
    def __init__(self, name, size, habitat, predators, diet, lifespan, toxicity, fun_facts):
        self.name = name
        self.size = size
        self.habitat = habitat
        self.predators = predators
        self.diet = diet
        self.lifespan = lifespan
        self.toxicity = toxicity
        self.fun_facts = fun_facts
#        self.image = image

    def to_dict(self):
        return {"name": self.name, "size": self.size, "habitat": self.habitat, "predators": self.predators, "diet": self.size, "lifespan": self.lifespan, "toxicity": self.toxicity, "fun_facts": self.toxicity}
    
    def create(self):
        try:
            # creates a player object from Player(db.Model) class, passes initializers
            db.session.add(self)  # add prepares to persist person object to Users table
            db.session.commit()  # SqlAlchemy "unit of work pattern" requires a manual commit
            return self
        except IntegrityError:
            db.session.remove()
            return None

    def read(self):
        return {
            "id": self.id,
            "name": self.name,
            "uid": self.uid,
            "tokens": self.tokens,
            "password": self._password
        }

    def delete(self):
        player = self
        db.session.delete(self)
        db.session.commit()
        return player
    
    def __str__(self):
        return json.dumps(self.read())

def initFrogs():
    with app.app_context():
        """Create database and tables"""
        db.create_all()
        """Tester records for table"""
        frogs = [
            FrogSpecies(name="Plains Leopard Frog (Lithobates blairi)", size= "Plains Leopard Frogs are medium-sized frogs, typically ranging from about 2 to 3 inches (5 to 7.6 centimeters) in length.", habitat="These frogs are found in a variety of habitats, including grasslands, prairies, wetlands, and semi-aquatic environments. They are native to parts of North America, including the Great Plains region.", predators="Predators of Plains Leopard Frogs may include snakes, birds, larger amphibians, and various small mammals. Additionally, they may face threats from certain invertebrates.", diet="Plains Leopard Frogs are insectivorous and primarily feed on a diet of insects, spiders, and other small invertebrates.", lifespan="The typical lifespan of Plains Leopard Frogs in the wild is around 2 to 4 years, although this can vary based on environmental conditions and predation.", toxicity="Plains Leopard Frogs are not known to be highly poisonous or toxic. They lack the potent skin toxins found in some other frog species.", fun_facts="These frogs get their name from the spots and blotchy patterns on their skin, resembling a leopard's spots. They are known for their distinctive vocalizations during the breeding season, which sound like chuckling laughter. Plains Leopard Frogs are adapted to a variety of terrestrial and aquatic habitats, and they often inhabit grasslands and wetlands with temporary or semi-permanent water bodies. During the breeding season, males call from the water to attract females for mating."),
            FrogSpecies(name="Sumaco Horned Frog (Hemiphractus proboscideus)", size= "The Sumaco Horned Frog is medium-sized, typically reaching a size of around 1.5 to 2 inches (3.8 to 5 centimeters).", habitat="The Sumaco Horned Frog is native to the cloud forests of Ecuador in South America. It is found in the Sumaco Volcano area, which is its namesake.", predators="Predators of the Sumaco Horned Frog may include snakes and certain birds that inhabit the same region.", diet="Sumaco Horned Frogs primarily feed on insects and small invertebrates in their natural habitat.", lifespan="The typical lifespan of the Sumaco Horned Frog in the wild is around 8 to 10 years.", toxicity="The Sumaco Horned Frog is not considered highly poisonous or toxic. It does not possess the potent skin toxins seen in some other frog species.", fun_facts="The Sumaco Horned Frog gets its name from the distinctive bony horn-like protrusions above its eyes, which give it a unique appearance.These frogs have a cryptic coloration, often resembling moss or lichen, helping them blend into their forest environment. They are known for their unique reproductive behavior, with males guarding eggs and tadpoles, which they carry on their backs. This species is native to a specific and limited geographic range, making it an interesting subject of study and conservation concern.")
        ]

        """Builds sample user/note(s) data"""
        for frog in frogs:
            try:
                frog.create()
            except IntegrityError:
                '''fails with bad or duplicate data'''
                db.session.remove()
                print(f"Records exist, duplicate email, or error: {player.uid}")
    # exists = FrogSpecies.query.filter_by(name = "Plains Leopard Frog (Lithobates blairi)").first()
    # if not exists: 
    #     frog1 = FrogSpecies(name="Plains Leopard Frog (Lithobates blairi)", size= "Plains Leopard Frogs are medium-sized frogs, typically ranging from about 2 to 3 inches (5 to 7.6 centimeters) in length.", habitat="These frogs are found in a variety of habitats, including grasslands, prairies, wetlands, and semi-aquatic environments. They are native to parts of North America, including the Great Plains region.", predators="Predators of Plains Leopard Frogs may include snakes, birds, larger amphibians, and various small mammals. Additionally, they may face threats from certain invertebrates.", diet="Plains Leopard Frogs are insectivorous and primarily feed on a diet of insects, spiders, and other small invertebrates.", lifespan="The typical lifespan of Plains Leopard Frogs in the wild is around 2 to 4 years, although this can vary based on environmental conditions and predation.", toxicity="Plains Leopard Frogs are not known to be highly poisonous or toxic. They lack the potent skin toxins found in some other frog species.", fun_facts="These frogs get their name from the spots and blotchy patterns on their skin, resembling a leopard's spots. They are known for their distinctive vocalizations during the breeding season, which sound like chuckling laughter. Plains Leopard Frogs are adapted to a variety of terrestrial and aquatic habitats, and they often inhabit grasslands and wetlands with temporary or semi-permanent water bodies. During the breeding season, males call from the water to attract females for mating.")
    #     db.session.add(frog1)
    # exists = FrogSpecies.query.filter_by(name = "Sumaco Horned Frog (Hemiphractus proboscideus)").first()
    # if not exists: 
    #     frog2 = FrogSpecies(name="Sumaco Horned Frog (Hemiphractus proboscideus)", size= "The Sumaco Horned Frog is medium-sized, typically reaching a size of around 1.5 to 2 inches (3.8 to 5 centimeters).", habitat="The Sumaco Horned Frog is native to the cloud forests of Ecuador in South America. It is found in the Sumaco Volcano area, which is its namesake.", predators="Predators of the Sumaco Horned Frog may include snakes and certain birds that inhabit the same region.", diet="Sumaco Horned Frogs primarily feed on insects and small invertebrates in their natural habitat.", lifespan="The typical lifespan of the Sumaco Horned Frog in the wild is around 8 to 10 years.", toxicity="The Sumaco Horned Frog is not considered highly poisonous or toxic. It does not possess the potent skin toxins seen in some other frog species.", fun_facts="The Sumaco Horned Frog gets its name from the distinctive bony horn-like protrusions above its eyes, which give it a unique appearance.These frogs have a cryptic coloration, often resembling moss or lichen, helping them blend into their forest environment. They are known for their unique reproductive behavior, with males guarding eggs and tadpoles, which they carry on their backs. This species is native to a specific and limited geographic range, making it an interesting subject of study and conservation concern.")
    #     db.session.add(frog2)
    # db.session.commit()

Pseudo notes

Variables and Data Types

  • Variables are used to store data in a program.
  • They can hold different types of information, such as numbers, strings, or booleans.
# Structure
<VariableName> <- <Value>
# Example
Age <- 25
Name <- "John Doe"

Input and Output

  • Input allows a program to receive data from a user.
  • Output allows a program to display information to the user.
# How it works
Input <VariableName>
Output <Value>
# Example
Input Name
Output "Hello, John Doe!"

Conditional Statements (IF-ELSE)

  • Conditional statements allow a program to make decisions based on certain conditions.
  • IF-ELSE statements execute different code blocks based on whether a condition is true or false.
# Structure
IF <Condition> THEN
    <CodeBlock1>
ELSE
    <CodeBlock2>
ENDIF
# Example
IF Age > 18 THEN
    Output "You are an adult"
ELSE
    Output "You are a minor"
ENDIF

Loops (FOR)

  • Loops allow a program to repeatedly execute a block of code.
  • FOR loops are used when the number of iterations is known beforehand.
# Structure
FOR <Variable> FROM <StartValue> TO <EndValue> STEP <IncrementValue>
    <CodeBlock>
ENDFOR
# Example
FOR i FROM 1 TO 5 STEP 1
    Output i
ENDFOR

Loops (WHILE)

  • WHILE loops are used when the number of iterations is not known beforehand, but a condition must be met for the loop to continue.
# Structure
WHILE <Condition>
    <CodeBlock>
ENDWHILE
# Example
WHILE Age < 30
    Output "Happy Birthday!"
    Age <- Age + 1
ENDWHILE

Arrays

  • Arrays are used to store multiple pieces of data under a single variable name.
  • Elements in an array can be accessed using their index.
# Structure
Array <Name> [<Size>]

# Example
Array Numbers[5]
Numbers[0] <- 10
Numbers[1] <- 20

Functions

  • Functions are blocks of reusable code that perform a specific task.
  • They can accept parameters (inputs) and return a value (output).
# Structure
FUNCTION <Name>(<Parameters>)
    <CodeBlock>
    RETURN <Value>
ENDFUNCTION

# Example
FUNCTION Add(a, b)
    RETURN a + b
ENDFUNCTION

Result <- Add(10, 20)

Comments

  • Comments are used to add human-readable explanations to code.
  • They are not executed by the program and are ignored by the compiler or interpreter.
# Structure
// This is a comment
# Example
// This function adds two numbers
FUNCTION Add(a, b)
    RETURN a + b
ENDFUNCTION

Student Teaching

Developing Algorithms

  1. Understanding the Problem:
    • Clarify the Problem Statement:
    • Read and understand the problem statement thoroughly.
    • Identify input requirements, expected output, and any constraints.
  • Define the Goal:
    • Clearly state what the algorithm is expected to achieve.
      1. Identify Inputs and Outputs:
  • Inputs:
    • Identify the data or information needed as input for the algorithm.
    • Consider different scenarios and edge cases.
  • Outputs:
    • Determine what the algorithm should produce as a result.
  1. Break Down the Problem:
    • Decomposition:
    • Divide the problem into smaller, manageable sub-tasks or steps.
    • Each sub-task should focus on solving a specific aspect of the problem.
  • Abstraction:
    • Focus on the high-level steps and concepts, without getting bogged down in implementation details.
  1. Designing the Algorithm:
    • Use Pseudocode or Flowcharts:
    • Create a step-by-step outline using pseudocode or draw a flowchart to represent the algorithm’s logic.
  • Structured Programming:
    • Use clear control structures like loops and conditional statements.
  1. Consider Efficiency and Optimization:
    • Time Complexity:
    • Analyze how the algorithm’s runtime scales with input size (Big O notation).
  • Space Complexity:
    • Assess the algorithm’s memory usage with larger inputs.
  • Optimization Techniques:
    • Look for opportunities to improve the algorithm’s efficiency without sacrificing correctness.
  1. Test and Debug:
    • Test Cases:
    • Design a set of test cases to evaluate the algorithm’s performance under various scenarios.
  • Boundary Cases:
    • Include inputs at the extremes or limits defined by the problem.
  • Debugging:
    • If the algorithm produces incorrect results, trace through the steps to identify and fix errors.
  1. Consider Special Cases:
    • Edge Cases:
    • Consider scenarios that might be less common but still within the problem’s domain.
  • Handling Exceptions:
    • Ensure the algorithm gracefully handles unexpected or invalid inputs.
  1. Iterate and Refine:
    • Feedback Loop:
    • If necessary, revisit and refine the algorithm based on testing results and feedback.
  • Optimization Iterations:
    • Look for opportunities to improve efficiency or address any identified shortcomings.
  1. Documenting the Algorithm:
    • Comments and Documentation:
    • Add comments to explain complex or critical parts of the algorithm.
    • Provide a high-level overview of the algorithm’s purpose and steps.
  2. Consider Scalability and Flexibility:
    • Generalize Solutions:
    • Aim for an algorithm that can handle a range of inputs and scenarios, not just specific cases. - Scalability:
    • Ensure the algorithm performs well even as input sizes increase.

Iteration in Python:

  1. Introduction to Iteration:
    • Definition: Iteration is the process of repeatedly executing a block of code until a specific condition is met.
    • Use Cases:
    • Processing a collection of items.
    • Executing a block of code a specific number of times.
    • Repeating a task until a certain condition is satisfied.
  2. For Loops:
    • Syntax: for in :
    • Explanation:
    • Iterates over each element in a sequence.
    • takes on the value of each element in the sequence.
  3. Range Function:
    • Syntax: range(start, stop, step)
    • Explanation:
    • Generates a sequence of numbers from start to stop-1, with an optional step size.
    • Commonly used in conjunction with for loops for a specified number of iterations.
  4. While Loops:
    • Syntax: while :
    • Explanation:
    • Repeats a code block as long as is True.
    • Be cautious of infinite loops; ensure the condition eventually becomes False.
  5. Control Statements (break, continue):
    • Break:
    • Terminates the loop prematurely if a certain condition is met.
    • Useful for exiting a loop early based on a specific condition.
  • Continue:
    • Skips the rest of the code block and moves to the next iteration of the loop.
    • Useful for skipping certain elements or iterations.
      1. Nested Loops:
  • Definition:
    • A loop inside another loop.
    • Used for tasks that require multiple levels of iteration.

Lists

  1. Definition:
    • A list is a collection of elements, which can be of any data type (e.g., numbers, strings, objects).
    • Lists are ordered, meaning the elements have a specific sequence.
  2. Creating a List:
    • Lists are typically created using square brackets [].
    • Example: [1, 2, 3, 4, 5]
  3. Accessing Elements:
    • Elements in a list are accessed by their index, starting from 0.
    • Example: The first element has index 0, the second has index 1, and so on.
  4. Length of a List:
    • The number of elements in a list can be determined using the len() function.
  5. Iterating Through a List:
    • Use loops like for or while to go through the elements of a list.
  6. Modifying Lists:
    • You can change the value of an element in a list by assigning a new value to its index.
  7. Adding Elements:
    • Methods like append(), extend(), or insert() are used to add elements to a list.
  8. Removing Elements:
    • Methods like pop(), remove(), or del are used to take elements out of a list.
  9. Slicing:
    • Extracting a portion of a list is called slicing. It involves specifying a range of indices.
  10. List Concatenation:
    • You can combine two or more lists using the + operator. This creates a new list.

Boolean Expressions:

  1. Boolean expressions are conditions that evaluate to either True or False.
    • Example: x > 5 checks if x is greater than 5.
  2. If Statement:
    • The if statement is used to execute a block of code if a condition is True.
    • It allows the program to take different paths based on the condition.
  3. Else Statement:
    • The else statement provides an alternative block of code to execute if the if condition is False.
    • This allows for two different paths depending on the outcome of the condition.
  4. Elif Statement:
    • The elif statement is used to check additional conditions after an if statement.
    • It provides an alternative if the initial if condition is False.
  5. Logical Operators:
    • and, or, and not are used to combine or negate boolean expressions.
    • and: Returns True if both conditions are True.
    • or: Returns True if at least one condition is True.
    • not: Negates a boolean expression.
  6. Nested If Statements:
    • You can have if statements inside other if statements. This is known as nesting.
    • It allows for more complex decision-making based on multiple conditions.
  7. Truthy and Falsy Values:
    • In many programming languages, values other than False, 0, and None are considered as “truthy”, while False, 0, and None are considered “falsy”.
    • This can impact the behavior of conditions.
  8. Comparisons:
    • Common comparisons include == (equal to), != (not equal to), < (less than), > (greater than), <= (less than or equal to), and >= (greater than or equal to).

Procedures

  1. Requirements Gathering:
    • This initial phase involves understanding the needs and expectations of the stakeholders.
    • It includes discussions, interviews, and documentation to capture what the software should do.
  2. Design and Architecture:
    • In this phase, the high-level structure and design of the software are planned.
    • It includes defining system components, their relationships, and data flow.
  3. Implementation:
    • This is the phase where actual coding takes place based on the design.
    • Developers write code in accordance with best practices and design patterns.
  4. Testing:
    • Testing involves evaluating the software to ensure it functions as intended.
    • This includes unit testing (testing individual components), integration testing (testing interactions between components), and system testing (testing the entire system).
  5. Debugging:
    • During this phase, developers identify and fix any issues or bugs found during testing.
    • Debugging is a crucial part of the development process to ensure the software functions correctly.
  6. Documentation:
    • Documenting the code, its structure, and how it works is important for future maintenance and understanding.
    • This includes comments within the code, as well as external documentation.
  7. Version Control:
    • Version control systems like Git are used to track changes in the codebase, allowing for collaboration among developers and easy rollback to previous versions if needed.
  8. Code Review:
    • Code reviews involve having peers or senior developers review the code for quality, adherence to coding standards, and potential improvements.
  9. Integration and Deployment:
    • This phase involves combining different parts of the software (if applicable) and deploying it to a live environment.
  10. Monitoring and Maintenance:
  • After deployment, the software needs to be monitored for performance, security, and any potential issues.
  • Regular maintenance and updates are important to ensure the software remains functional and secure.
  1. User Acceptance Testing (UAT):
    • UAT involves end-users testing the software to ensure it meets their requirements and expectations before final deployment.
  2. Feedback and Iteration:
    • Feedback from users and stakeholders is valuable for making improvements and updates to the software.

Data Abstraction

  1. Definition:
    • Data abstraction is a programming concept that focuses on hiding the implementation details of data types or objects and exposing only the essential characteristics or behavior.
  2. Purpose:
    • The primary goal of data abstraction is to simplify complex systems by allowing users to interact with data at a higher level of abstraction, without needing to understand the underlying complexity
  3. Encapsulation:
    • Encapsulation is a key aspect of data abstraction. It involves bundling data (attributes) and the methods (functions) that operate on that data together in a single unit, often called a class or an object.
  4. Access Control:
    • Data abstraction provides a way to control access to the internal state of an object. It allows certain attributes or methods to be accessible while keeping others private.
  5. Interface:
    • The interface of an object defines the set of methods that can be used to interact with it. It describes what operations are available without revealing how they are implemented.
  6. Black Box Approach:
    • Data abstraction follows a “black box” approach, where users are only concerned with what an object does, not how it does it. This promotes modularity and reduces the complexity of using objects.
  7. Levels of Abstraction:
    • Abstraction can be achieved at different levels. For example, high-level programming languages abstract away low-level machine code operations, allowing programmers to focus on algorithmic logic.
  8. Reusability:
    • Data abstraction promotes code reuse. Once an abstract data type or class is defined, it can be used in various contexts without the need to understand its internal workings.
  9. Separation of Concerns:
    • Data abstraction helps in separating the concerns of different parts of a program. This makes it easier to manage, test, and maintain complex systems.
  10. Polymorphism:
    • Abstraction allows for polymorphism, where objects of different types can be used interchangeably if they share a common interface. This promotes flexibility in code design.
  11. Real-world Analogy:
    • A real-world analogy of data abstraction can be seen in a car. A driver interacts with the car using controls like the steering wheel, pedals, and gear shift, without needing to understand the internal combustion engine.
  12. Example:
    • In object-oriented programming, a class that represents a bank account can abstract away the details of how the account balance is managed, providing methods like deposit(), withdraw(), and get_balance() for interaction.

Algorithims

  1. Definition:
    • An algorithm is a finite set of well-defined instructions or steps that perform a specific task or solve a particular problem.
  2. Purpose:
    • Algorithms are used to solve problems in a systematic and efficient manner. They are fundamental to computer science and are employed in various domains, from mathematics to data processing and beyond.
  3. Characteristics:
    • Input: Algorithms take some input(s) and produce an output.
    • Definiteness: Each step in the algorithm must be precisely defined and unambiguous.
    • Finiteness: The algorithm must eventually terminate after a finite number of steps.
    • Effectiveness: Each step must be achievable using basic operations that can be carried out by a human or a computer.
  4. Efficiency:
    • An important aspect of algorithms is their efficiency, which refers to how quickly they can produce a solution. This is often measured in terms of time complexity (how long it takes to run) and space complexity (how much memory it uses).
  5. Correctness:
    • An algorithm is considered correct if it produces the expected output for all valid inputs.
  6. Deterministic vs. Non-Deterministic:
    • Deterministic algorithms produce the same output for the same input every time they are executed.
    • Non-deterministic algorithms may produce different outputs for the same input, depending on factors like randomization or external conditions.
  7. Algorithmic Paradigms:
    • There are various approaches to designing algorithms, including:
    • Divide and Conquer: Break a problem into smaller subproblems, solve them, and combine the results.
    • Greedy Algorithms: Make locally optimal choices at each step to find a global optimum.
    • Dynamic Programming: Solve complex problems by breaking them down into simpler overlapping subproblems.
    • Backtracking: Incrementally build a solution, backtracking when it becomes clear that it cannot be completed.
    • Brute Force: Consider all possible solutions to a problem and select the best one.
  8. Applications:
    • Algorithms are used in a wide range of applications, from sorting and searching data to optimizing routes in GPS systems, cryptography, image processing, and artificial intelligence.
  9. Algorithmic Complexity Classes:
    • Algorithms are often categorized based on their time and space complexity. Common notations include Big O notation (O()), which describes an upper bound on the time complexity of an algorithm.
  10. Algorithm Analysis:
    • Evaluating and comparing algorithms involves considering factors like time complexity, space complexity, and their performance characteristics in different scenarios.
  11. Iterative vs. Recursive:
    • Algorithms can be implemented using iteration (loops) or recursion (a function calling itself). Both approaches have their strengths and trade-offs.

Simmulations

  1. Purpose of Simulation:
    • Define the specific problem or system you want to simulate.
    • Determine the goals and objectives of the simulation. What do you want to learn or achieve?
  2. Choosing a Programming Language:
    • Select a programming language suitable for the task. Common choices include Python, Java, C++, and others depending on the application.
  3. Time Step and Discretization:
    • Decide on the time step for the simulation. This determines how frequently the simulation updates and advances in time.
    • Consider discretizing the system if it involves continuous processes. This involves breaking down continuous variables into discrete steps. Initial Conditions and Boundary
  4. Conditions:
    • Define the initial state of the system. This includes the starting values of all relevant variables.
    • Specify any constraints or conditions that apply to the system boundaries.
  5. Model Equations:
    • Formulate the mathematical equations that describe the behavior of the system. These equations may be based on physical laws, empirical data, or theoretical models.
  6. Numerical Integration:
    • Implement numerical methods (e.g., Euler’s method, Runge-Kutta methods) to solve differential equations that govern the system’s behavior.
  7. Randomness and Stochastic Processes:
    • Introduce randomness if the system involves probabilistic or uncertain elements. This may be achieved using random number generators.
  8. Visualization and Output:
    • Create visual representations of the simulation results. This could include plots, graphs, animations, or any other relevant visualizations.
  9. Validation and Verification:
    • Validate the simulation by comparing its results with known analytical solutions (if available) or experimental data. This helps ensure that the simulation accurately represents the real-world system.
  10. Sensitivity Analysis:
    • Conduct sensitivity analysis to understand how changes in input parameters affect the simulation output. This helps identify critical factors and potential sources of uncertainty.
  11. Optimization and Tuning:
    • Fine-tune the simulation parameters and algorithms to improve performance and accuracy.
  12. Performance Considerations:
    • Optimize the code for efficiency, especially if dealing with computationally intensive simulations.
  13. Error Handling and Debugging:
    • Implement error handling mechanisms to deal with unexpected situations. Debug the code to identify and fix any issues or bugs.
  14. Documentation and Comments:
    • Maintain clear and well-commented code to facilitate understanding and future modifications.
  15. Scaling and Parallelization:
    • Consider strategies for scaling the simulation to handle larger or more complex systems. This may involve parallel computing techniques.
  16. Ethical and Legal Considerations:
    • Ensure that the simulation and its results adhere to ethical and legal standards, especially if it has real-world implications or applications.

College board study guide

  1. Data Representation
  • Binary, Decimal, Hexadecimal:
    • Binary is base-2 numbering system (0 and 1).
    • Decimal is base-10 numbering system (0 to 9).
    • Hexadecimal is base-16 numbering system (0 to 9, A to F representing 10 to 15).
  • Conversion between Number Systems:
    • Binary to Decimal: Each bit position represents a power of 2.
    • Decimal to Binary: Divide the decimal number by 2 and keep track of remainders.
    • Hexadecimal to Decimal: Similar to binary, but using base 16.
    • Decimal to Hexadecimal: Divide the decimal number by 16, keep track of remainders, and convert remainders greater than 9 to corresponding letters (A, B, C, D, E, F).
  • Bitwise Operations (AND, OR, XOR, NOT):
    • AND: 1 if both bits are 1, otherwise 0.
    • OR: 1 if at least one bit is 1, otherwise 0.
    • XOR: 1 if only one of the bits is 1, otherwise 0.
    • NOT: Flips the bits (0 becomes 1, 1 becomes 0).
  1. Compression and Encryption
    • Data Compression Purpose and Methods:
    • Purpose: Reduce storage space or transmission time of data.
    • Methods: Lossless (no data loss) and lossy (some data loss).
  • Compression Algorithms (e.g., Huffman Coding):
    • Huffman Coding: Variable-length encoding based on frequency of characters. More frequent characters have shorter codes.
  • Data Encryption Purpose and Methods:
    • Purpose: Secure data from unauthorized access.
    • Methods: Symmetric key (same key for encryption and decryption) and asymmetric key (public and private keys).
  • Encryption Algorithms (e.g., AES, RSA):
    • AES (Advanced Encryption Standard): Symmetric key encryption widely used.
    • RSA: Asymmetric key encryption for secure communication and digital signatures.
  1. Error Detection and Correction
  • Parity Bits for Error Detection:
    • Parity bit added to ensure even or odd number of 1s in a binary sequence.
    • Used for detecting errors in transmission.
  • Error Correction Techniques (e.g., Hamming Code):
    • Hamming Code: Adds extra bits for error detection and correction.
  1. Digital Logic and Circuits
  • Logic Gates and Truth Tables:
    • AND Gate: Outputs 1 only when both inputs are 1.
    • OR Gate: Outputs 1 when at least one input is 1.
    • NOT Gate: Outputs the opposite of the input.
    • NAND, NOR, XOR Gates: Combinations of basic gates with specific logic.
  • Digital Circuit Components:
    • Flip-Flops: Sequential logic components that store binary information. They can be used as memory elements.
    • Multiplexers (MUX): A data selector used to route data from multiple sources to a single output.
  • Boolean Algebra:
    • Laws (e.g., Associative, Commutative, Distributive): Rules governing operations in Boolean algebra.
    • Theorems (e.g., De Morgan’s laws): Equivalences used for simplification.
    • Simplification Techniques (e.g., Karnaugh Maps): Graphical method to simplify Boolean expressions.
  1. Boolean Algebra
  • Laws and Theorems of Boolean Algebra:
    • Idempotent Law: A OR A = A, A AND A = A.
    • Absorption Law: A OR (A AND B) = A, A AND (A OR B) = A.
    • Complement Law: A OR (NOT A) = 1, A AND (NOT A) = 0.
  • Simplifying Boolean Expressions:
    • Algebraic Simplification: Using Boolean algebra laws and theorems to simplify expressions.
    • Karnaugh Maps: A graphical method for simplification of Boolean expressions with fewer variables.
  1. CPU Architecture Components of a CPU:
  • ALU (Arithmetic Logic Unit): Performs arithmetic (addition, subtraction) and logical (AND, OR) operations.

  • Registers: Small, fast storage locations within the CPU used for temporary data storage.

  • Control Unit: Coordinates operations and manages the fetch-decode-execute cycle.

  • Fetch-Decode-Execute Cycle:

    • Fetch: The CPU fetches the next instruction from memory.
    • Decode: The CPU interprets the instruction and prepares to execute it.
    • Execute: The CPU carries out the instruction.
  1. Memory
  • Types of Memory:
    • RAM (Random Access Memory): Volatile memory that stores data that is actively being used or processed by the computer.
    • ROM (Read-Only Memory): Non-volatile memory that contains firmware or permanent instructions.
  • Cache Memory:
    • Purpose: Stores frequently accessed data to speed up CPU operations.
    • Levels (L1, L2, L3): Different levels of cache, with L1 being closest to the CPU and fastest.
  1. Input and Output Devices
  • Input Devices:
    • Keyboard: A device with keys used to input characters and commands.
    • Mouse: A pointing device used to navigate graphical interfaces.
    • Touchscreen: An input device that allows users to interact with the screen directly.
    • Microphone: Converts sound waves into electrical signals for audio input.
  • Output Devices:
    • Monitor: Displays visual information generated by the computer.
    • Printer: Produces hard copies of digital documents or images.
    • Speakers: Output audio signals as sound waves for the user to hear.
  1. File Systems
  • File Systems and Data Organization:
    • Hierarchy: Files are organized into directories or folders, which can contain other files or subdirectories.
    • File Attributes: Information associated with a file, such as size, type, and permissions.
    • File Extensions: Typically denote the type or format of a file (e.g., .txt for text files, .jpg for image files).
  • File Naming Conventions and Permissions:
    • File Naming Rules: Names can include letters, numbers, and special characters, with specific restrictions on length and character usage.
    • Access Permissions (Read, Write, Execute): Determine what actions users can perform on a file (e.g., read-only, read-write).
  1. Networking and the Internet
  • Basic Networking Concepts:
    • IP Addresses: Unique identifiers for devices on a network, allowing for communication.
    • Protocols (e.g., TCP/IP): Rules governing how data is transmitted across a network.
  • OSI Model and Its Layers:
    • Physical Layer: Concerned with the physical connection between devices.
    • Data Link Layer: Responsible for reliable data transfer across a physical link.
    • Network Layer: Manages routing and addressing to ensure data reaches its destination.
    • Transport Layer: Ensures reliable data transfer between devices.
    • Session Layer: Establishes, manages, and terminates sessions or connections.
    • Presentation Layer: Responsible for data formatting and encryption.
    • Application Layer: Provides network services directly to end users.
  1. Cybersecurity
  • Common Cybersecurity Threats:
    • Malware (e.g., Viruses, Worms, Trojans): Malicious software designed to harm or exploit a system.
    • Phishing: Deceptive techniques used to trick individuals into revealing sensitive information.
  • Cybersecurity Best Practices:
    • Strong Passwords: Use complex passwords with a combination of letters, numbers, and special characters.
    • Regular Updates and Patches: Keep software, operating systems, and security tools up-to-date.
    • Firewalls and Antivirus Software: Provide essential protection against unauthorized access and malware.
  1. Ethical and Social Implications
  • Ethical Considerations in Technology:
    • Privacy: Protecting individuals’ personal information and data.
    • Intellectual Property: Respecting copyrights and intellectual rights of creators.
    • Security: Ensuring the safety and integrity of digital systems and data.
  • Impact of Technology on Society:
    • Digital Divide: Unequal access to technology and information.
    • Automation and Employment: Consideration of the effects of automation on jobs and employment trends.

College Board corrections

  • Q8
    • I knew I and II were correct, but it was dumb to assume a phone could know who took the photo because a phone only stores name of photo, date, and location.
  • Q14
    • The programs each display 10 values, but the values in B are greater than A because the Display i comes after the i = i+1 instead of before
  • Q21
    • I mixed up my right and left for this one, so as a result, the robot was off course, B was the right choice
  • Q24
    • It is looseless because the encoded string can go backwards due to the fact you can swap the characters back out. C was correct
  • Q25
    • LEVEL_UP is correct because no pair of characters appear in the string more than once
  • Q26
    • A is correct because this segment rotates right whenever there is an open square.
  • Q29
    • A is correct because both inputs to the second “or” gate will be false making the output false
  • Q30
    • The procedure is called 5 times, meaning 5 hours, once before the loop andd 4 inside the loop.
  • Q31
    • C is correct because Program 1 moves the robot to the grey square by moving the robot forward, left, forward, then right. Program 2 is correct because it moves to the upper right corner, rotating left, and then to the upper left corner.
  • Q33
    • A is correct because it sets include to true whenever floor is greater than 10 or bedrooms equal 3.
  • Q34
    • D because the number of predators at the begginging of the programs is initialized and never updated
  • Q35
    • D because the Creatives Commons license allowing the use of free samples
  • Q37
    • C because segment 1 requires more arithmettic because it performs the opperation “sum/LENGTH(numlist)” in the loop. Segment 2 performs the opperation once
  • Q43
    • A because The pattern in the table appears to indicate that there are n squared steps for a list containing n items. This number of steps is a polynomial and therefore the algorithm runs in reasonable time.
  • Q48
    • D because it causes the experiment to be successful when RANDOM (1 , 100) produces a result from 1 to 75, or 75% of the time.
  • Q49
    • C because the loop should iterate once for each multiple of 5 from start to end. The number of multiples of 5 from start to end is given by ((end minus start) /5) +1
  • Q50
    • B because The procedure implements a linear search, which sequentially compares each element of the list with the target value. The list does not need to be sorted because the procedure checks list elements until either the target is found or it reaches the end of the list.
  • Q58
    • A because the Internet can provide tools, information, and knowledge to crowdsourcing participants and can lower geographic barriers to potential participants. However, there exist problems that cannot be solved in reasonable time, even with a distributed approach.
  • Q60
    • I chose A correctly but B is wrong and D is right because creating a list of names is an example of a data abstraction that may make it easier for a programmer to manage the complexity of a program.
  • Q62
    • I chose C correctly but A incorrectly and D was the other correct answrer because The online encyclopedia can be edited at any time, so it is easy to create or update articles as new information becomes available.
  • Q63
    • I chose D correctly but C was wrong and B was right because If count is set to 0 repeatedly inside the loop, it will not provide an accurate count of the number of prime numbers in the list.
  • Q65
    • I chose B right but C was wrong and D was right because if y is negative, then the condition, count = y, will never be met since count begins at 0 and repeatedly increases.
  • Q66
    • I chose C right but A was wrong and D was right because The procedure returns the first number it encounters that is less than the first number in the list. For the list [40, 30, 20, 10] the procedure returns 30, which is not the least value in the list.

Summary of what I learned in Trimester 1 and problems I had

  1. Problems
    • For the passion project, we already started off behind since we did our team test so much later than we should of, causing us to be very behind
    • We had a lot of team work issues, but we resolved this by assiging everyone jobs because before hand, eeryone was confused
    • We had to scrap a lot of our code causing us to be behind more but we were able to salvage some of it, being the information about the frogs, for our actual project.
    • We had a lot of trouble connecting our front and backend because we could not get the flask link, but we then figured out we had to edit our main.py more
    • We couldn’t seperate the information of each frog before when you clicked on them. But we fixed it by making different permalinks for the .mds and havinjg different functions for the on-click events.
  2. Things I learned and accomplishments
    • Despite our set backs, we still came out with a pretty good final product and our teamwork improved drastically.
    • I learned how to interact with vscode and learnt JS and Python.
    • I know how to make quizzes, games, and websites with information
    • I learned how to do frontend, backend, and connect them with API
  3. Future plans
    • I did quite a bit of backend, so my plan is to switch to more forntend stuff next trimester to have variety
    • I want to be more organized and get a btter group I know I can work with.

Extra Credit/Peer grades for other Passion Projects

  • Saaras K’s group (Del norte Geoguesser): HOOK: Points: 3.8 Reason: The game is very fun, a good choice for a hook due to the amount of people who play video games.

KNOWLEDGE: Points: 3.8 Reason: Everyone understood the code and clearly did the work themselves with minimal help due to their knowledge of the code.

VALUE: Points: 0.8 Reason: nothing life changing, but it was a fun game that could be enjoyed in free time.

WOW FACTOR: Reason: Well designed and just straight fun.

Total: 8.4/9.0

  • Hayden Chen’s Group (Encrypt/Decrypt, cybersecurity): Hook: 3.8 Showed that they were clearly invested in this project. Got my attention.

Knowledge: 4.0 They understand all their code, they had Frontend, Backend, API connections, and very descriptive on what they talked about on their code.

Value: 1.0 This could be especially useful now due to the importance of cybersecurity.

Wow Factor: The code itself was truly amazing and their presenting skills were very good.

Total: 8.8/9.0

  • Soham Kamat’s group (A planner): HOOK: Points: 3.9 Reason: It got me intrigued because of how useful a planner is as a student.

KNOWLEDGE: Points: 3.8 Reason: Had multiple API’s and showed good understanding.

VALUE: Points: 0.9 Reason: Very useful for anyone with a busy schedule in particular.

WOW FACTOR: Reason: I loved the idea, and it was executed nicely.

Total: 8.6/9.0