• find_the_beep

    Description

    The objective of Find The Beep is to create a dynamic grid where letters “B”, “E”, and “P” are placed randomly, while avoiding the word “BEEP”.

    Inspiration

    This was inspired by the book

    Find the Fox: An Almost Impossible Word Search by Alex Cheddar.

    The book presents a unique 240-page word search using only the letters F, O, and X, where the only word present is “FOX”. The challenge and creativity in reducing the puzzle to three letters and one word inspired me to create a similar minimalist puzzle concept with “BEEP.”


    Usage

    1. Open the webpage.
    2. Enter the desired number of rows and columns (minimum 4×4).
    3. Click “go” to generate the grid.
    4. Observe the grid ensuring no BEEPs are formed.

    Project Origins

    My original version of Find The Beep was created using Python. I developed an Excel-based solver with VBA to scan and ensure that the sequence “BEEP” never appeared in the generated grids. The transition to JavaScript allowed me to bring this to the web, where users can interactively create grids and visualize the results.

    PYTHON find_the_python.txt

    VBA find_the_vba.txt


    Code Method

    • Grid Generation: Dynamically creates grids based on user input.
    • Conflict Avoidance: Utilizes directional checks to prevent specific sequences.
    • Retry Mechanism: Automatically retries generation if conflicts arise.

    HTML FindTheBeep.html

    Bonus:

    HTML FindTheTax.html

  • numTidy

    Python script wrote for use as a function for Caseware’s IDEA.

    This script defines a function numTidy that takes a string representation of a number and cleans it by removing unwanted characters and ensuring the number is properly formatted.

    How It Works:

    The line cleaned_str = re.sub(r'[^\d.-]’, ”, number_str) uses regular expressions to remove any characters from the input string that are not digits (\d), a negative sign (-), or a decimal point (.)

    Next section checks if there is more than one negative sign. If so, it keeps only the first negative sign at the front by using cleaned_str = ‘-‘ + cleaned_str.replace(‘-‘, ”, 1).

    If the string contains multiple decimal points, this part splits the string at the first decimal point and joins the remaining parts, allowing only one decimal point.

    The line cleaned_str = re.sub(r'[^0-9]+\Z’, ”, cleaned_str) removes any non-numeric characters that appear at the end of the string after numbers.

    The function then attempts to convert the cleaned string into a floating-point number using float(cleaned_str). If successful, the number is returned as a string.

    ## Usage:

    This function can be used in various contexts, such as cleaning user inputs that may include non-numeric characters, to ensure valid numerical data. In IDEA, the function would be called using @Python(“numTidy”, [data]).

    PYTHON numTidy.txt

  • intentional_errors

    Python print function reduced to physical type speed, with occasional errors included which causes the typing animation to pause briefly, then backspace to remove error, before then continuing to type the desired text.

    PYTHON text_errors.txt

  • rss_reader

    Several variations of the same thing here, mostly got carried away with a few unrelated ideas. But basically, Python RSS reader – will create a txt file to store your feeds, and a json file to remember your history so you’ll not be shown the same feed each time. The information is typed out a letter at a time to give it a personal touch. I also experimented with a Bionic version, which uses \033[1;32;40m TEXT \033[0m to ‘bold’ letters, thus allowing me to split words up so as to appear like a Bionic reader.

    ** Also**, for “fun”, I’ve added an extra feature that causes the text being typed to make occasional errors, stops typing, deletes errors, and then continues. But I’ll do a separate post about that because, well… I think it’s bloody cool!

    PYTHON RSSyn.txt

    BIONIC RSSautoBIONIC.txt

  • bionic_doc_converter

    Bionic Reading is a reading system that supports the reading flow by guiding the eye through the text using typographic highlights.

    Bionic Document Converter – program that will apply the Bionic Reading technique to all open documents and save them as a Bionic Reading enabled document.

    This Python script is using the win32com.client library to interact with Microsoft Word documents. Here’s a step-by-step explanation of what it does:

    1. It imports necessary libraries: os, win32com.client, and math.
    2. It creates a Word application object using win32.gencache.EnsureDispatch(‘Word.Application’).
    3. It iterates over all open Word documents.
    4. For each document, it iterates over all paragraphs, and for each paragraph, it iterates over all sentences, and for each sentence, it iterates over all words.
    5. For each word, it splits the word into two halves (with the first half being larger if the word length is odd). It then applies bold formatting to the first half of the word and leaves the second half unbolded.
    6. After processing all words in a paragraph, it changes the font of the entire paragraph to ‘Calibri (Body)’ and sets the font size to 12.
    7. After processing all paragraphs in a document, it changes the page colour of the document to light yellow.
    8. Finally, it saves the modified document in the same location as the original document but with a new name that is prefixed with ‘bionic_enabled_’.
    9. After processing all documents, it quits the Word application.

    Please note that this script requires that you have Microsoft Word installed on your machine and that you have the necessary permissions to modify and save documents.

    PYTHON bionic_python.txt

  • destiny_v2.0

    ** Version Two ** – For armour comparison on Bungie’s Destiny 2 – This Python script reads the data from a text file called data.txt containing the stats for your different armours. It then finds the best combinations of sets and prints the top five combinations along with their results.

    PYTHON destiny2v2.txt

    DATA data.txt

  • buy_low_sell_high

    Attempt Two – Python code that allows users to analyse historical stock price data using the yfinance library. The code calculates the start and end dates for the desired historical data. It sets the end date as the current date using datetime.date.today(), and the start date as six months prior to the end date using datetime.timedelta(days=6 * 30). Using the yf.download() function from the yfinance library, the code attempts to fetch the historical price data and proceeds to calculate the weekly high and low prices using the resample() function on the close prices.

    The resulting weekly highs and lows are stored in separate variables. The code retrieves the current week’s high and low prices by accessing the last elements of the weekly highs and lows arrays.
    Next, the code calculates the average percentage difference between the high and low prices for each week. It subtracts the lows from the highs, divides the result by the lows, and multiplies by 100.

    The average of these percentage differences is stored in the avg_percentage_diff variable. The code retrieves the current share price, the highest price for the current week, and the lowest price for the current week. It then calculates values based on the average percentage increase and decrease difference.

    The theory is that regardless of shares going up or down, I should be able to ‘predict’ the short increases and decreases along its path.

    PYTHON shares.txt

  • killer_sudoku.py

    Python script to assist with solving Killer Sudokus.
    The code presents a menu-driven program with three options:

    Cage Overlap (Option A) allows the user to calculate the split value of a cage overlapping two boxes (N and A) based on a given total value (N) and what must remain for the remaining cage.

    ____________________
    _________ ____ |    
    | N      ||B  ||    
    |        ||   ||    
    |        ||___||    
    |        |_____|____ 
    |              | A  |
    |______________|____|
                   |     

    Cage Combinations (Option B): This option allows the user to generate all possible combinations of numbers (from 1 to 9) that add up to a given total and have a specific area.

    Calculator (Option C): This option provides a basic calculator functionality. The user can input arithmetic expressions in the format “number1 + number2” or “number1 – number2” and get the corresponding result.

    The program keeps running until the user chooses to return to the main menu by entering “0” as their input. It ensures that the inputs are validated and provides appropriate feedback and error handling.

    Overall, this code offers a simple interactive environment for cage-related calculations and basic arithmetic operations

    PYTHON killer_sudoku.txt

  • binary_wrist_watch

    Binary wrist watch created with ESP32 using Micropython

    mPYTHON boot.txt

    mPYTHON main.txt

    mPYTHON ssd1306.txt

  • DHT11 != SSD1306

    Just in case you lot are struggling to get a skittish DHT11 to cope with a ridiculously stubborn SSD1306 using Micropython… which is basically Python but with a Dissociative identity disorder. Here is the solution –

    PYTHON ssd1306.txt

  • fibonacci_clock

    convert to Python (py)

    PYTHON Fibonacci_clock.txt

  • python_mouse_detect

    Mouse pointer location display – run by Python but distributed as MouseDetect Application (.exe)

    EXE MouseDetect.zip

  • python_dungeon

    Not coming to an Xbox near you: Python Dungeon!
    A really good game, except without the ‘really good’ part and not much of a ‘game’ really… anyway