Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Kolsulfr

Pages: [1]
1
Science / Re: Alien Megastructure?
« on: January 10, 2016, 05:18:58 pm »
Depends entirely on how you look at it, the chance that we are alone is actually much smaller, these stories I agree hold no real fundament.
We are not special, if it happens here it probably happens throughout the universe.

I modified the last line of my previous post, the way I worded it was a bit confusing.

I don't disagree, it is indeed highly unlikely we're alone. I just can't stand it when people spread misinformation without taking the time to actually check the core source(s) and get the actual probability before going into a craze about situations they don't understand. Especially when the researchers themselves don't claim to understand it yet.

2
Science / Re: Alien Megastructure?
« on: January 09, 2016, 10:54:16 pm »
These kinds of stories irritate me to no end. Particularly because whenever I hear a story like this I usually take the time to find the root source the information is being extracted from and it's almost never anything remotely like what the fucking articles make it out to be. All I seem to be finding on it right now is a mountain of craze-spawned articles from misleading news sites (the good ones), shitty news sites, and mostly completely worthless pseudo-news sites. But (exaggerated) from what I remember, and how it usually seems to go...

Researcher 1: Hm, that's fucking strange, we haven't seen anything quite like this before, can't figure out an explanation for this one yet.

Researcher 2: What if it's like, an alien mega-structure?.

Researcher 1: Well, usually I'd beat you to death with a fucking shovel for even recommending that, but this time I'd estimate there's about a %0.00000000000843 chance of aliens, so, it's not a flat 0, it's feasible enough to be considered.

Guys Who Look for Aliens: Shit, we might as well take a look, it's the only vaguely promising lead we've got.

News Sites: Legitimate scientists used the words alien mega-structure with an ENTIRELY different tone then how we're about to present it! But that's irrelevant! Read our articles!

Conspiracy Sites and Random Simple Minded Dipshits: OH MY GOD THEY FOUND A FUCKING ALIEN MEGASTRUCTURE JESUS FUCK IT'S REAL THIS IS HAPPENING SOMEONE IN NASA SAID ALIEN THAT MEANS THEY'RE REAL AND WE REALLY FOUND THEM THIS TIME AAAAAAAHHHHHHHHHHCEFSEFC!!!



I'm sure there's life out there somewhere, it's extremely improbable we're alone, but fuck.

3
General discussion / Re: What Inspired You?
« on: January 09, 2016, 06:12:58 pm »
I've always been pretty heavily exposed to computers. My dad got into computation back before personal computers and used to program in COBOL, (he's currently a sysadmin for United Launch Alliance) so, I just sort of grew up with it.

Started fucking with them pretty much as soon as I was capable of full coherent functioning and at a pretty early age I used to find ways inside my parents computer (by sheer force of curiosity and tinkering with shit, I guess.) Didn't do much of anything, just sort of moved things around, deleted files, created files, and generally fucked shit up, but that sort of got the ball rolling.

At around 12 my dad got me a copy of RHEL and a book on C that was very much not geared towards someone my age and left me to my own devices with it. Absolutely loved it; learned how to work the terminal and started doing absolutely everything I could through it while I was learning to code. Enjoyed the fuck out of that for a while, but at some point it fell off. Really wish I'd stuck with it then. But the spark has very much been rekindled.

Recently came across a piece of code I wrote back then... It's pretty horrible, but I was 12 and only had about 6 chapters of C under my belt with no other experience. Just over 1000 lines, all in a single gigantic function. Hah....

Code: [Select]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
#include <time.h>


int main(void)
{
char line[100];
int HP = 1000;
int MAXHP = 1000;
int ATTACK = 3;
int room = 0;
int level = 1;
float gold = 0;
int exp = 0;
int maxexp = 0;
int DEFENCE = 3;
int MOBHP = 1000;
int MOBATTACK = 3;
int MOBDEFENCE = 3;
int MINHIT = 0;
int MAXHIT = 0;
int MOBMIN = 0;
int MOBMAX = 0;
int MAXHITX = 0;
int MOBMAXX = 0;
int choose = 0;
int hit = 0;
char BLANK = 0;
time_t now = 0;
char choosechar;
/*RANDOM ITEMS*/
int bladeofwrath = 0;
int explosivegoo = 0;
/*Equipment*/
int weapon = 0;
char weaponname[20];
int armour = 0;
char armourname[20];

armour = 1;
weapon = 1;
armourname[0] = 'T';
armourname[1] = 'a';
armourname[2] = 't';
armourname[3] = 't';
armourname[4] = 'e';
armourname[5] = 'r';
armourname[6] = 'e';
armourname[7] = 'd';
armourname[8] = ' ';
armourname[9] = 'C';
armourname[10] = 'l';
armourname[11] = 'o';
armourname[12] = 't';
armourname[13] = 'h';
armourname[14] = ' ';
armourname[15] = ' ';
armourname[16] = ' ';
armourname[17] = ' ';
armourname[18] = ' ';
armourname[19] = ' ';

weaponname[0] = 'F';
weaponname[1] = 'i';
weaponname[2] = 's';
weaponname[3] = 't';
weaponname[4] = 's';
weaponname[5] = ' ';
weaponname[6] = ' ';
weaponname[7] = ' ';
weaponname[8] = ' ';
weaponname[9] = ' ';
weaponname[10] = ' ';
weaponname[11] = ' ';
weaponname[12] = ' ';
weaponname[13] = ' ';
weaponname[14] = ' ';
weaponname[15] = ' ';
weaponname[16] = ' ';
weaponname[17] = ' ';
weaponname[18] = ' ';
weaponname[19] = ' ';

now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\n\n\nYou don't know where you are or how you got here..........\n\n\n");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\n\n\nYou don't know why you are here..........\n\n\n");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\n\n\nYou slowly wake up..........\n\n\n");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );


