Showing posts with label DIY. Show all posts
Showing posts with label DIY. Show all posts

Monday, February 13, 2023

Constructing A Gameshow + Finalizing the Card the Creator

 Welcome to the Blog!


Quote of the Week:
If I think my brain is Michael Jordan, that means I'm Michael Jordan
-An Online Classmate 

This previous week was pretty hectic, so I didn't get to do any lessons in C++. However I did finalize the designs for the Personal Pokémon Card Creator. I've also been working on a gameshow project called "Thrown Remotes". The screenshot above is a very early rough draft of how a question will look. 

The finalized version of the PPCC outputs a card front and back onto a webpage specific to it. This includes the weaknesses and resistances of the card and a backing that looks similar to the actual Pokémon card, with a degenerate easter egg.

This is a drastically shorter post than usually, but I hope you guys can wait until next week, when we'll get back into the swing of things. 

-Peace💣


Monday, February 6, 2023

Code Theory and Mediating a Code Car.

 Welcome to the Blog!



This previous week we mainly focused on code structures, such as "Singleton" and "Mediators." This was harder to grasp than pointers, believe it or not. I get them in concept but using them in practice might prove to be a harder beast to tame. Let's get into it.

Quote of the Week:
Yu-gi-oh is like playing Pokémon without the fun.
-Game Club Member.

So we first started with a singleton. This structure mainly focused on making sure there was only one instance of the code running at once or determining how many instances of the code are currently running. I made my own version of their "planets" code. This was to make it easier to understand and give me more experience with the structure. I'll put both in.

My Code:
#include <iostream>

using namespace std;

class instanceObj {
private:
string catName = "Default";
int instanceCounter = 0;
public:
instanceObj(string name);
int increase(int val);
int showCount();
};

instanceObj::instanceObj(string name)
{
catName = name;
cout << "Let's Begin" << endl;
}

int instanceObj::increase(int val)
{
instanceCounter += val;
return 0;
}

int instanceObj::showCount()
{
cout << catName << " Jumped " << instanceCounter << " Times!" << endl;
return instanceCounter;
}


int main() {
instanceObj catJump("Gerald");
catJump.increase(4);
catJump.showCount();

};

Their Code:

class Planet {
private:
static Planet* inst;
Planet(string name) {
cout << "Welcome to " << name << endl;
} // Pre-Constuctor
~Planet() {} //Deconstructor
public :
static Planet* GetInstance(string name);
};

Planet *Planet:: inst = 0;

Planet* Planet::GetInstance(string name) 
{
if (inst == 0) {
inst = new Planet(name);
}
return inst;
}


int main() {
Planet *MyPlanet = Planet::GetInstance("Earth");
cout << "MyPlanet address: " << MyPlanet << endl;

Planet* MyPlanet2 = Planet::GetInstance("Uranus");
cout << "MyPlanet address: " << MyPlanet2 << endl;
return 0;
}


Then I proceeded to go through observers and mediators, theses were initially pretty difficult to grasp, but in the end, I found that they're pretty self-explanatory. The observers look into your code and decide if anything is going unexpectedly or if it takes information from a class to put inside another. The mediators act as a backbone, where you make a flowchart esk diagram and make the program and classes from that. 
The example they gave was pretty lengthy, in which you were to design a hypothetical car. Due to the vast size of the example, I'll only include the header file. This should give you an idea of how big the system is.

Code:

#ifndef MEDIATOR_H_INCLUDED
#define MEDIATOR_H_INCLUDED

class CarPart;
class Engine;
class Electric;
class Radio;
class SteeringWheel;
class Wheels;
class Brakes;
class Headlights;
class AirConditioner;
class Road;

class Mediator {
public:
Engine* myEngine;
Electric* myElectric;
Radio* myRadio;
SteeringWheel* mySteeringWheel;
Wheels* myWheels;
Brakes* myBrakes;
Headlights* myHeadlights;
AirConditioner* myAirConditioner;
Road* myRoad;
Mediator();
void partChanged(CarPart* part);
};

