A Programming Game Only for the Very Experienced or the Complete Newcomer

If you are neither a very experienced

programmer nor a "hello world"er I wouldn't

expect this web-site to capture your attention

for very long.  So don't complain about the

lack of a sleazy applet or jquery enhancements. 

     

Points System for Program Invariants in C++ && Maze Solver Covariants for the Creepy Blueberry Jeep Maze Solver

 

In the main class

 

//**

 

{clear the screen using built in functions}

pixel.display();

pixel.step();

Sleep(1000); //1000 ms = 1 second

 

 

//** 20 points for step and 21 points for Sleep(1000) or Sleep(100) or Sleep(10)

 

 

//**

 

Universe universe;

 

**// 14 points for creating an object in main

 

The include directives in main are worth no points

 

 

In the object created in main

 

 

The iteration method is worth 252 + 273 – and only for the first array movement.

 void Universe::step()

{

 for (int i = 0; i <= 19; i++)

{

for (int j = 0; j <= 19; j++)

{

if (array[i][j] != NULL && array[i][j]->getSymbol() == '@')

{

array[i][j]->move();

}

}

 }

 

 for (int i = 0; i <= 19; i++)

{

for (int j = 0; j <= 19; j++)

}

if (array[i][j] != NULL && array[i][j]->getSymbol() == '*')

{

array[i][j]->move();

}

}

}

display();

moveReset();

 

}

 

void Universe::display()

{

 for (int i = 0; i <= 19; i++)

 {

 for (int j = 0; j <= 19; j++)

{

if (array[i][j] != NULL)

{

cout << array[i][j]->getSymbol();

 }

else

{

cout << "  ";

 }

 

 }

 cout << endl;

 }

 

 }

 

The method called in the iteration method from the object in main is worth 1 point

 

if there is a move reset it is worth 194 points unless there is no fill method

 

 

//**

if (array[i][j] != NULL)

{

array[i][j]->alreadyMoved = false;

}

 

**//

 

 

 

 

 

This method can become quite complicated, don't discuss it with programmers. 0 Points.

 

//**

 

Universe::Universe()

{

for (int i = 0; i <= 19; i++)

{

for (int j = 0; j <= 19; j++)

{

array[i][j] = NULL;

 }

}

 fill();

}

 

In the ColourPixel method required by the universe object.

 

Worth 171 points.

 

//**

char ColourPixel::getWhite()

{

return '@';

}

 

**//

 

 

//**

 

Has invariant conditional, but worth no points. Usually found in some other part of the program

 

 

for (int i = -1; i < 2; i++)