Room:
{
printf("\n\n\n\n                                       N\n ");
printf("            /-----\\\n                    /   #   \\\n :::::An o");
printf("gres cave:::::           |   #   |\n                    |   @");
printf("   |  \n                    |       |\n         ");
printf("           \\       /\n             \\-----/\n           ");
printf("                             \n\nYou are in a cave, you don't know how y");
printf("ou got here.\nBut what you do know is a huge ogre is standing right next");
printf(" to you,\nstaring at you.\nWill you stay and fight or try to run?\n\n ");
printf(" Exits: North(N)\n Other options: Attack the ogre!(");
printf("A)\n\n");
printf(" (Type 'H' for a list of commands.)\n\n\n");
RoomCommand:
printf("\n");
fgets(line,sizeof(line),stdin);
sscanf(line,"%c", &choosechar);
switch(choosechar)
{
case 'A': case 'a':
goto BattleA_Huge_Ogre;
case 'N': case 'n':
goto Run;
case 'H': case 'h':
{
printf("\n\n\nCommands:\nThis menu(H)\nLook(O)\nHow much gold you have(G)\nYour stats(Y)\nYour items(I)\nExpirience(L)\n\n\n");
goto RoomCommand;
}
case 'G': case 'g':
{
printf("\n\n\nYou currently have %f gold.\n\n\n", gold);
goto RoomCommand;
}
case 'Y': case 'y':
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
printf("\n\n\n\nYour stats:\n\n");
printf(" Level: %d\n\n Attack: %d\n\n Defence: %d\n\n Damage: %d-%d\n\n\n", level, ATTACK, DEFENCE, MINHIT, MAXHIT);
goto RoomCommand;
}
case 'I': case 'i':
{
printf("\n\n\nWeapon: %s\n Weapon Attack Power: %d\n\nArmour: %s\n Armour Defence Power %d\n\n\n",weaponname ,weapon ,armourname ,armour);
goto RoomCommand;
}
case 'L': case 'l':
{
printf("\n\n\nLevel: %d | Exp: %d | Exp to level : %d\n\n\n", level, exp, maxexp * maxexp * 100 / 7 * 10 - exp);
goto RoomCommand;
}
case'O': case'o':
{
goto Room;
}
default:
{
printf("\n\n\nInvalid command!\n\n\n\a");
goto Room;
}
}
}

Room1:
{
printf("\n\n\n\n                                       N\n ");
printf("            /-----\\\n                    /   #   \\\n :::::An o");
printf("gres cave:::::           |   #   |\n                    |   @");
printf("   |  \n                    |       |\n         ");
printf("           \\       /\n             \\-----/\n           ");
printf("                             \n\nYou are in a cave.\n\n");
printf(" Exits: North(N)");
printf("\n\n\n");
Room1Command:
printf("\n");
fgets(line,sizeof(line),stdin);
sscanf(line,"%c", &choosechar);
switch(choosechar)
{
case 'N': case 'n':
goto Room2;
case 'H': case 'h':
{
printf("\n\n\nCommands:\nThis menu(H)\nLook(O)\nHow much gold you have(G)\nYour stats(Y)\nYour items(I)\nExpirience(L)\n\n\n");
goto Room1Command;
}
case 'G': case 'g':
{
printf("\n\n\nYou currently have %f gold.\n\n\n", gold);
goto Room1Command;
}
case 'Y': case 'y':
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
printf("\n\n\n\nYour stats:\n\n");
printf(" Level: %d\n\n Attack: %d\n\n Defence: %d\n\n Damage: %d-%d\n\n\n", level, ATTACK, DEFENCE, MINHIT, MAXHIT);
goto Room1Command;
}
case 'I': case 'i':
{
printf("\n\n\nWeapon: %s\n Weapon Attack Power: %d\n\nArmour: %s\n Armour Defence Power %d\n\n\n",weaponname ,weapon ,armourname ,armour);
goto Room1Command;
}
case 'L': case 'l':
{
printf("\n\n\nLevel: %d | Exp: %d | Exp to level : %d\n\n\n", level, exp, maxexp * maxexp * 100 / 7 * 10 - exp);
goto Room1Command;
}
case'O': case'o':
{
goto Room1;
}
default:
{
printf("\n\n\nInvalid command!\n\n\n\a");
goto Room1;
}
}
}