class CarControls : public Mediator {
public:
void startCar();
void stopCar();
void pushGasPedal(int amount);
void releaseGasPedal(int amount);
void pressBrake(int amount);
void turn(int amount);
void turnOnRadio();
void turnOffRadio();
void adjustRadioVolume(int amount);
void turnOnHeadlights();
void turnOffHeadlights();
void climbHill(int angle);
void descendHill(int angle);
void turnOnAC();
void turnOffAC();
void adjustAC(int amount);
int getSpeed();
CarControls() : Mediator() {}
};

#endif // MEDIATOR_H_INCLUDED

Other than that, nothing code focused really happened. Other than new ideas for robots and tweaking some older projects here and there. Maybe next week, I'll post about one of those.

Until Next Time, Peace!💣

Wednesday, December 28, 2022

Personal Pokémon Card Creator

Imagine if you could answer a few questions and have your own Pokemon card with your own type based on your personality. 

That's what I've created! I'm Patrick, and this is the PPCC.



This project came to me when I was talking to a friend during a CAB meeting. She suggested a Pokemon type quiz, and I was like, "Damn, that's a great idea." so I started making it, and to start off, it was pretty rough. I first discovered all the types of pokemon from the newest Pokemon game. I found there were 18 different types. Then I was ready to calculate and get them all into a list. However, I ran into a big issue.

    The Pokemon TGC only has 11 of the 18 types... yeah a lot of calculations had to be redone. After that, though the typing pool was the following.

(Normal, Fire, Water, Grass, Fighting, Psychic, Steel, Electric, Fairy, Dark, Dragon)

 The type is calculated by your choices in the quiz. The quiz starts after you press the "Press Here to Start!" button.


There are 6 questions, and each has 4 answers. There is no wrong answer to these questions, but depending on the one you choose, will determine what type you are. The maximum number of points you can amass from these questions is 30; receiving that amount will make you a 'Dragon' type.

The answers count for either 0, 1, 2, or 5. The points from each answer will be added up in the end, giving you a number that determines your type. These numbers may seem arbitrary at first, but it ensures that most of the numbers summed will be accounted for.


Then you will receive your type and have the option of getting your card created. This allows people to decide if they want a card of that type or try again. If you are content with your type, you can press the "Press Here to make Your Own Card!" button.

The camera hooked up to the computer will then take a picture of you and paste that onto a card of that type. This card will also display your name given at the start, so the final result will look a little like this.


There you go, your very own Pokemon card. It can be printed out on a printer at the user's discretion. 

I will post the source code to this sometime after I show it off at a comic-con. However, if you want to know what development libraries I used and what language + interpreter I used, they can be found below.

Thanks for Reading!💣


Programming Language: Python 3.7

IDE: PyCharm Community Edition 2021

Libraries: OpenCV and Tkinter

Script Count: 3

Time to Complete: 2 weeks + 4 days 

Sunday, June 26, 2022

6/26/22: Another Lazy Sunday.

 Hey,

Today was a relaxing day full of working on projects and playing Halo Infinite. I started off the day by printing out two more pieces of the halo helmet project while waiting for the FASFA site to not have maintenance going on. It was kinda wonky cause it said maintenance was going on during "June 19th". I'm thinking to myself, "Wait a minute, it's the 26th!?".

After getting through those two things, I worked on fixing a push-button light I bought at a thrift store. You can see a picture of it down below. It was only a dollar, so I thought it would be a fun side project. The first trouble we ran into was I didn't have any AA batteries, which it needed 4 of to operate. To solve this without spending more money, I resoldered the wires to a 9V. I don't know how stable of an option this is, but for right now, it works expertly. No explosions, yet fingers crossed! 

Then putting the button back together was HELL. This was due to the springs constantly falling out and the screws being stripped (They were stripped when I got it). However, after all of that, we now have it working. I might use it in a 3D print or cosplay in the future.


Then, as I round off the day, I finished the base for Raiden's Shoulder Armor, which is pretty tough without a helper.
-Peace


DOCTOR! The Calculator is Terminal!! The C++ variety ;)

    Hello, and Welcome to my Blog!  If you're a returning visitor, ...Hello Again! Quote of the Week: ..but fear itself isn't worthy...