Friday, April 17, 2020

Course Project: 3 Lane Car Game

Course Project Title: 3 lane car racing game

Course Project Description: 
           The aim of our course project is to implement game application various feature of C++ Programming language. So, we have implemented "3 Lane Car Racing Game". We take 3 lane of cars. And these cars are moving in two direction such as upward and downward direction. There is one self car which is totally handle by user. This is also known as player's car. This car can move in all four direction such as left, right, upward and downward. If self car hit by opponent car the game will be over and output score will display on output screen.

Sequential Process:
1. Setup output screen
     In this process, using two dimensional array is used to hold the information about game screen. matrix[12][20] means 12 row and 20 column rectangle is used for game screen display. Also, in layout it set the border for the road. So, if x=0 or x=11 then it will print 0 otherwise it will give blank space.
2. Create the Player car (self-car)
     Initially create class car. In class car by using draw function players car created. In draw function, we assign xPos and yPos to declare x and y position of the car. To move car left and right side, there is declaring function moveRight() and moveLeft(). In moveRight() and moveLeft() we only change x coordinate of player car and to move upward and downward direction we change y coordinate. Also in car class we have declared chackCollusion() which is use for to check whether self-car is hit by opponent car or not. 
3. Creating opponent car          
     This is the same class as like previous class, except the opponent car only move in vertical direction. So, we need to change only yPos. By increasing yPos car will move in downward direction. There is another function to recreate the car again and again. To create a car on a different lane, a random number is generated and remainder is achieved by using modulo operator for divisor 3 to create opponent car randomly in any lane. For example, if random number generated  is 4,  4%3=1 then xPos is made equal to 5. So, opponent car is created in lane 2.
4. Keyboard inputs
    Keyboard inputs are used to move the car left, right, up and down direction when keys are pressed.
When pressing keys then car will change its coordinate accordingly. Using GetAsyncKeyState command used along with myListener() function, the keyboard inputs are taken.
           These are all the processes to make 3 lane car racing game.
Car Game Demo Link: Demo Video
     

Topic 1: Some common C++ function and Game output screen layout
Presenter's Info: Name of Student: Prajakta Vijaysinh Yadav
                           Div.: K
                           GR No.: 182188
                            Roll No.: 87

Topic 2: More Functions like draw(), drawpoint() and move() etc.
Presenter's Info: Name of Student: Siddharameshwar Pendpalle
                           Div.: K
                           GR No.: 1710231
                           Roll No.: 61

Topic 3: Creating Cars and their movements.
Presenter's Info: Name of Student: Priyan Kotwal
                           Div.: K
                           GR No.: 1710853
                           Roll No.: 41

Topic 4: Keyboard Inputs and myListener(), checkCollusion() functions
Presenter's Info: Name of Student: Dipali Pawar
                           Div.: K
                           GR No.: 182085
                           Roll No.: 58

Topic 5: Integration of all above mentioned programs to car game and introducing score and levels.
Presenter's Info: Name of Student: Pankaj Pawar
                           Div.: K
                           GR No.: 1710481 
                           Roll No.: 59
Presentation_Link: https://drive.google.com/open?id=1kqTkGFVChPeoID1AN2axT66sa85Z07x9

Seminar II
Topic: OOP in Pythoon
Prezi Prezentation Link: https://prezi.com/view/abvJLJmT3m7VuUijfcXF/

Thank You!

Thursday, April 2, 2020

Bridge Design Pattern


 It is part of structure design pattern. It is used to separate the abstraction from the implementation.
It has two parts
1.      Abstraction
2.      Implementation
This pattern allow abstraction and implementer to develop in dependently. So client can accesses only abstraction class without disturbing implementer class 
The Implementation defines the interface for all implementation classes. It doesn't have to match the Abstraction's interface. In fact, the two interfaces can be entirely different. Typically, the Implementation interface provides only primitive operations, while the Abstraction defines higher-level operations based on those primitives class.

Elements of Bridge design pattern are:

·        Abstraction – core of the bridge design pattern and defines the crux. Contains a reference to the implementer.
·        Refined Abstraction – Extends the abstraction takes the finer detail one level below. Hides the finer elements from implements.
·        Implementer – It defines the interface for implementation classes. This interface does not need to correspond directly to the abstraction interface and can be very different. Abstraction imp provides an implementation in terms of operations provided by Implementer interface.
·        Concrete Implementation – Implements the above implementer by providing concrete implementation.



Code:
#include<iostream>
class Implementation {
 public:
  virtual ~Implementation() {}
  virtual std::string OperationImplementation() const = 0;
};

class ConcreteImplementationA : public Implementation {
 public:
  std::string OperationImplementation() const override {
    return "ConcreteImplementationA: Here's the result on the platform A.\n";
  }
};
class ConcreteImplementationB : public Implementation {
 public:
  std::string OperationImplementation() const override {
    return "ConcreteImplementationB: Here's the result on the platform B.\n";
  }
};


class Abstraction {

 protected:
  Implementation* implementation_;

 public:
  Abstraction(Implementation* implementation) : implementation_(implementation) {
  }

  virtual ~Abstraction() {
  }

  virtual std::string Operation() const {
    return "Abstraction: Base operation with:\n" +
           this->implementation_->OperationImplementation();
  }
};

class ExtendedAbstraction : public Abstraction {
 public:
  ExtendedAbstraction(Implementation* implementation) : Abstraction(implementation) {
  }
  std::string Operation() const override {
    return "ExtendedAbstraction: Extended operation with:\n" +
           this->implementation_->OperationImplementation();
  }
};


void ClientCode(const Abstraction& abstraction) {
  // ...
  std::cout << abstraction.Operation();
  // ...
}


int main() {
  Implementation* implementation = new ConcreteImplementationA;
  Abstraction* abstraction = new Abstraction(implementation);
  ClientCode(*abstraction);
  std::cout << std::endl;
  delete implementation;
  delete abstraction;

  implementation = new ConcreteImplementationB;
  abstraction = new ExtendedAbstraction(implementation);
  ClientCode(*abstraction);

  delete implementation;
  delete abstraction;

  return 0;

}

Result :


































Course Project: 3 Lane Car Game

Course Project Title:  3 lane car racing game Course Project Description:              The aim of our course project is to implement...