Room2:
{
printf("\n\n\n                                       N\n             /-----\\\n    ");
printf("                 /   #   \\\n :::::Outside the ogres cave:::::  |   #   |\n                  W |###@###| E\n ");
printf("                    |   #   |\n                    \\   #   /\n             \\-----/\n          ");
printf("                             S\n\nYou are outside of the ogres cave, you have successfully beaten ");
printf("him.\nYou are in the middle of nowhere in the mounta");
printf("ins.\nThere is a large glowing crystal on a rock.");
if(HP <= 100)
{
printf("\nBlood drips from a large wound in your side.");
}
printf("\nWhat will you do now?\n\n Exits: North(N), East(E), South(S), West(W).");
printf(" \n Other options: Touch the crystal(T)\n\n\n");
Room2Command:
printf("\n");
fgets(line,sizeof(line),stdin);
sscanf(line,"%c", &choosechar);
switch(choosechar)
{
case 'N': case 'n':
{
switch(explosivegoo)
{
case 1:
goto Insectking2;
default:
goto Insectking;
}
}
case 'E': case 'e':
{
switch(bladeofwrath)
{
case 1:
goto Bladeofwrath2;
default:
goto Bladeofwrath;
}
}
case 'W': case 'w':
goto Steeprockypass;
case 'S': case 's':
goto Room1;
case 'T': case 't':
{
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\nYou touch the crystal and it heals you fully!\n");
HP = MAXHP;
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto Room2;
}
case 'H': case 'h':
{
printf("\n\n\nCommands:\nThis menu(H)\nLook(O)\nHow much gold you have(G)\nYour stats(Y)\nYour items(I)\nExpirience(L)\n\n\n");
goto Room2Command;
}
case 'G': case 'g':
{
printf("\n\n\nYou currently have %f gold.\n\n\n", gold);
goto Room2Command;
}
case 'Y': case 'y':
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
printf("\n\n\n\nYour stats:\n\n");
printf(" Level: %d\n\n Attack: %d\n\n Defence: %d\n\n Damage: %d-%d\n\n\n", level, ATTACK, DEFENCE, MINHIT, MAXHIT);
goto Room2Command;
}
case 'I': case 'i':
{
printf("\n\n\nWeapon: %s\n Weapon Attack Power: %d\n\nArmour: %s\n Armour Defence Power %d\n\n\n",weaponname ,weapon ,armourname ,armour);
goto Room2Command;
}
case 'L': case 'l':
{
printf("\n\n\nLevel: %d | Exp: %d | Exp to level : %d\n\n\n", level, exp, maxexp * maxexp * 100 / 7 * 10 - exp);
goto Room2Command;
}
case'O': case'o':
{
goto Room2;
}
default:
{
printf("\n\n\nInvalid command!\n\n\n\a");
goto Room2;
}
}
}

Run:
{
printf("\n\nYou: RUN AWAY!!! O.O\n*You run away*\n");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("A Huge Ogre has caught you and torn you in two!\n");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto Dead;
}

Dead:
{
printf("\n\nYou drift into death...");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\nBlackness takes over...\n");
fgets(line,sizeof(line),stdin);
Deader:
sscanf(line,"%c", &BLANK);
goto Deader;
}

