<<<<<<< HEAD

Nan

Een eerstejaars project voor de Hogeschool Utrecht. Een Python-gebaseerd platform voor mini-games, inclusief user management, scoresystemen en API-integraties.

Project Overzicht

Nan Title Screen
Python 3 JSON Data Storage REST APIs CLI Architecture

Nan is een modulaire command-line applicatie die verschillende mini-games host, waaronder:

Nan Game Selection

Geleerde Vaardigheden

Python 3 API Integration Data Handling Modular Design

Tijdens dit project heb ik de fundamenten van Python verder uitgediept. Ik heb geleerd hoe ik externe API's (zoals OpenWeather en OpenTDB) integreer, hoe ik een modulair systeem bouw met verschillende Python-bestanden, en hoe ik complexe game-logica combineer met persistente dataopslag in JSON.

Guesser Game

In het Guesser spel moet de speler een getal raden binnen een bepaald bereik. Het spel geeft feedback of het getal hoger of lager is.

Guesser Gameplay 1
Guesser Gameplay 2
=======
Python 3 HU Year 1 CLI Architecture

Nan Platform

A first-year project developed for Hogeschool Utrecht. A Python-based CLI gaming platform featuring automated user authentication, JSON data persistence, and adaptive score calculation algorithms.

Project Overview

Python 3 JSON Data Storage CLI Architecture

Nan is a modular command-line application hosting multiple mini-games (such as Hangman and Number Guesser). The system includes a robust authentication and account creation module using JSON files for persistent data storage.

Skills Learned

Python 3 Data Handling Logic Design

During this first-year project at Hogeschool Utrecht, I mastered the fundamentals of Python programming. I learned structured code design, handling external JSON file operations, and building complex CLI game loops.

User Management

The core of the platform is the account management system. It validates user credentials and automatically registers new accounts if a username is not found in the database.

account_manager.py
Python
import json

def user_login_create_json(user_name, user_password):
    file_path = 'account.json'
>>>>>>> 638effd4c78ec481bd4308ff95157772d0e6cd95

User Management & Scoring

Het systeem bevat een uitgebreid account-beheer dat niet alleen inlogs valideert, maar ook high-scores bijhoudt voor de verschillende games.

def user_account_handler(user_name, user_password):
    file_path = "account.json"
    with open(file_path, 'r+') as json_file:
        data = json.load(json_file)
        accounts = data["accountDetails"]

        for user_account in accounts:
            if user_account["username"] == user_name and user_account["password"] == user_password:
                print(f"User found logging in, Welcome {user_name}")
                return True

        print("User not found creating account")
        new_entry = {"username": user_name, "password": user_password}
        accounts.append(new_entry)
        
        json_file.seek(0)
        json.dump(data, json_file, indent=2)
        json_file.truncate()
<<<<<<< HEAD

Hangman (Galgje)

In Galgje wordt de voortgang visueel bijgehouden en kunnen gebruikers de woordenlijst dynamisch aanpassen door woorden toe te voegen of te verwijderen.

Hangman Title
Hangman Gameplay
def show_progress(word, guessed_letters):
    display = []
    for letter in word:
        if letter in guessed_letters:
            display.append(letter.upper())
        else:
            display.append("_")
    return " ".join(display)
=======
        

Number Guesser Game

The Guesser game incorporates dynamic difficulty levels, adaptive scoring algorithms, and automated player performance feedback.

guesser_game.py
Python
def calculate_score(difficulty_level, user_tries):
    score = (user_max_tries(difficulty_level) - user_tries) * difficulty_level
    print("Your score is: " + str(score))
>>>>>>> 638effd4c78ec481bd4308ff95157772d0e6cd95

def calculate_score(lives_left, difficulty):
    return lives_left * difficulty
<<<<<<< HEAD

API Integration

Voor de Animal Facts quiz wordt de requests library gebruikt om vragen op te halen van een externe API. Dit introduceerde concepten zoals JSON parsing en HTTP status codes.

import requests

def start_api_animal(user_name):
    response = requests.get("https://opentdb.com/api.php?amount=10&category=27&type=boolean")
    data = response.json()
    questions = data.get("results", [])

    for item in questions:
        question_text = html.unescape(item["question"])
        correct_answer = item["correct_answer"]
        user_answer = input(f"{question_text} (True/False): ")
        # ... logic to check answer and update score
=======
    if user_score < low_score:
        return print("Try a lower difficulty")
    elif low_score <= user_score <= normal_score:
        return print("Keep this difficulty")
    else:
        return print("Advice: you can handle a higher difficulty level!")
>>>>>>> 638effd4c78ec481bd4308ff95157772d0e6cd95