{

for (int j = -1; j < 2; j++)

{

if (x + i <= 19 && y + j <= 19

&& x + i >= 0 && y + j >= 0

&& i != j && i != -j

&& world[x + i][y + j] == NULL)

{

world[x + i][y + j] = new Alien((x + i), (y + j), world);

level = 0;

i = 2;

j = 2;

}

}

 

**//

 

 

 

 

 

 

 

 

 

 

ColourPixel changes, all three are worth 10 points

 

charge++;

duration++;

bool hasMoved = false;

 

 

Black or White pixel getBlack

 

char WhitePixel::getSymbol()

{

return '*';

}

 

 

 

Has a invariant in the conditional, but is normally found in another part of the program

 

//**

 

for (int i = -1; i < 2; i++)

{

for (int j = -1; j < 2; j++)

{

if (x + i <= 19 && y + j <= 19

 && x + i >= 0 && y + j >= 0

 && i != j && i != -j

&& world[x + i][y + j] == NULL)

 {

 world[x + i][y + j] = new BlackPixel((x + i), (y + j), world);

level = 0;

i = 2;

 j = 2;

}

}

 

**//

 

 

 

Black or White pixel invariants, worth no points

 

 

 

 

 

int changeX, changeY;

charge++;

srand (time(NULL));

do

{

changeX = rand() % 3 - 1;

changeY = rand() % 3 - 1;

}while(changeX != changeY);

 

 

 

 

Header file invariants, worth 4 points

 

 

#include <cstdlib>

#include <iostream>

 

 

FlashLight class constructor, worth 11 points

 

//**

FlashLight(int posX, int posY, Flashlight *array[][20]);

 

**//

 

Black or White pixel destructor worth 24 points

 

~BlackPixel() or ~White Pixel()

 

~ColourPixel() destructor worth 35 points

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

These constructors are worth no points, but without them nothing else in the program has value.

 

FlashLight::FlashLight(int posX, int posY, Beam *array[][20])

: level(0), x(posX), y(posY), world(array), alreadyAimed(false)

{

}

BlackPixel::BlackPixel(int posX, int posY, Stream *array[][20])

: FlashLight(posX, posY, array)

{

}

ColourPixel::ColourPixel(int posX, int posY, Gleam *array[][20])

: FlashLight(posX, posY, array)

{

}

 

 

 

 

void fill(); is worth fifty points as an invariant in the universe method declarations, but as you can see its existence is the niffy switch for different kinds of programs

 

There is no relationship between the Flashlight, the Universe, and the array pointer in the Flashlight. The anti-symmetry is in the relationship between the flashlight constructor and iteration method in the Universe. The external question is this case is in the array pointer, and in its connection to the worthless invariant conditions of the the universe's points.

 

There are not normally more than fourteen or fifteen header files, and every program that has invariants has a header file like this one, that declares types as differentia of a super class

 

 

 

Simulation.h

 #include <cstdlib>

#include <iostream>

 

 using namespace std;

 

 class Organism

{

public:

Organism();

 

 virtual void move() = 0;

 virtual void breed() = 0;

virtual char getSymbol()= 0;

int level, x, y;

bool alreadyMoved;

Organism* (*world)[20];

};

 

 class Bat : public Organism

 {

public:

 Bat(int posX, int posY, Organism *array[][20]);

 ~Bat();

 virtual void fly();

virtual void breed();

 virtual char getSymbol();

};

 

 

 class Alien: public Organism

 {

public:

 Alien(int posX, int posY, Organism *array[][20]);

 ~Alien();

virtual void move();

virtual void breed();

 virtual char getSymbol();

void infect();

void starve();

int hunger;

 };

 

 class Universe

 {

public:

Universe();

Organism* array[20][20];

 void display();

 void step();

void fill();

void moveReset();

 int alien, bat;

 };

 

 

The nine is sometimes a program invariant. Worth something in a pinch.

#ifndef Main_H

#define Main_H

 

// Main class include directives.

 

#include <iostream>

#include <string>

#include <sstream>

#include <stdio.h>

#include <fstream>

#include "Germ.h"

#include "Owners.h"

#include "Flavour.h"

#include "Planet.h"

#include "Main.h"

 

using namespace std;

 

int main();

 

#endif

 

#include "Main.h"

#include "MazeFacade.cpp"

 

using namespace std;

 

int main()

{

            // Create new cube  and call the menu method from the facade.

            MazeFacade Cube;

            Cube.menu();

           

            //use a custom exception that validates the Maze[20][20] array.

}

 #include <cstdlib>

#include <iostream>

#include "Flavour.h"

 

 using namespace std; /* (include the header files in the namespace -- at least three header files, try the copy constructor in another one);

 

--//validation and exception handling are important, remember to comment the way that it was demonstrated//--

#ifndef Germ_H

#define Germ_H

 

 

#include <iostream>

#include <string>

#include <sstream>

#include <stdio.h>

#include "Planet.h"

#include "Flavour.cpp"

#include "Owners.h"

 

using namespace std;

 

 class Germ: public Flavour

 {

public:

 

~Germ();

 

 virtual char getSymbol();

virtual char getPath();

int* virulence;

 };

#endif*/

 

#include <iostream>

#include <string>

#include <sstream>

#include <stdio.h>

#include <fstream>

#include "Planet.cpp"

#include "Germ.h"

#include "Owners.cpp"

 

using namespace std

class Germ{

public:

int* x;

int* y;

int* spread;

 

 Germ::Germ() {}

 

 Germ::Germ(int* posX, int* posY, bool array[20][20]) {// Write the constructor here}

 

 Owners* array[20][20];

 

 Planet yellow;

 

ostream& operator<< (ostream& output, Germ& type)

{

            // Declare node in start position.

            Path *node = type.start;

            while( node != NULL)

            {

            // Read nodes.

            output << node->data;

            node = node->next;

            }

            return output;

}

}

  class Flavour

{

public:

virtual void spread() = 0;

virtual void sheen() = 0;

};

 

#include <iostream>

#include <vector>

 

void drawTheMaze(char MazeWall[20][20]);

 

using namespace std;

 class MazeFacade

 

{

       public:

               char MazeW[20][20];

 

                        MazeFacade();

                         void menu{

             enum place{Instructions = 1,About = 2,Calculate = 3,EXIT = 4,INVALID = -999};//enumeration

            // switch connecting menu selectio inputs to the calculators various outputs

 

    //first calculation menu selection: priming the pump

            cout << "Make a selection (1 Instructions, 2 About, 3 Calculate or 4 to Exit)\n";

                        cout << endl;               

                        cin >> strNum2;

             do{  // do loop used to count number of calculations and control menu selections

 

                        stringstream streamObj;

                        streamObj << strNum2;

 

                        num3 = validate(strNum2);

 

                        if(num3 == -999){

 

                                    errorMessage();

 

                                    strNum2 = menu();

                                    num3 = validate(strNum2);

 

                                    counter++;

                        }

                        else if(num3 < 0){

 

                                    errorMessage();

                                     strNum2 = menu();

                                    num3 = validate(strNum2);

 

                                    counter++;

                        }

                        else if(num3 > 4){

 

                                    errorMessage();

 

                                    strNum2 = menu();

                                    num3 = validate(strNum2);

 

                                    counter++;

                        }

                        else

                        {

                         while(counter >= 1) // while loop used to execute the main body of the program

                        {

                                     if(counter != 1) // counter controls menu selection after first calculation

                                    {         

                                    counter++;  // counts number of calculations

                         switch(num3)  // menu selection switch

                        {

                       case Instructions:  // first case: selects for instruction string output

                                    {

                                     directions();

                                    strNum2 = menu();

                                     num3 = validate(strNum2);

                                     if(num3 == -999)

                                    {

                                                errorMessage();

                                                strNum2 = menu();

                                                num3 = validate(strNum2);

                                                break;

                                    }

                                     break;

                                    }

                        case About:  // second case: selects for programs details

                                    {

                                    about();

                                    strNum2 = menu();

 

                                    num3 = validate(strNum2);

 

                                    if(num3 == -999)

                                   {

                                              errorMessage();

                                                strNum2 = menu();

                                                num3 = validate(strNum2);

                                                break;

                                    }

                                     break;

                                    }

                        case Calculate: //third case: selects for calculation

                                     {

                                                bool Valid = true;

                                                 Valid = calc();

                                                 if(Valid == false){

 

                                                            errorMessage();

 

                                                            break;

                                                }else

                                                {

                                                            strNum2 = menu();

                        num3 = validate(strNum2);

                                    if(num3 == -999)

                                    {

                                                errorMessage();

                                                strNum2 = menu();

                                                num3 = validate(strNum2);

                                                break;

                                    }

                                                }break;

                                    }

                        case EXIT: // fourth case breaks do while loop and exits program

                                    {

                                                counter = quit();

                                                num2 = 5;

                                                break;

                                    }

                        case INVALID:

                                    {

                                    errorMessage();

                                   strNum2 = menu();

                                    num3 = validate(strNum2);

                                    continue;

                                    }

                        //default:

                        //          {

                        //         

                        //                     

                        //                      // validates the enums menu selection

                        //                      cout << "You made an invalid selection \n";

                        //                     

                        //                     

                        //                      continue; // breaks while loop

 

                        //                      cin.ignore();

 

                        //                      cin.get();

                        //          }

                        }//end switch 

                        }

                        }

                        }//end while     

            }while(num2 < 4);//end do while, used to collect information

            }

}         

void printTheBoard(char MazeWall[20][20])

 

{

           StreamReader reader = new StreamReader("maze.txt");

            int row = 0;

            int col = 0;

 

            while ( =!EOF)

            {

                int ch = reader.Read();

                if (ch % 2)

                {

                    row++;

                    col = 0;

                }

                else

                {

                    if (ch != 16)

                    {

                        //assign a character to the array

                        MazeW[row, col++] = (char)ch;

                    }

                }

            }

}

#ifndef Owners_H

#define Owners_H

 

#include <iostream>

#include <string>

#include <sstream>

#include <stdio.h>

#include <fstream>

#include "Owners.h"

 

using namespace std;

 

Owners::Owners(){}

Owners::Owners ( const Owners& distal[X1][Y1], *X2,*Y2 )

            {

X1 = &X2;

Y1 = &Y2;

 

If(X1!=X2 && Y1!=Y2)

{

    distal[X1][Y1] = new distal[X2][Y2];

}else

{

   Survivors –= new int[((X2+Y2) – (X1-Y1))];

}

}

            Owners::~Owners()// destuctor

           {

                        cout << "destructor fired" << endl;//testing

 

                        if( distal[X2][Y2] != NULL )

                        {                     

                                    delete [] distal;

 

                                   delete [] X2;

                    delete [] Y2;

                       }                     

            }

 

  Owners::die(); /* Call the destructor

bool paintPath(); /*

};

*/

#endif

 

#include <iostream>

#include <string>

#include <sstream>

#include <stdio.h>

#include <fstream>

#include "Owners.h"

#include "Path.h"

 

using namespace std;

 

 class Owners

 {

private:

            int *X1;

       int *Y1;

            bool *distal[20][20];

int *survivors;

public:

 Owners(bool* life[20][20],int * X,int *Y)

 {

 //** cosntructor right here **//

 }

            bool die();

            ~Owners();// destuctor

 };

 

 /* Call the destructor

bool paintPath(); /*

};

 

#ifndef Path_H

#define Path_H

 

#include <iostream>

#include <string>

#include <sstream>

#include <stdio.h>

#include "Path.h"

 

using namespace std;

 

// Path class.

 

class Path

{

            private:

            bool array[20][20];

           bool *location[20][20];

            public:

                        int x;

                        int y;

                        Path(int* W, int* P, bool* painted[20][20])

                       {

                                    //** Write the constructor here.

                        };

            ~Path();

            void point();

}

#endif

 

 

 

#include <iostream>

#include <string>

#include <sstream>

#include <stdio.h>

#include "Path.h"

 

using namespace std;

 

Path::Path(Path.x, Path.y, Path.location ){ /* call the constructor from the header file. */};

 

#include <cstdlib>

#include <iostream>

#include "Flavour.h"

 

using namespace std; /* (include the header files in the namespace -- at least three header files, try the copy constructor in another one);

 

--//validation and exception handling are important, remember to comment the way that Brian Shewan demonstrated//--

 

*/

  class Flavour

{

public:

 virtual void spread() = 0;

virtual void sheen() = 0;

 

};

 


 
   
     
 

- If you need help, please check our forums.
- Please review our Terms Of Service to see what is not allowed to upload.

Please, do not waste your time with GeoCities.ws, if you are going to upload any illegal website here! All content is manually reviewed by humans, so if we will detect anything illegal, your account will be terminated. So don't waste your time in promoting your scams, hacking websites, or anything else malicious - your account will be terminated in 5 minutes after we will receive first abuse report or anything abusive will be detected by our staff. We also report all illegal activity to the local and international authorities.

 

 
 

 

 

"To break is human, to compile, divine"

 

-Kunsang Sopa and friends