Death:
{
printf("\n\nYou drift into death...");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\nBlackness takes over...\n");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
}
Insectking:
{
printf("\n\n\n\n                                        \n             /-----\\\n           ");
printf("         /       \\\n :::::The insect king:::::         |       |\n                    |   @   |  \n   ");
printf("                 |   #   |\n                    \\   #   /\n             \\-----/\n           ");
printf("                            S\n\nYou are in a crypt, rotting skeletons are covering the ground almost entirely.\nThere is a foul s");
printf("tench in the air, it wreaks of decay.\nInfront of you stands the biggest preying mantis you have ever seen!\nHe looks at you with ");
printf("a face you don't quite understand.\n\n Exits: South(S)\n Other options: Attack the insect king!(A)\n\n\n");
InsectkingCommand:
printf("\n");
fgets(line,sizeof(line),stdin);
sscanf(line,"%c", &choosechar);
switch(choosechar)
{
case 'S': case 's':
goto Room2;
case 'A': case 'a':
{
MOBHP = 10000000;
MOBATTACK = 9;
goto BattleInsect_King;
}
case 'H': case 'h':
{
printf("\n\n\nCommands:\nThis menu(H)\nLook(O)\nHow much gold you have(G)\nYour stats(Y)\nYour items(I)\nExpirience(L)\n\n\n");
goto InsectkingCommand;
}
case 'G': case 'g':
{
printf("\n\n\nYou currently have %f gold.\n\n\n", gold);
goto InsectkingCommand;
}
case 'Y': case 'y':
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
printf("\n\n\n\nYour stats:\n\n");
printf(" Level: %d\n\n Attack: %d\n\n Defence: %d\n\n Damage: %d-%d\n\n\n", level, ATTACK, DEFENCE, MINHIT, MAXHIT);
goto InsectkingCommand;
}
case 'I': case 'i':
{
printf("\n\n\nWeapon: %s\n Weapon Attack Power: %d\n\nArmour: %s\n Armour Defence Power %d\n\n\n",weaponname ,weapon ,armourname ,armour);
goto InsectkingCommand;
}
case 'L': case 'l':
{
printf("\n\n\nLevel: %d | Exp: %d | Exp to level : %d\n\n\n", level, exp, maxexp * maxexp * 100 / 7 * 10 - exp);
goto InsectkingCommand;
}
case'O': case'o':
{
goto Insectking;
}
default:
{
printf("\n\n\nInvalid command!\n\n\n\a");
goto Insectking;
}
}
}
Insectking2:
{
printf("\n\n\n\n                                        \n             /-----\\\n     ");
printf("               /       \\\n :::::Empty crypt:::::             |       |\n                    |   @   |  \n ");
printf("                    |   #   |\n                    \\   #   /\n             \\-----/\n ");
printf("                                      S\n\nYou are in a crypt, rotting skeletons are covering the ground almost entirely.\nThere");
printf(" is a foul stench in the air, it wreaks of decay.\n\n Exits: South(S)\n\n\n");
Insectking2Command:
printf("\n");
fgets(line,sizeof(line),stdin);
sscanf(line,"%c", &choosechar);
switch(choosechar)
{
case 'S': case 's':
goto Room2;
case 'H': case 'h':
{
printf("\n\n\nCommands:\nThis menu(H)\nLook(O)\nHow much gold you have(G)\nYour stats(Y)\nYour items(I)\nExpirience(L)\n\n\n");
goto Insectking2Command;
}
case 'G': case 'g':
{
printf("\n\n\nYou currently have %f gold.\n\n\n", gold);
goto Insectking2Command;
}
case 'Y': case 'y':
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
printf("\n\n\n\nYour stats:\n\n");
printf(" Level: %d\n\n Attack: %d\n\n Defence: %d\n\n Damage: %d-%d\n\n\n", level, ATTACK, DEFENCE, MINHIT, MAXHIT);
goto Insectking2Command;
}
case 'I': case 'i':
{
printf("\n\n\nWeapon: %s\n Weapon Attack Power: %d\n\nArmour: %s\n Armour Defence Power %d\n\n\n",weaponname ,weapon ,armourname ,armour);
goto Insectking2Command;
}
case 'L': case 'l':
{
printf("\n\n\nLevel: %d | Exp: %d | Exp to level : %d\n\n\n", level, exp, maxexp * maxexp * 100 / 7 * 10 - exp);
goto Insectking2Command;
}
case'O': case'o':
{
goto Insectking2;
}
default:
{
printf("\n\n\nInvalid command!\n\n\n\a");
goto Insectking2;
}
}
}
Bladeofwrath:
{
printf("\n\n\n\n                                        \n             /-----\\\n             ");
printf("       /       \\\n :::::The blade of wrath!:::::     |       |\n                  W |###@   |  \n     ");
printf("               |       |\n                    \\       /\n             \\-----/\n              ");
printf("                          \n\nInfront of you lays the legendary blade of wrath.\nThe blade shimmers in the faint light of the cave se");
printf("eming to\nilluminate the room with a beutifull, yet evil glow.\n\n Exits: West(W)\n Other options: Take th");
printf("e blade of wrath!(B)\n\n\n");
BladeofwrathCommand:
printf("\n");
fgets(line,sizeof(line),stdin);
sscanf(line,"%c", &choosechar);
switch(choosechar)
{
case 'W': case 'w':
goto Room2;
case 'B': case 'b':
{
weapon = 80000;
weaponname[0] = 'B';
weaponname[1] = 'l';
weaponname[2] = 'a';
weaponname[3] = 'd';
weaponname[4] = 'e';
weaponname[5] = ' ';
weaponname[6] = 'o';
weaponname[7] = 'f';
weaponname[8] = ' ';
weaponname[9] = 'W';
weaponname[10] = 'r';
weaponname[11] = 'a';
weaponname[12] = 't';
weaponname[13] = 'h';
weaponname[14] = ' ';
weaponname[15] = ' ';
weaponname[16] = ' ';
weaponname[17] = ' ';
weaponname[18] = ' ';
weaponname[19] = ' ';
bladeofwrath = 1;
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\nYou take the blade of wrath! You feel its powers rushing through your veins!\n(+80,000 attack power)\n");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto Bladeofwrath2;
}
case 'H': case 'h':
{
printf("\n\n\nCommands:\nThis menu(H)\nLook(O)\nHow much gold you have(G)\nYour stats(Y)\nYour items(I)\nExpirience(L)\n\n\n");
goto BladeofwrathCommand;
}
case 'G': case 'g':
{
printf("\n\n\nYou currently have %f gold.\n\n\n", gold);
goto BladeofwrathCommand;
}
case 'Y': case 'y':
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
printf("\n\n\n\nYour stats:\n\n");
printf(" Level: %d\n\n Attack: %d\n\n Defence: %d\n\n Damage: %d-%d\n\n\n", level, ATTACK, DEFENCE, MINHIT, MAXHIT);
goto BladeofwrathCommand;
}
case 'I': case 'i':
{
printf("\n\n\nWeapon: %s\n Weapon Attack Power: %d\n\nArmour: %s\n Armour Defence Power %d\n\n\n",weaponname ,weapon ,armourname ,armour);
goto BladeofwrathCommand;
}
case 'L': case 'l':
{
printf("\n\n\nLevel: %d | Exp: %d | Exp to level : %d\n\n\n", level, exp, maxexp * maxexp * 100 / 7 * 10 - exp);
goto BladeofwrathCommand;
}
case'O': case'o':
{
goto Bladeofwrath;
}
default:
{
printf("\n\n\nInvalid command!\n\n\n\a");
goto Bladeofwrath;
}
}
}
Bladeofwrath2:
{
printf("\n\n\n\n                                        \n             /-----\\\n           ");
printf("         /       \\\n :::::A cave:::::                  |       |\n                  W |###@   |  \n   ");
printf("                 |       |\n                    \\       /\n             \\-----/\n          ");
printf("                              \n\nYou are in a completely empty cave!\n\n Exits: West(W)\n");
printf("\n\n\n");
Bladeofwrath2Command:
printf("\n");
fgets(line,sizeof(line),stdin);
sscanf(line,"%c", &choosechar);
switch(choosechar)
{
case 'W': case 'w':
goto Room2;
case 'H': case 'h':
{
printf("\n\n\nCommands:\nThis menu(H)\nLook(O)\nHow much gold you have(G)\nYour stats(Y)\nYour items(I)\nExpirience(L)\n\n\n");
goto Bladeofwrath2Command;
}
case 'G': case 'g':
{
printf("\n\n\nYou currently have %f gold.\n\n\n", gold);
goto Bladeofwrath2Command;
}
case 'Y': case 'y':
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
printf("\n\n\n\nYour stats:\n\n");
printf(" Level: %d\n\n Attack: %d\n\n Defence: %d\n\n Damage: %d-%d\n\n\n", level, ATTACK, DEFENCE, MINHIT, MAXHIT);
goto Bladeofwrath2Command;
}
case 'I': case 'i':
{
printf("\n\n\nWeapon: %s\n Weapon Attack Power: %d\n\nArmour: %s\n Armour Defence Power %d\n\n\n",weaponname ,weapon ,armourname ,armour);
goto Bladeofwrath2Command;
}
case 'L': case 'l':
{
printf("\n\n\nLevel: %d | Exp: %d | Exp to level : %d\n\n\n", level, exp, maxexp * maxexp * 100 / 7 * 10 - exp);
goto Bladeofwrath2Command;
}
case'O': case'o':
{
goto Bladeofwrath2;
}
default:
{
printf("\n\n\nInvalid command!\n\n\n\a");
goto Bladeofwrath2;
}
}
}
Steeprockypass:
{
printf("\n\n\n\n                                        \n             /-----\\\n             ");
printf("       /       \\\n :::::A rockslide:::::             |       |\n                    |   @###| E\n     ");
printf("               |       |\n                    \\       /\n             \\-----/\n             ");
printf("                           \n\nA rockslide appears to have blocked this path off.\n\n Exits: East(E)\n Othe");
printf("r options: Blow up the wall!(B)(Requires Explosive Goo)\n\n\n");
SteeprockypassCommand:
printf("\n");
fgets(line,sizeof(line),stdin);
sscanf(line,"%c", &choosechar);
switch(choosechar)
{
case 'E': case 'e':
goto Room2;
case 'H': case 'h':
{
printf("\n\n\nCommands:\nThis menu(H)\nLook(O)\nHow much gold you have(G)\nYour stats(Y)\nYour items(I)\nExpirience(L)\n\n\n");
goto SteeprockypassCommand;
}
case 'G': case 'g':
{
printf("\n\n\nYou currently have %f gold.\n\n\n", gold);
goto SteeprockypassCommand;
}
case 'Y': case 'y':
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
printf("\n\n\n\nYour stats:\n\n");
printf(" Level: %d\n\n Attack: %d\n\n Defence: %d\n\n Damage: %d-%d\n\n\n", level, ATTACK, DEFENCE, MINHIT, MAXHIT);
goto SteeprockypassCommand;
}
case 'I': case 'i':
{
printf("\n\n\nWeapon: %s\n Weapon Attack Power: %d\n\nArmour: %s\n Armour Defence Power %d\n\n\n",weaponname ,weapon ,armourname ,armour);
goto SteeprockypassCommand;
}
case 'L': case 'l':
{
printf("\n\n\nLevel: %d | Exp: %d | Exp to level : %d\n\n\n", level, exp, maxexp * maxexp * 100 / 7 * 10 - exp);
goto SteeprockypassCommand;
}
case'O': case'o':
{
goto Steeprockypass;
}
default:
{
printf("\n\n\nInvalid command!\n\n\n\a");
goto Steeprockypass;
}
case 'B': case 'b':
switch(explosivegoo)
{
case 1:
{
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\n*!!!BOOM!!!*");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\nYou blow a hole in the wall and walk through.\n");
printf("*!!!THE WALL COLLAPES!!!\a*");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto Darkroom;
}
default:
{
printf("\nYou cant do that!\a\n");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto Steeprockypass;
}
}
}
Darkroom:
{
printf("\n\n\n\n                                        \n             /-----\\\n");
printf("         /#######\\\n :::::Dark cave:::::               |#######|\n                    |#######|  \n");
printf("                   |#######|\n                    \\#######/\n             \\-----/\n");
printf("                           \n\nThere is a faint light glowing, You don't know where it's coming from.\nIt is cold and damp.\n\n");
printf(" Exits: If there are any, you can't see them.\n\n\n");
DarkroomCommand:
printf("\n");
fgets(line,sizeof(line),stdin);
sscanf(line,"%c", &choosechar);
switch(choosechar)
{
case 'W': case 'w':
goto Dimroom;
case 'H': case 'h':
{
printf("\n\n\nCommands:\nThis menu(H)\nLook(O)\nHow much gold you have(G)\nYour stats(Y)\nYour items(I)\nExpirience(L)\n\n\n");
goto DarkroomCommand;
}
case 'G': case 'g':
{
printf("\n\n\nYou currently have %f gold.\n\n\n", gold);
goto DarkroomCommand;
}
case 'Y': case 'y':
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
printf("\n\n\n\nYour stats:\n\n");
printf(" Level: %d\n\n Attack: %d\n\n Defence: %d\n\n Damage: %d-%d\n\n\n", level, ATTACK, DEFENCE, MINHIT, MAXHIT);
goto DarkroomCommand;
}
case 'I': case 'i':
{
printf("\n\n\nWeapon: %s\n Weapon Attack Power: %d\n\nArmour: %s\n Armour Defence Power %d\n\n\n",weaponname ,weapon ,armourname ,armour);
goto DarkroomCommand;
}
case 'L': case 'l':
{
printf("\n\n\nLevel: %d | Exp: %d | Exp to level : %d\n\n\n", level, exp, maxexp * maxexp * 100 / 7 * 10 - exp);
goto DarkroomCommand;
}
case'O': case'o':
{
goto Darkroom;
}
default:
{
printf("\n\n\nInvalid command!\n\n\n\a");
goto Darkroom;
}
}

}
Dimroom:
{
printf("\n\n\n\n                                        \n             /-----\\\n");
printf("         /       \\\n :::::Dim cave:::::                |       |\n                    |   @###| E\n");
printf("                     |       |\n                    \\       /\n             \\-----/\n");
printf("                           \n\nThere is a faint light, You don't know where it's coming from.\nIt is cold and damp.\n\n");
printf(" Exits: East(E)\n\n\n");
DimroomCommand:
printf("\n");
fgets(line,sizeof(line),stdin);
sscanf(line,"%c", &choosechar);
switch(choosechar)
{
case 'E': case 'e':
goto Darkroom;

case 'H': case 'h':
{
printf("\n\n\nCommands:\nThis menu(H)\nLook(O)\nHow much gold you have(G)\nYour stats(Y)\nYour items(I)\nExpirience(L)\n\n\n");
goto DimroomCommand;
}
case 'G': case 'g':
{
printf("\n\n\nYou currently have %f gold.\n\n\n", gold);
goto DimroomCommand;
}
case 'Y': case 'y':
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
printf("\n\n\n\nYour stats:\n\n");
printf(" Level: %d\n\n Attack: %d\n\n Defence: %d\n\n Damage: %d-%d\n\n\n", level, ATTACK, DEFENCE, MINHIT, MAXHIT);
goto DimroomCommand;
}
case 'I': case 'i':
{
printf("\n\n\nWeapon: %s\n Weapon Attack Power: %d\n\nArmour: %s\n Armour Defence Power %d\n\n\n",weaponname ,weapon ,armourname ,armour);
goto DimroomCommand;
}
case 'L': case 'l':
{
printf("\n\n\nLevel: %d | Exp: %d | Exp to level : %d\n\n\n", level, exp, maxexp * maxexp * 100 / 7 * 10 - exp);
goto DimroomCommand;
}
case'O': case'o':
{
goto Dimroom;
}
default:
{
printf("\n\n\nInvalid command!\n\n\n\a");
goto Dimroom;
}
}

}
/*##########################################################################################################*/
/*#################################################@@@@@@@##################################################*/
/*##############@@###########@@######@@@@@@@#######@@@@@@@@@################################################*/
/*##############@@@#########@@@#####@@@@@@@@@######@@@####@@@###############################################*/
/*##############@@@@@#####@@@@@####@@@#####@@@#####@@@#####@@###############################################*/
/*##############@@@@@@###@@@@@@####@@#######@@#####@@@###@@@@###############################################*/
/*##############@@@#@@###@@#@@@###@@@#######@@@####@@@@@@@@@################################################*/
/*##############@@@#@@@#@@@#@@@###@@@#######@@@####@@@@@@@@@################################################*/
/*##############@@@##@@@@@##@@@###@@@#######@@@####@@@###@@@@###############################################*/
/*##############@@@###@@@###@@@####@@#######@@#####@@@#####@@###############################################*/
/*##############@@@####@####@@@####@@@#####@@@#####@@@####@@@###############################################*/
/*##############@@@#########@@@#####@@@@@@@@@######@@@@@@@@@################################################*/
/*##############@@@#########@@@######@@@@@@@#######@@@@@@@##################################################*/
/*##########################################################################################################*/

