HOMEWORK 12 - JOB INTERVIEW

Important

In this project, only one student from each section will become a finalist for a job, and this finalist will be the only student in the section that receives a perfect score on this assignment (and bragging rights). The overall winner, i.e., one of the finalists who actually gets the job, will receive a perfect score on this assignment, bragging rights, and a special prize!

Overview

Company PgrmIt is interested in your resume and has scheduled a phone interview with you. After completing the phone interview, in which they made sure you could answer basic C++ questions, they invite you to attend a coding interview as the second stage of the interview process. You receive the following email:


Dear Candidate,

Congratulations on a successful phone interview! I have talked to the other managers and we would like to move forward with the interview process. The second stage is a coding challenge. You have until next Wednesday at 8am to complete the following project.

You need to create a screen (using SFML) such that circles move around in random directions. If two circles collide, then they need to switch directions. It is your choice how realistic to make the collision. The only requirement is that the circles stay on the screen at all times. We don’t require varying speeds for the circles; that is, a normalized speed is fine. We request that you make the circles a random color, so we can visually see that a collision is working appropriately.

We are looking for code clarity, organization, and logic. We will also look favorably on any additional functionality that you would like to add to your program (e.g., different shapes, enhanced collision engine, varying size shapes, or varying speeds implemented with varying densities). Once you feel good about your implementation to this coding challenge, then please submit it via our Blackboard system. If we don’t receive your submission by next Wednesday at 8am, we will assume your interest in our open position has faded.

Good Luck,
Peter Parker
Hiring Manager for PgrmIt


The Specifics

Bad news first ... all students in CSCI 261 have received the same coding challenge, and only one student per section will make it to the third (and final) interview stage. These six finalists will receive 100% on the assignment. Everyone else will be graded according to how they place in the challenge (as judged by the code submitted).

Fortunately there is some good news ... you have already started the project! Say what?? You may not recall doing this (are you sleep deprived?), but you have! Here is your initial main.cpp and Circle.h code. Since you don't remember writing this code, it's a good thing you lots of comments (as all good programmers do).

Use your comments, finish the rest of your code, and get the job you always wanted at PgrmIt. Remember that you should now be thinking in terms of objects. Class Circle should represent your blueprint for every circle that moves around your screen. Companies like code that is scalable, and having multiple instances of the same class shows that you are thinking ahead. (What if you have 30 circles? What if you have 1000?)

Grading

  • 25% - Circles appear on the screen
  • 25% - Circles collide and change direction when they hit a boundary or another circle
  • 25% - Code organization and quality (start with pseudocode! in fact, if you don’t get far in the actual coding of your project, pseudocode will earn you a few points)
  • - If your code does not compile, pseudocode is your only hope for points
    - If you are given this in an interview, always turn in something that works, and provide pseudocode for the rest (or somehow make sure your thought process is known).
    - If parts of your code do not run, comment those out (so your evaluators can see where you went wrong; yes, even interviewers give partial credit)
  • 25% - Code performance (visual, code style, logic, collision, look and feel)
  • Earning Points

    Here are some ideas to consider as you code your solution. You do not need to do all of these. We will, however, award points for a good implementation on those you choose to do.

    • Allowing n balls in the simulation
    • Balls that change color upon collision
    • Each ball has a different mass, represented by a different radius
    • The ball's mass is calculated as part of the collision equation
    • The larger ball "eats" the smaller ball and grows larger
    • Clicking adds a new ball where the mouse was clicked
    • User controls a ball, e.g., user needs to eat all green balls and avoid red balls or only eat balls smaller than the user. Maybe user's ball grows with each ball eaten (that'd be cool!)

    IMPORTANT NOTE: Be sure to list all bells/whistles that you have coded up in the header of the main.cpp file you submit.

    Homework Grade and Submission

    Your Homework 12 grade will be based on your solution to this assignment and your solution to Lab12A, Lab12B, and Lab12C. In submitting your homework assignment (due Apr 20th), follow these steps: