reviews2

Graphical User Interface, or GUI, is what makes most programs usable. Without them, we'd be stuck working in abstract text based terminals. We wouldn't have fantastic media tools such as Photoshop or Premier Pro. Without them, it is possible that computer based work would not be nearly as popular.

In my own studies, I have learned how to make responsive, good looking, and usable User Interfaces. I have made apps to store lists, comunicate with chatbots, and even to play games! You can view exammples of some of them below:

reviews2 reviews2 reviews2

These three images showcase three GUI programs I have developed. In the first image, you can see a text-based adventure game I developed in C#. In this program, you communicate with a mystery man who you have to guide to the exit. I developed custom built Natural Language Processing for this project which takes your input and turns it into executable commands.

In the next two images, I developed GUI programs that perform various tasks. In the first of the two, you can see an app I built an inventory that came with a built in undo system. In the second of the two, you can see an interface that lets you write codes with the enigma machine algorithm. The first project was built in C# with the Avalonia framework, and the second project was built with Java.

Below, you can see the backend code for my Enigma Algorithm.

package com.example.swardson_p6;

import java.util.Random;

public class Enigma implements EnigmaInterface
{
    private String decodedMessage;
    private String encodedMessage;

    private int[] messageAscii;

    private int key;

    public Enigma()
    {

    }

    @Override
    public void setCodedMessage(String message)
    {
        Random rand = new Random();
        int randKey = rand.nextInt(49) + 1;

        key = randKey;

        this.setCodedMessage(message, randKey);
    }

    @Override
    public void setCodedMessage(String message, int key)
    {
        int valKey = key;

        if(valKey < 1) valKey = 1;
        else if(valKey > 50) valKey = 50;

        this.key = valKey;

        this.encodedMessage = encode(message, valKey);
    }

    @Override
    public void setDecodedMessage(String message, int key)
    {
        this.decodedMessage = decode(message, key);
    }

    private String encode(String message, int key)
    {
        messageAscii = getStringAsAsciiArray(message);
        String encodedMsg;

        StringBuilder sb = new StringBuilder();

        for (int j : messageAscii) {
            int asciiID = checkWrapInt(j + key);

            char newChar = (char) asciiID;

            sb.append(newChar);
        }

        encodedMsg = sb.toString();

        return encodedMsg;
    }

    private String decode(String message, int key)
    {
        messageAscii = getStringAsAsciiArray(message);
        String decodedMessage;

        StringBuilder sb = new StringBuilder();

        for (int j : messageAscii) {
            int asciiID = checkWrapInt(j - key);

            char newChar = (char) asciiID;

            sb.append(newChar);
        }

        decodedMessage = sb.toString();

        return decodedMessage;
    }

    private int checkWrapInt(int value)
    {
        int newVal = value;

        if(value > 126)
        {
            newVal -= 126;
            newVal += 31;
        }
        else if(value < 32)
        {
            newVal += 126;
            newVal -= 31;
        }

        return newVal;
    }

    private int[] getStringAsAsciiArray(String message)
    {
        int[] asciiArray = new int[message.length()];

        for(int i = 0; i < message.length(); i++)
        {
            asciiArray[i] = message.charAt(i);
        }

        return asciiArray;
    }

    @Override
    public String getCodedMessage()
    {
        return encodedMessage;
    }

    @Override
    public String getDecodedMessage()
    {
        return decodedMessage;
    }

    @Override
    public int getKey()
    {
        return key;
    }
}

                          

This is the manager side for the Natual Language Processing of the text based adventure game.

using System.Collections.Generic;

namespace Swardson_TextBased_Game
{
    public class CommandManager
    {
        List commands = new List();
        public List nonTriggerCommands = new List();

        ICommand confusedCommand = new ConfusedCommand();

        public CommandManager()
        {
            commands = new List
            {
                new SayHello(new string[] {"hello", "hey", "yo", "sup", "greetings", "howdy", "welcome"}),
                new RequestRemoveItem(new string[] {"rid item", "remove item", "kill item", "drop item", "lose item", "murder item"}),
                new SayLocation(new string[] {"where you", "what location", "location", "what spot", "spot", "can't find"}),
                new RequestTravel(new string[] {"where you go", "you move", "you go", "you travel", "go somewhere"}),
                new RequestAddItem(new string[] {"find item", "look item", "locate item", "add item"}),
                new RequestHide(new string[] {"you hide", "hide", "hidden", "find hiding spot"}),
                new SearchForHiddenItem(new string[] {"look item", "search item", "there item", "there something"}),
                new StopHiding(new string[] {"stop hiding", "leave", "quit hiding", "no more hiding", "get out"})
            };

            nonTriggerCommands = new List
            {
                new RemoveItem(),
                new Travel(),
                new AddItem(),
                new RequestFail(),
                new Hide()
            };
        }

        //loops through my commands and finds which one the input is closest to.
        public ICommand CheckCommands(int weight, string input)
        {
            ICommand closestCommand = new EmptyCommand();
            bool commandFound = false;

            //loops through all of my commands
            for (int i = 0; i < commands.Count; i++)
            {
                //compares my input with all command execute text and checks if they are 
                // close to each other. Returns the closest command if so.
                for (int x = 0; x < commands[i].CommandTriggers.Length; x++)
                {
                    float percent = Comparer.StringCompare(input, commands[i].CommandTriggers[x]);

                    //If a command is found, run it's code.
                    if(percent >= weight)
                    {
                        closestCommand = commands[i];
                        commandFound = true;

                        //stops this loop if a command is found
                        break;
                    }
                    else
                    {
                        commandFound = false;
                        continue;
                    }
                }

                //stops looking if a command is found
                if(commandFound)
                {
                    break;
                }
            }

            if(!commandFound)
            {
                closestCommand = confusedCommand;
            }

            return closestCommand;
        }
    }
}
                          

Thank you for reading this far about GUI Programs. You can find the source code for the projects here, here, and here.