BattleA_Huge_Ogre:
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
MOBMIN = MOBATTACK * 44;
MOBMAX = MOBATTACK * 66;
MAXHITX = MAXHIT - MINHIT;
MOBMAXX = MOBMAX - MOBMIN;
maxexp *= maxexp * 100 / 7 * 10;

BattleA_Huge_OgreATTACK:
{
if(MOBHP >= 0)
{
hit = (MINHIT + rand()%MAXHITX) - (MOBDEFENCE * 33);
printf("\nYou have just hit A Huge Ogre for: %d\n", hit);
MOBHP = MOBHP - hit;
printf("\n\nYour HP: %d", HP);
printf("\nA Huge Ogres HP: %d\n\n", MOBHP);
if(MOBHP <= 0)
{
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\nYou have successfully killed A Huge Ogre!\n");
printf("\nYou gain 250 exp and 50 gold\n");
exp = exp + 250;
gold = gold + 50;
if(exp >= maxexp)
{
level = level + 1;
exp = 0;
printf("You leveled up! You are now level %d", level);
ATTACK = ATTACK + (level * 0.046);
}
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto Room1;
}
else
{
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto BattleA_Huge_OgreDEFENCE;
}
}
else
printf("\nYou have successfully killed A Huge Ogre!\n");
goto Room2;
}

BattleA_Huge_OgreDEFENCE:
{
if(HP >= 0)
{
hit = (MOBMIN + rand()%MOBMAXX) - (DEFENCE * 33);
printf("\nA Huge Ogre hits you for: %d\n", hit);
HP = HP - hit;
printf("\n\nYour HP: %d", HP);
printf("\nA Huge Ogres HP: %d\n\n", MOBHP);
if(HP <= 0)
{
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\nYou have died!\n");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto Dead;
}
else
{
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto BattleA_Huge_OgreATTACK;
}
}
else
printf("\nYou have died!\n");
goto Dead;
}
}
BattleInsect_King:
{
MINHIT = (ATTACK + weapon) * 44;
MAXHIT = (ATTACK + weapon) * 66;
MOBMIN = MOBATTACK * 44;
MOBMAX = MOBATTACK * 66;
MAXHITX = MAXHIT - MINHIT;
MOBMAXX = MOBMAX - MOBMIN;
maxexp *= maxexp * 100 / 7 * 10;

BattleInsect_KingATTACK:
{
if(MOBHP >= 0)
{
hit = (MINHIT + rand()%MAXHITX) - (MOBDEFENCE * 33);
printf("\nYou have just hit Insect King for: %d\n", hit);
MOBHP = MOBHP - hit;
printf("\n\nYour HP: %d", HP);
printf("\nInsect Kings HP: %d\n\n", MOBHP);
if(MOBHP <= 0)
{
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\nYou have successfully killed Insect King!\n");
printf("\nYou gain 500 exp and 100 gold\n");
exp = exp + 500;
gold = gold + 100;
if(exp >= maxexp)
{
level = level + 1;
exp = 0;
printf("\n\n\nYou just advanced a level! You are now level: %d", level);
ATTACK = ATTACK + (level * 0.046);
}
explosivegoo = 1;
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\nYou have just gained \"Explosive goo!\"");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto Insectking2;
}
else
{
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto BattleInsect_KingDEFENCE;
}
}
else
printf("\nYou have successfully killed A Huge Ogre!\n");
goto Room2;
}

BattleInsect_KingDEFENCE:
{
if(HP >= 0)
{
hit = (MOBMIN + rand()%MOBMAXX) - (DEFENCE * 33);
printf("\nInsect King hits you for: %d\n", hit);
HP = HP - hit;
printf("\n\nYour HP: %d", HP);
printf("\nInsect Kings HP: %d\n\n", MOBHP);
if(HP <= 0)
{
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
printf("\nYou have died!\n");
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto Dead;
}
else
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
now = clock();
for( ;clock() - now < CLOCKS_PER_SEC; );
goto BattleInsect_KingATTACK;
}
else
printf("\nYou have died!\n");
goto Dead;
}
}
}
}

4
Beginner's Corner / [Python] String Encryption (First completed project)
« on: January 08, 2016, 09:33:12 pm »
So, after a couple months of trial and error I've finally got this to the point I feel like I can call it "complete." There are still plenty of things I feel could be cleaner/more logically sound but I've decided to let the obsessive cycle of ripping it apart and putting it back together come to an end and let it be. Feel free to tear it to shreds, the more information I have about what could have been better the better.

It'd be trivial to crack, as I know absolutely nothing about encryption, but it was a fun first project.

Furthermore, it's in desperate need of comments (it has none) and protective measures to make sure you can't throw it inputs that'll break it (and if you do, get a clue as to what broke) but.. Put it off til last and then didn't get around to it. (Python also wasn't the best language for something like this.)

Anyway, first off, practical usage. For both the encrypt and decrypt functions (contained in the main FENRIS.py file) you just throw them a key as well as a string to be encrypted/decrypted, main point to note being the key, the key is a list where the first place contains a variable representing the number of axises you want in the grid (2, 3, 30,000) followed by any number of variables so long as each following variable keeps within the confines of (2 ** the grids dimensions) (the number of possible directions the branch can go towards it's given corner of the grid, but I'll get into that in a minute.)

It also comes with a pre-packaged key generator.

1000 axises with a 1000 step pattern takes about a minute to encrypt a 5 character string, and uses ALL my computers memory, so that's about upper bounds for me. More sensible keys work smoothly enough.

Now, trying to put into words what it does...

Basically, it creates a grid with whatever number of dimensions the user specifies and sends each character out towards the corners of the grid. So, for example, on a 2D grid, it would send the first character out towards (-1,-1), next one out (-1,1), then (1,-1), (1,1), and then the next character would go back over to (-1,-1), "pushing" the previous character out further towards the corner, occupying the space said previous character occupied prior.

It gets the full set of coordinates for all the corners by continuously adding 1 to a binary string and extracting the next set of results as each new character gets pushed out of the center (ultimately exhausting all possibilities of either 1 (a positive direction on that axis) or 0 (not a positive direction on that axis.))

Then, each time a character is sent outward in this way, it occupies a "branch" of coordinates based on the key, the total number of directions it can go in during any given step in the pattern and still be going towards the corner being (2 ** the grids dimensions); also gotten by adding 1 to a binary string, on each axis being either 1 (going towards that corner along that axis) or 0 (not moving along that axis.) Each identical "branching" of coordinate points containing the ordinal value of a character.

At this point, it takes each branch, and uses the combination of all of it's coordinate points as the seed for a random generator, generates a random value between 0-255 for each of the coordinate points in the branch, then takes the ordinal value, and fragments it unevenly along each point in the branch proportional to the random value generated. It then extracts the fragmented bits and pieces from all the coordinate points, and returns it all as a hex string.

Decryption is almost the exact opposite, but it takes the number of values in the encrypted string divided by the number of steps in the pattern (the number of characters in the un-encrypted string,) and sends out that many "blank" branches. It then gets all the same random seeds from all the same coordinate points, throws all the values back into the right slots backwards, defragments each branch and sucks them back all into the center of the structure, converts the numbers back to their character equivalent and you've got the string back.

FENRIS.PY
Code: [Select]
import FENRIS_Gridbox
import random

def encrypt(key, encStr):
    g = FENRIS_Gridbox.encGrid(key[0], key[1:])

    for c in encStr:
        g.abstractChar(c = c)

    g.bindAndFragmentAllPaths()
    return g.shuffleAndExtract()

def decrypt(key, encStr):
    g = FENRIS_Gridbox.decGrid(key[0], key[1:])
   
    g.storeEncStr(encStr)
    g.abstractBlanks()
    g.inputValues()
    g.extractFragments()
    g.defragmentAndExtractAllPaths()
   
    return g.finalizeAndReturn()
   
def generateKey(dimensions, length):
    return [dimensions,]+[random.randrange(1,(2**dimensions)) for i in range(length)]

FENRIS_Gridbox.PY
Code: [Select]
import FENRIS_Core

class encGrid(FENRIS_Core.grid):
    def __init__(self, dimensions, pattern):
        FENRIS_Core.grid.__init__(self, dimensions, pattern)
       
    def bindAndFragmentAllPaths(self):
        for p in self.pathRoots:
            self.pathRoots[p].bindAndFragment()

    def shuffleAndExtract(self):
        keys = self.points.keys()
        return ''.join(hex(self.points[k].getValue()) for k in keys)
       
class decGrid(FENRIS_Core.grid):
    def __init__(self, dimensions, pattern):
        FENRIS_Core.grid.__init__(self, dimensions, pattern)
       
    def storeEncStr(self, encStr):
        self.encStr = [int('0x' + x, 16) for x in encStr.split('0x')[1:]]
       
    def abstractBlanks(self):
        for i in range(len(self.encStr)/len(self.pattern)):
            self.abstractChar()
           
    def inputValues(self):
        keys = self.points.keys()
        for i in range(len(keys)):
            self.points[keys[i]].setValue(self.encStr[i])
   
    def extractFragments(self):
        for p in self.pathRoots:
            for b in self.pathRoots[p].getBranches():
                for c in b.getCoordList():
                    b.appendFragment(self.points[c].getValue())
                   
    def defragmentAndExtractAllPaths(self):
        for p in self.pathRoots:
            self.pathRoots[p].defragmentAndExtract()
           
    def finalizeAndReturn(self):
        returnString = []
        for i in range(len(self.encStr)/len(self.pattern)):
            self.cycle.next()
            returnString.append(self.pathRoots[self.cycle.send(True)].extractValue())
        return ''.join(chr(c) for c in returnString)[::-1]
       
class testGrid(encGrid, decGrid):
    def __init__(self, dimensions, pattern):
        FENRIS_Core.grid.__init__(self, dimensions, pattern)

FENRIS_Core.PY
Code: [Select]
import random

class point(object):
    def __init__(self):
        self.value = 0

    def setValue(self, value):
        self.value = value
    def getValue(self):
        return self.value

class branch(object):
    def __init__(self, coordList):
        self.coordList = coordList
        self.value = 0
        self.contortedCoordList = []
        self.contortedChunk = 0
        self.fragments = []
        self.calibrate()

    def calibrate(self):
        for c in self.coordList:
            random.seed(''.join(str(i) for i in c))
            self.contortedCoordList.append(random.randrange(0, 255))
       
        for c in self.contortedCoordList:
            self.contortedChunk += c
           
    def setValue(self, value):
        self.value = value
    def getValue(self):
        return self.value
    def getCoordList(self):
        return self.coordList
    def getFragments(self):
        return self.fragments
    def appendFragment(self, f):
        self.fragments.append(f)

    def fragment(self):
        whole = float(self.value + self.contortedChunk)
        for c in self.contortedCoordList:
            self.fragments.append(int((whole / self.contortedChunk) * c))

        self.fragments[-1] = self.fragments[-1] + int(whole - sum(self.fragments))
       
    def defragment(self):
        self.value = sum(self.fragments) - self.contortedChunk

class pathRoot(object):
    def __init__(self, rootGrid, direction):
        self.rootGrid = rootGrid
        self.direction = direction
        self.currPoint = list(direction)
        self.branches = []
        self.values = []
       
    def addValue(self, value):
        self.values = [value, ] + self.values
    def extractValue(self):
        return self.values.pop(0)
    def getBranches(self):
        return self.branches

    def createBranch(self, pattern):
        hold = []

        for i in range(len(pattern)):
            self.currPoint = [x + y for x, y in zip(self.currPoint, self.binaryToStep(self.rootGrid.binaryAdd(''.join('0' for d in range(len(self.direction))), pattern[i])))]
            hold.append(tuple(self.currPoint))
            self.rootGrid.createPoint(tuple(self.currPoint))
       
        self.branches = [branch(hold), ] + self.branches
       
    def binaryToStep(self, binStr):
        hold = []

        for i in range(len(binStr)):
            if int(binStr[i]) == 0:
                hold.append(0)
            elif self.direction[i] > 0:
                hold.append(1)
            else:
                hold.append(-1)

        return hold
       
    def bindAndFragment(self):
        for i in range(len(self.values)):
            self.branches[i].setValue(self.values[i])
            self.branches[i].fragment()
            for x in range(len(self.branches[i].getCoordList())):
                self.rootGrid.getPoints()[tuple(self.branches[i].getCoordList()[x])].setValue(self.branches[i].getFragments()[x])
                   
    def defragmentAndExtract(self):
        for b in self.branches:
            b.defragment()
            self.values.append(b.getValue())

class grid(object):
    def __init__(self, dimensions, pattern):
        self.dimensions = dimensions
        self.pattern = pattern
        self.pathRoots = {}
        self.points = {}

        self.cycle = self.cycleGen(''.join('0' for i in range(self.dimensions)))
       
    def getPoints(self):
        return self.points
               
    def cycleGen(self, binStr):
        cycle = [0, ]
        fbreak = 1
        frev = 1
        while True:
            rev = yield
            if rev == False:
                if len(self.pathRoots) < (2 ** self.dimensions):
                    self.pathRoots[cycle[0]] = pathRoot(self, self.binaryToDirectional(binStr))
                    binStr = self.binaryAdd(binStr)
                    yield cycle[0]
                    cycle = [cycle[0]+1, ] + cycle
                else:
                    if fbreak == 1:
                        cycle = cycle[1:]
                        cycle = [cycle[-1], ] + cycle[:-1]
                        fbreak = 0
                    yield cycle[0]
                    cycle = [cycle[-1], ] + cycle[:-1]
            elif rev == True:
                if fbreak == 1:
                    cycle = cycle[1:]
                    cycle = [cycle[-1], ] + cycle[:-1]
                    fbreak = 0
                if frev == 1:
                    cycle = cycle[1:] + [cycle[0], ]
                    frev = 0
                yield cycle[0]
                cycle = cycle[1:] + [cycle[0], ]
           
    def binaryToDirectional(self, binStr):
        return tuple([int(c) for c in binStr.replace('1','1 ').replace('0','-1 ').split(' ')[:-1]])
           
    def binaryAdd(self, num, amount = 1):
        x = bin(int('0b' + num, 2) + amount)[2:]
        return num[:-len(x)] + x       
       
    def abstractChar(self, c = None):
        self.cycle.next()
        cyclePoint = self.cycle.send(False)
       
        self.pathRoots[cyclePoint].createBranch(self.pattern)
        if c:
            self.pathRoots[cyclePoint].addValue(ord(c))
                   
        if ((cyclePoint + 1) % 2 == 0):
            pass
        else:
            self.advancePattern()
               
    def advancePattern(self):
        hold = []
        for i in self.pattern:
            if i == (2**self.dimensions)-1:
                hold.append(i)
            elif i == (2**self.dimensions)-2:
                hold.append(1)
            else:
                hold.append(i + 1)
        self.pattern = tuple(hold)
       
    def createPoint(self, coords):
        self.points[tuple(coords)] = point()

Pages: [1]