<file_sep><h1>Week 1 Scrum Report</h1>

<h2><NAME></h2>

### Finished Last Week 
- Task 1: Picked a Core XP value - Courage 
- Task 2: Decided on project
- First commit of initial code and modified Readme

### Planned Next Week 
- Refactor into patterns
- Create 2 user stories
- Create UI Wireframes with team

### Problems

- Due to exams and different schedules, we didn't get to meet
  until Friday this week

### Time Spend

- Task1: 1 hrs
- Task2: 3 hrs - decided during chatting and meeting
- Task 3: 2 hours

### XP Core Value

I was given courage. I made sure that we all give correct information regarding progress and 
estimates. I also made sure that we adapt our processes as needed and that we should not 
be afraid to speak up when needed. 

<h2></h2>
<h2><NAME></h2>

### Finished Last Week 
- Looked at several games online since our team decided for game option 
- Researched typical patterns used in games
- Participated in wireframes and design of the game.

### Planned Next Week 
- Implementing initial framework for the world.
- Technical story for a design pattern. Factory Pattern. Create lady bug and different types of lettuce (green and red).
- Will be working on initial grounding work of observer pattern for Turtle kill. 

### Problems

- Problems hooking up with team.

### Time Spent

- Task1: 5 hrs
- Task2: 5 hrs 

### XP Core Value

I was given respect. I made sure this week that every teammember should be 
respectful to eachother by reminding them about this important aspect.
It is one of the core values in XP.
<h2></h2>
<h2><NAME></h2>

### Finished Last Week 
- Read Greenfoot Documentation and some code examples
- Researched game ideas

### Planned Next Week 
- Technical story for a design pattern. Strategy Pattern for Game Level
Difficulty (Low, Medium, High)
- Write Story about a feature in the game - How to pick the game level and how to define it based on # of snakes and speed of snakes.
- Technical story for a design pattern. Observer Pattern for snake count.
- Write Story about a feature in the game. On every kill of snake, update snakes count so we can create more snakes.

### Problems

- We had problems in finding a time to meet this week

### Time Spent

- Task1: 5 hrs
- Task2: 5 hrs 

### XP Core Value

As a team member responsible for feedback I have made sure that I give timely and 
correct feedback to my teammates about their ideas and implementation approaches.
I also encourage my teammates to give feedback regularly amongst us.
<h2></h2>
<h2>Megha</h2>

### Finished Last Week

- Googled online for game ideas
- We decided on Greenfoot so I re-read the documentation

### Planned Next Week

- Write technical story for a design pattern. Decorator Pattern (Decorate gun)
- Write story about a feature in the game. When the turtle eats Lettuce or bug increment the points on Counter

### Problems

- Due to exams and different schedules, we didn't get to meet
  until Friday this week

### Time Spent

- Task1: 5 hrs
- Task2: 5 hrs

### Core Value

I picked simplicity and I have made sure that we only work on
what is important and needed. I ensure that the team is
creating just the basic functions first.
<h2></h2>
<h2><NAME></h2>

### Finished Last Week 
- Task 1: Researched ideas for project
- Task 2: Looked at Greenfoot examples

### Planned Next Week 
- Technical story for composite design pattern (Turtle and shield)
- Story about a feature in the game. The shield given to turtle and what happens
when snake hits the shield
- Create and code the story when turtle dies (game over)

### Problems

- We had some challenges finding time to meet this week

### Time Spent

- Task1: 6 hrs
- Task2: 4 hrs 

### Core Value

My responsibility is communication. I have ensured that the flow of 
communication is going well and the team is getting to know eachother 
and feel comfortable. We have also gotten to know about what each of 
us are good at.<file_sep>public class RedLettuceObserver implements IEatObserver
{

    public RedLettuceObserver()
    {
    }

    public void invoke(String className) {
        System.out.println("In red lettuce observer");
        if (RedLettuce.class.getName().equalsIgnoreCase(className)) {	       
            Turtle turtle = Turtle.getTurtle();	            
            Shield shield = Turtle.getShield();
            System.out.println("In red lettuce");
            ShieldBoostDecorator booster = new ShieldBoostDecorator(shield);
            booster.attach(new ShotObserver());
            shield.setDecorator(booster);
        }	        
    }
}
<file_sep>import greenfoot.*;

public interface IEatSubject  
{
    void attach (IEatObserver obj);
    void removeObserver (IEatObserver obj);
    void notifyObservers(String clss);
}
<file_sep>
public interface IScoreObserver  
{
    void scoreAction(int score);
}
<file_sep>public interface IShotObserver
{
    void invoke();
}<file_sep><h1>Week 3 Scrum Report</h1>

<h2><NAME></h2>

### Finished Last Week 
- Task 1: I finished coding the feature of advancing to next level
- Task 2: I also finished that the lady bug will appear at random
          when turtle eats the lady bug
- Task 3: Finetuned my wireframes, created draft class diagram, 
          use case diagram, activity diagram, and sequence diagram
		  for my features. 
- Task 4: Created initial ad video


### Planned Next Week 
- Finish ad video
- Integrate with team on diagrams and code

### Problems

- I had a blocker this week. I was blocked on review of 
  UML diagram and task board items. After we had a 
  meeting, this issue was resolved.

### Time Spent

- Task1: 6 hrs
- Task2: 2 hrs
- Task 3: 5 hours
- Task 4: 3 hour

### Ensuring my XP core value of Courage

I reminded our team that noone works alone. Therefore, if we have issues, we need to speak 
up about them. Our team has been very good about that. As a result, we have had 
multiple meetings on zoom in addition to our standbots and weekly Saturday face-2-face
meetings.
<h2></h2>
<h2><NAME></h2>

### Finished Last Week 
- Completed the feature which is when snake interacts with Turtle, then game should end. Made some refactoring changes to the logic such that it can integrate with other feature such as shield. 
- Helped other team members in features such as Snake Movement and Snake attraction.
- Fixed major merge conflicts in master due to which many team members were not able to merge. Pitched in to help teammates with a solution for these kind of git conflicts. Provided training on git cherry-pick.

### Planned Next Week 
- Reasearching on WOW factor (multiplayer, android application and how machine learning models can help in playing the game)
- To create sequence diagrams and other UML diagrams from the source code.

### Problems


### Time Spent

- Task1: 5 hrs
- Task2: 3 hrs 
- Task3: 3 hrs

### XP Core Value

So far all criteria for respect XP values were met. All team members reported no issues in terms of respect. Standups were conducted with respecting each other ideas, thoughts and suggestions.
<h2></h2>
<h2><NAME></h2>

### Accomplished Last Week

- Task 1: I completed implementing Strategy pattern for Game Difficulty.
- Task 2: I also created Startup screen to integrate Strategy pattern in it.
- Task 3: Finetuned wireframes for my user stories

### Planned Next Week

- Implement "Won the game" feature
- Start creating sequence diagram for completed user stories

### Blockers

- Due to urgent work issues, I was not able to spend as much time as I decided to work on the project.

### Time Spent

- Task 1: 4 hours
- Task 2: 4 hours
- Task 3: 3 hours

### XP Value : Feedback

In this week, I did peer review for many pull requests and I tested different features and reported my feedback to the team.
<h2></h2>
<h2>Megha</h2>

### Finished Last Week

- Task 1: Finished implementation of Decorator pattern on Shield.

- Task 2: Decided on the design of my feature - Points System

- Task 3: Finished development of my feature.

- Task 4: Integrated my code with the features developed by the team.

- Task 5: Worked on Sequence diagrams of my user stories.

### Planned Next Week

- Research on feasibility of Multiplayer game in greenfoot.
- Research on feasibility of creating an Android app from greenfoot.
- Finalize on a WoW factor and start working on the same

### Problems

- Our team faced some issues in code integration. Together we fixed the issue and created a clean master branch with all features integrated.

### Time Spent

- Task1: 4 hrs
- Task2: 2 hrs
- Task 3: 4 hours
- Task 4: 2 hours
- Task 5: 2 hours

### Ensuring my XP core value of Simplicity

Most of our features required actors to have different images at different points based on the state of the game. We spent some time thinking about editing existing images to make them look a certain way. But eventually I encouraged the team to pick the simplest images for the actors and not spend too much time editing the same thereby not focusing too much on the look of actors.
<h2></h2>
<h2><NAME></h2>

### Finished Last Week 
- Task 1: When snake gets killed, the count of snakes in the game needs to be adjusted
- Task 2: Integrate Snake with different patterns to make sure snake features are validated
- Task 3: Checked if composite pattern fits the story of shield for Turtle
- Task 4: Implement composite pattern so that shield and turtle moves together and can be treated as a group or individually

### Planned Next Week 
- Implement shield power system when snake hits shield
- Implement turtle kill when shield strength reaches zero
- Create UML diagrams and documentation


### Problems

- Had issues greenfoot initialising all the objects on game refresh

### Time Spent
- Task1: 4 hrs
- Task2: 6 hrs 
- Task 3: 2 hrs
- Task 4: 4 hrs 

### Ensuring my XP core value of Communication
I have ensured that our team has regular meetings whenever needed. Also that team is comfortable with the meeting timings and duration. Made sure that the owners of the inter related features discuss and solve any integration that may arise.
<file_sep>import greenfoot.*;

public class TurtleWorld extends World {

    public TurtleWorld() {
        super(WorldConfig.getX(), WorldConfig.getY(), WorldConfig.getCellSize());
        System.out.println("construc call");
        loadInitScreen();
    }

    public void loadPlayScreen() {
        Helper.resetAll(this);
        reinitialize();
    }

    public void loadInitScreen() {
        Helper.resetAll(this);
        initScreen();
    }

    private void initScreen() {
        // init function
        addObject(new ChooseDifficulty(), 380, 100);
        addObject(new DifficultyLow(this), 390, 200);
        addObject(new DifficultyMedium(this), 390, 305);
        addObject(new DifficultyHigh(this), 390, 410);
    }

    private void reinitialize() {
        int worldWidth = getWidth();
        int worldHeight = getHeight();

        ActorManager actorManager = new ActorManager();
        ScoreManager scoreManager = new ScoreManager(actorManager);
        Level level = new Level();
        addObject(level, 380,26);
        Counter counter = new Counter();
        addObject(counter, 58, 26);
        counter.attach(scoreManager);
        counter.attach(level);
        Turtle turtle = Turtle.init();
        Shield shield = Turtle.getShield();
        addObject(shield,100,100);
        addObject(turtle, 100, 100);
        turtle.attach(new RedLettuceObserver());
        turtle.attach(counter);
        turtle.attach(actorManager);
        actorManager.createLettuce();
        actorManager.createSnakes();
        actorManager.createBug();
    }
}<file_sep>import greenfoot.*;

public class ActorGenerator implements ActorFactory  
{
    public Actor createActor(String type, int x, int y) {
        Actor actor = null;
        if (Bug.class.getName().equalsIgnoreCase(type)) {
            actor = createBug(x, y);
        } else if (Lettuce.class.getName().equalsIgnoreCase(type)) {
            actor = createLettuce(x, y);
        } else if (RedLettuce.class.getName().equalsIgnoreCase(type)) {
            actor = createRedLettuce(x, y);
        } else if (Snake.class.getName().equalsIgnoreCase(type)) {
            actor = createSnake(x, y);
        }
        return actor;
    }

    /**
     * on turtle eat ->
     * kill manager will observe to kill the actor
     * counter will observe to increase score
     * actor manager will observe to create actors
     */
    
    private Actor createSnake(int x, int y) {
        Snake snake = new Snake();
        Helper.createActor(snake,x,y);
        return snake;
    }
    
    private Actor createLettuce(int x, int y) {
        Lettuce lettuce = new Lettuce();
        Helper.createActor(lettuce,x,y);
        return lettuce;
    }
    
    private Actor createRedLettuce(int x, int y) {
        RedLettuce rl = new RedLettuce();
        Helper.createActor(rl,x,y);
        return rl;
    }
    
    private Actor createBug(int x, int y) {
        Bug bug = new Bug();
        Helper.createActor(bug,x , y);
        return bug;
    }

}
<file_sep><h1>Week 4 Scrum Report</h1>

<h2><NAME></h2>

### Finished Last Week 
- Task 1: Completed another draft of ad video
- Task 2: Finetuned documentation
- Task 3: Final integration of documentation on github and practice presentation

### Planned Next Week 
- N/A

### Problems

- No problems

### Time Spent

- Task1: 2 hrs
- Task2: 4 hrs
- Task 3: 8 hrs

### Ensuring my XP core value of Courage

I reminded team that we need to adapt to changes when they happen. Like for example
we adapted as a team for ad hoc meetings this week because one team member had a 
time conflict. We also all adapted to the change that we all, in addition to 
daily Standbots, that we also have to do weekly journals. Finally, our wireframes
and uml diagrams constantly needs to be updated because of bug fixes, refactoring,
and changed features. We are adapting as a team to get the best value out of 
each sprint.
<h2></h2>
<h2><NAME></h2>

### Finished Last Week 
- Researched on WOW factor. Found Multiplayer is achievable but will require major design changes which is not feasible at this time.
- Suggested team how to make changes for Android application WOW factor. 
- Worked on creating sequence diagrams. Finalizing the deliverables, ReadME. making sure we have everything to submit. 

### Planned Next Week 
- DEMO (end of sprint)

### Problems


### Time Spent

- Task1: 6 hrs
- Task2: 1 hrs 
- Task3: 6 hrs

### XP Core Value

Everyone were respectful. Team did a great job in the 4 week sprint.
<h2></h2>
<h2><NAME></h2>

### Accomplished Last Week

- Task 1: I implemented Won the game feature
- Task 2: Completed sequence diagrams for my user storie
- Task 3: Finetuned README.md file
- Task 4: Prepared presentation

### Blockers

- I didn't have any blockers.

### Time Spent

Task 1: 3 hours
Task 2: 4 hours
Task 3: 2 hours
Task 4: 2 hours

### XP Value : Feedback

This is the last week of sprint. I am happy that everyone considered my feedback and made changes accordingly. I provided my feedback for ad video and presentation to make it more presentable and polish.
<h2></h2>
<h2>Megha</h2>

### Finished Last Week

- Task 1: Researched on Multiplayer game in greenfoot

- Task 2: Researched on porting greenfoot application on Android.

- Task 3: Modified greenfoot application code to make it compatible with Android

- Task 4: Ported Turtle World application to Android.

- Task 5: Redefined movement and key press events for Android application

### Planned Next Week

- N/A

### Problems

- None

### Time Spent

- Task1: 2 hrs
- Task2: 4 hrs
- Task 3: 2 hours
- Task 4: 4 hours
- Task 5: 3 hours

### Ensuring my XP core value of Simplicity

Researched on both Multiplayer game and Android game on Greenfoot. Porting to Android was the simpler choice so went ahead with it. Because of this choice we were able to get a WoW factor element.
<h2></h2>
<h2><NAME></h2>

### Finished Last Week 
- Task 1: Implemented shield power system when snake hits shield
- Task 2: Implemented turtle shield will decrease on intersection with snake
- Task 3: Implemented turtle dies if shield strength is 0 and turtle intersects with snake
- Task 4: Created UML diagrams for the two stories
- Task 5: Final integration of documentation on github and practice presentation

### Planned Next Week 
- NA

### Problems

- No Problems

### Time Spent
- Task1: 2 hrs
- Task2: 2 hrs 
- Task 3: 3 hrs
- Task 4: 3 hrs 
- Task 5: 3 hrs

### Ensuring my XP core value of Communication
I have ensured that our team has regular meetings whenever needed. Also that team is comfortable with the meeting timings and duration. Regular meetings were necessary to finalize project documentation and presentation.
<file_sep>
public interface IScoreSubject  
{
    void attach (IScoreObserver obj);

    void removeObserver (IScoreObserver obj);

    void notifyObservers();
}
<file_sep>import greenfoot.*;

public class Shield extends Animal implements IComponent, IShield {
  public int power;
  public boolean hitFlag;
  private IShield shieldBooster = null;


    public Shield(int p) {
        power = p;
        hitFlag = false;
        setImage("shield5.png");
    }

    public Shield() {
        power = 5;
        hitFlag = false;
        setImage("shield5.png");
        System.out.println("shield:" + power);
    }

    public void snakeHit() {
        power--;
        this.setImagePower(power);
    }

    public void setImagePower(int power) {
        switch (power) {
            case 1:
            setImage("shield1.png");
            break;
            case 2:
            setImage("shield2.png");
            break;
            case 3:
            setImage("shield3.png");
            break;
            case 4:
            setImage("shield4.png");
            break;
            case 5:
            setImage("shield5.png");
            break;
            default:
            setImage("shield5.png");
            break;

        }

    }

    public void act() {
    }

    public void moveactor() {
        move(WorldConfig.getInstance().TURTLE_SPEED);
        checkKeys();
        Turtle t = Turtle.getTurtle();
        try {
            setLocation(t.getX(), t.getY());
            setRotation(t.getRotation());
            if (canSee(Snake.class) && hitFlag == false) {
                System.out.println("hit");
                hitFlag = true;
                snakeHit();
            }

            if (hitFlag == true && !canSee(Snake.class)) {
                hitFlag = false;
            }

        } catch(Exception e) {

        }

    }

    public void checkKeys() {
        if (Greenfoot.isKeyDown("Left")) {
            turn(-WorldConfig.getInstance().TURTLE_DEGREE);
        }

        if (Greenfoot.isKeyDown("Right")) {
            turn(WorldConfig.getInstance().TURTLE_DEGREE);
        }

        if (Greenfoot.isKeyDown("Up")) {
            move(WorldConfig.getInstance().TURTLE_SPEED);
        }

        if (Greenfoot.isKeyDown("Down")) {
            move(-WorldConfig.getInstance().TURTLE_SPEED);
        }
    
    if ("space".equals(Greenfoot.getKey()))
    {
        attack();
    }
  }
  
   public void setDecorator(IShield shieldBooster) {
        System.out.println("In booster decorator");
        this.shieldBooster = shieldBooster;
    }

     public void removeDecorator() {
        this.shieldBooster = null;
    }

     public void attack() {
        if (this.shieldBooster != null)
            shieldBooster.attack();
    }

}
<file_sep># Game Squad

Table of contents
=================

   * [UI Wireframes](#ui-wireframes)
   * [Use Case](#use-case)
   * [Class Diagram](#class-diagram)
   * [Activity Diagram](#activity-diagram)
   * [Design Patterns](#design-patterns)
      * [Decorator](#decorator)
      * [Strategy](#strategy)
      * [Factory](#factory)
      * [Composite](#composite)
      * [Observer](#observer)
      * [Feature 1](#feature-1)
      * [Feature 2](#feature-2)
      * [Feature 3](#feature-3)
      * [Feature 4](#feature-4)
      * [Feature 5](#feature-5)

## UI Wireframes

https://balsamiq.cloud/s41ht0j/pcfr87k

![Alt text](/docs/Wireframes/1_Game%20Options.png?raw=true "Story #1")

![Alt text](/docs/Wireframes/2_Startup.png?raw=true "Story #2")

![Alt text](/docs/Wireframes/3_Snake%20attracted.png?raw=true "Story #3")

![Alt text](/docs/Wireframes/4_Points.png?raw=true "Story #4")

![Alt text](/docs/Wireframes/5_Turtle%20dies.png?raw=true "Story #5")

![Alt text](/docs/Wireframes/6_Advancing%20to%20next%20level.png?raw=true "Story #6")

![Alt text](/docs/Wireframes/7_Shield.png?raw=true "Story #7")

![Alt text](/docs/Wireframes/8_Shooting%20power.png?raw=true "Story #8")

![Alt text](/docs/Wireframes/9_Lady%20Bug%20-%20Story%20%239.png?raw=true "Story #9")

![Alt text](/docs/Wireframes/10_Won%20the%20game.png?raw=true "Story #10")

## Use Case
![Alt text](/docs/UseCase_Diagram.png?raw=true "Use Case Diagram")

## Class Diagram

![Alt text](/docs/class_diagram.png?raw=true "Class Diagram")

## Activity Diagram
![Alt text](/docs/activity_diagram.png?raw=true "Activity Diagram")

## Design Patterns
#### Decorator

Shield class contains a decorator object which is initially set to Null. The ```attack()``` method of ```Shield``` invokes the decorator's attack method if it is not null. Initially Shield class does not perform any opertaion since the decorator object is Null. Once Turtle eats the ```RedLettuce```, ```RedLettuceObserver``` assigns ```ShieldBoostDecorator``` as the decorator. ```attack()``` method is invoked on clicking the shield. ShieldBoostDecorator's attack() method releases a Shot. It is assigned 10 Shots and once all Shots are used, the decorator is reset to null.

![Alt text](/docs/Story8-ShootingPower.png?raw=true "Decorator Pattern")

<img src="/docs/Story8_use_case_specification.png"  width="500" height="500">


#### Strategy

We used strategy pattern for Game startup screen. When user wants to play the game, user will first see the game startup screen. Game startup screen has 3 difficulty button Low, Medium and High. User has to choose one of the difficulty to play the game. Each difficulty is different from each other in various attributes. So we have decided to use strategy pattern for this story. There are number of attributes such of number of snakes, speed of snakes, visibility of snakes etc which has different values in different difficulties. For Low difficulty, these attributes are set in such a way that it is easier to play the game. As user goes towards Medium and High, these attributes are set in such a way that the game would be harder to play.

Strategy Interface: ```DifficultyStrategy```
Strategy Concrete Class: ```DifficultyLevelLow```, ```DifficultyLevelMedium```, ```DifficultyLevelHigh```
Actor: ```DifficultyLow```, ```DifficultyMedium```, ```DifficultyHigh```

![Alt text](/docs/Story1-GameStartUpScreen.png?raw=true "Strategy Pattern")

<img src="/docs/Story1-use_case_specification.png"  width="500" height="500">

#### Factory

We used factory pattern to create the actors on the world. Main actors in our game are : Red Lettuce, Lettuce, Snake, and Bug. All actors are being created using Factory pattern. We have an interface Actor Factory and its concrete class Actor Generator. When an actor dies (except Turtle), the observers or the world submits a request to create that specfic actor to the Actor Manager. Actor Manager then using a timer queue the request in the threadpool. When one of the background threads are free, thread using the Factory pattern, calls the ```ActorGenerator``` to create the specific actor. We have some time threshold to wait for few seconds before we see an actor in the world.

Factory Interface : ```ActorFactory```
Factory Concrete: ```ActorGenerator```
Api : ```createSnakes(), createLettuce(), createRedLettuce(), createBug()```

![Alt text](/docs/Story2-StartGame.png?raw=true "Factory Pattern")

<img src="/docs/Story2_use_case_specification.png"  width="500" height="500">

#### Composite

We used Composite pattern to add shield to the Turtle. The shield and turtle share methods to move around, action on keypress and snake Hit. Shield and turtle move together and can be treated as a group. With composite we can add multiple accessories to Turtle and move them together. Also Implemented a feature of changing shield power. On intersection with a snake power of shield decreases by 1, which also results in changing the image of the shield to a smaller shield. 

Interface: ```IComponent```
Classes: ```Shield```, ```Turtle```

![Alt text](/docs/Story7-Shield.png?raw=true "Composite Pattern")

<img src="/docs/Story7_use_case_specification.png"  width="500" height="500">

#### Observer

Though we used observer patterns quite a bit in our game, but the main observer in focus is advancing level. Once Turtle eats lettuce or bug, the score counter gets updated (via observer) and level counter. Both ```ScoreCounter``` and ```Level``` implements  ```IScoreObserver```. ```IScoreSubject``` is implemented by ```Counter```. The data flow is such, that on every eat, we update the counter via observer and once the counter is updated we update the level via another observer. Reason we implemented in such a way is because Level upgrade events are only emmited at a factor of 20 (when we change our next level).

![Alt text](/docs/Story6-AdvancingToNextLevel.png?raw=true "Observer Pattern")

<img src="/docs/Story6_use_case_specification.png"  width="500" height="500">

#### Feature 1
Game End: 

This feature is to end the game once snake eats a turtle. Since snake can move freely and in case turtle has 0 shield power, if snakes get in touch with Turtle, using the observer patterns we have in our game. On this special event, the world drops all its actors and displays Looser. This event only and can only happen when shield is not their on the turtle.

![Alt text](/docs/Story5-EatTurtle.png?raw=true "Game End")

<img src="/docs/Story5_use_case_specification.png"  width="500" height="500">

#### Feature 2
Bug Move Randomly:

This feature enables our Lady bug to move randomly. When lady bug encounters the world's edge, it changes its position and make turns instead of getting stuck at the edge. The feature enables bug to move on top of turtles and lettuces. This is to avoid collisions between different actors in our game. 

![Alt text](/docs/Story9-LadyBug.png?raw=true "Bug Move Randomly")

<img src="/docs/Story9_use_case_specification.png"  width="500" height="500">

#### Feature 3
Won the game

When turtle is moving, turtle can eat many things and user gains points on the basis of what was eaten by the turtle. User also gets point when turtle has a gun power if turtle shoots down snake. Whenever turtle eats or kills anything, it will be notified to ```ScoreManager``` which will keep track of points. This is a notification type of calling. Therefore, we decided to use Observer pattern here. When ScoreManager adds score, it will also notify Level class to keep track of the levels. So if user is on the highest level and reaches to 2000 points, the game will be over and user will be declared as winner.

Interface: ```IScoreObserver```
Class: ```ScoreManager```, ```Level```

![Alt text](/docs/Story10-WonTheGame.png?raw=true "Won the game")

<img src="/docs/Story10_use_case_specification.png"  width="500" height="500">

#### Feature 4
Point System for Lettuce and Bug

This feature is related to the Points System for Lettuce and Bug. When the turtle eats lettuce or bug, we notify the game counter to increase the score by either 5 (for lettuce) and 20 (for bug). Point system uses a combination of observer and ```ScoreManager```. Scoremanager tracks the score and creates Redlettuce after it reaches it threshold. Basically point system is the backbone of the game to keep all the subjects and observers go hand-in-hand.

![Alt text](/docs/Story4-EatLettuceAndBug(Point%20System).png?raw=true "Eat Lettuce And Bug")

<img src="/docs/Story4_use_case_specification.png"  width="500" height="500">

#### Feature 5
Snake Attraction

For this we have used method ```getNeighbours()``` provided by Greenfoot. On every move snake keeps on checking if there is a turtle in its radius of effect (```getNeighbours()```). On finding	a turtle in its neighborhood, snake’s changes its direction and starts moving in direction of the turtle. Also snake’s image changes to ‘RedSnakeImage’ on attraction.

Classes: ```Snake```, ```Turtle```

![Alt text](/docs/Story3-SnakeAttracted.png?raw=true "Snake Attraction")

<img src="/docs/Story3_use_case_specification.png"  width="500" height="500">
<file_sep>/**
 * 
 * @author (Saumil) 
 */
public class DifficultyLevelLow implements DifficultyStrategy
{
    private int numberOfSnakes;
    private int speedOfSnake;
    private int snakeVisibilityRadius;
    
    public DifficultyLevelLow()
    {
        this.numberOfSnakes = 5;
        this.speedOfSnake = 1;
        this.snakeVisibilityRadius = 10;
    }
    
    public int getNumberOfSnakes()
    {
        return this.numberOfSnakes;
    }
    
    public int getSpeedOfSnake()
    {
        return this.speedOfSnake;
    }
    
    public int getSnakeVisibilityRadius()
    {
        return this.snakeVisibilityRadius;
    }
}
<file_sep>public class ShotObserver implements IShotObserver
{

     public void invoke() {
        System.out.println("In shot observer");
        Turtle turtle = Turtle.getTurtle();
        Shield shield = turtle.getShield();
        shield.removeDecorator();
    }
}<file_sep><h1>Team Project Repo</h1> 

<h2>Team</h2>

<h3>Game Squad</h3>

<h2>Team Members</h2>

* <h3>[<NAME>](https://github.com/mariannepaulson/cmpe202)</h3>
* <h3>[<NAME>](https://github.com/saumilnpatel17/cmpe202)</h3>
* <h3>[<NAME>](https://github.com/Anjali-Deshmukh/cmpe202)</h3>
* <h3>[<NAME>](https://github.com/megha-31/cmpe202)</h3>
* <h3>[<NAME>](https://github.com/chiragarora1703/cmpe202)</h3>

<h2>Project Name</h2>

<h3>TurtleWorld</h3>

<h2>Project Description</h2>

We started with a cute turtle game one of us created based on watching <NAME>'s video series.

https://blogs.kcl.ac.uk/proged/2012/01/14/joc-9/

The initial commit of code is from watching how to create this game and creating it from scratch. We then added counter, custom sounds, and experimented with the Greenfoot UI.

We then refactored the code into patterns taught in class.

Finally, we came up with 10 user stories and implemented all 10 features. We picked two features each.

<h2>Project Progress</h2>

<h3>Project Dashboard</h3>
https://docs.google.com/spreadsheets/d/1mopQ8FHEn-voEusz9E8PlLg993NWcqjp-fM39Le03FU/edit

<h3>Burndown Map</h3>
<img src="docs/BurnDownChart.PNG" alt="Markdown Monster icon" style="float: left; margin-right: 10px;" />
<br/>

<h3>Advertising our game</h3>

https://www.youtube.com/watch?v=X-OZWBY9mkE

<h3>Individual Contributions</h3>

All team members contributed equally to create mocks, original features for the game, user specifications, accomodating sequence diagrams and presentation. We took turn acting as a scrum master during the project.

- Megha
    - Worked on Decorator pattern for shield which decorates the shield with power to attack snakes
    - Worked on feature point system which controls the levels and scoring of the game
    - Implemented changes to make greenfoot application compatible in Android for wow factor
- Marianne
    - Pitched the idea for this wonderfull game and also worked on our stunning advertisement
    - Worked on observer pattern to update the level in the game
    - Worked on lady bug movement feature which makes ladybug move randomly and over other actors
- Anjali
    - Worked on Composite pattern to add shield with power on turtle. Due to this pattern turtle and shield act like one component and one can add multiple attributes to the turtle as a component
    - Worked on feature Snake Attraction. This enables snake to get attracted towards turtle. If turtle is in its vicinity the snake turns red
    - Converted the mocks from paper to balsamiq mocks
- Chirag
    - Worked on factory pattern to create all actors using multithread and timer. After submitting the create actor request to the queue, the implementation creates actors dynamically
    - Worked on feature 'Game Over' when turtle dies. In this feature when snake eats turtle, game world state is changed to EndWorld state and all the objects are dropped from the world
    - Researched on multiplayer and android application for wow factor
- Saumil
    - Worked on the strategy pattern to add difficulty levels to the game (LOW, MEDIUM, HIGH). These difficulty levels control the speed and count of the snakes in the world
    - Worked on the feature 'Won The Game' which keeps track of levels. Once points reach the maximum threshold, the world transitions to end of game
    - Worked on README enhancements

<h2>Issues</h2>

- We had some issues in editing README and ended up with multiple one liner commits from web
- On merging the branch, the setting to auto delete the branch was used. Due to which branches were deleted.  
- We had setup automatic triggers to update the issues to change its status, but those didn't work. We had to manually close   the issues. But pull requests are their if you want to look at each branches.
- Due to github account getting flagged, Chirag was blocked. We ended up creating duplicate issues with same context. Now account has been reset. We see all the duplicate issues under issues section.
- We were uncertain about project board. We interpreted project board as Google Task Sheet.

<h2>Wow Factor</h2>

https://github.com/nguyensjsu/sp19-202-game-squad/tree/wowtry

References: https://github.com/rhildred/droidfoot
<file_sep><h1>Week 2 Scrum Report</h1>

<h2><NAME></h2>

### Finished Last Week 
- Task 1: Some more research on new features and how to refactor using patterns.

- Task 2: I got my three features assigned (turtle dance, advance to next level and lady bug) and 
- created wireframes for these using Balsamic. I also created use case specifications for these.

- Task 3: 
- I spent time on process 
	-	How to use Github issue tracking
	-	How to create branching
	-	Understanding how our team was going to work on github
	-	Also learned how to effectively use Standbot on Slack for daily standups.
	-	Took the first stab at project task board (actually twice)

### Planned Next Week 
- Code my two features (dropped turtle dance)
- Create sequence diagrams for my two features
- Finetune wireframes
- Help team with process issues

### Problems

- I was not able to get the turtle to make any nice moves. Also, as a team, we did not 
  find this feature to be very valuable. Therefore, we removed this feature from the 
  backlog.

### Time Spend

- Task1: 4 hrs
- Task2: 6 hrs 
- Task 3: 4 hours

### Ensuring my XP core value of Courage

Our team is very honest so there is no issue there. However, I had to remind the team 
about improving on their estimates. When we say we will complete something by a 
certain date, we need to try our hardest to meet our estimate. Therefore, if we 
know we have a time conflict, we should be upfront about it and try and estimate
correctly.
<h2></h2>
<h2><NAME></h2>

### Finished Last Week 
- Wrapped up the factory pattern to create actors using multi-thread in the backgroun and using timer to control the creation of the actors
- Started looking into Turtle kill feature story and how to update the counter score board.
- Fixed some integration issues that arised in greenfoot when merging others code.

### Planned Next Week 
- Implementing initial framework for the world.
- Technical story for a design pattern. Factory Pattern. Create lady bug and different types of lettuce (green and red).
- Will be working on initial grounding work of observer pattern for Turtle kill. 

### Problems

- Got my Github account flagged. I emailed GitHub support but due to no response, creating a new account and transferring all commits under this new account. Waiting for access to our project.

### Time Spend

- Task1: 7 hrs
- Task2: 3 hrs 
- Task3: 3 hrs

### XP Core Value

All the team members were respecting each other ideas. Though respect should also be regarded in terms of time. Most of the teammembers were on time for our meetings. Reminded them to be on time.
<h2></h2>
<h2><NAME></h2>

### Accomplished Last Week

- Task 1: We did a research on what design patterns will be suitable for the game and what features will go in the game.

- Task 2: As discussed in the team meeting, I got my 3 user stories that is Create Difficulty Levels, keep the count of snake so that we can create a new snake when snake gets killed and won the game.

- Task 3: Started creating wireframes on paper and then later moved it to Balsamic.

- Task 4: We switched from weekly standup to 3 times a week standup routine. We started using standbot in slack for standups.

- Task 5: Learn more about github to make it easier for team to work in parallel environment

### Planned Next Week

- Start working on my design pattern user story
- Finetune wireframes

### Blockers

- I didn't have any blockers.

### Time Spend

Task 1: 2 hours
Task 2: 2 hour
Task 3: 3 hours
Task 4: 3 hours
Task 5: 2 hours

### XP Value : Feedback

During this week, I gave feedback to the team based on wireframes and use case specifications. I also suggested them some modifications to make user stories much more efficient.
<h2></h2>
<h2>Megha</h2>

### Finished Last Week

- Task 1: I got my two features assigned (Decorate Shield and Points System). Created User stories for both the assigned tasks.

- Task 2: Re-read about the decorator pattern and it's implementation. Finalized the design of Decorator on Shield.

- Task 3: Started implementation of Decorator pattern. Stubbed code for Red lettuce as it's development was in progress and I didn't want to block myself.

- Task 4: Helped team with github issues

- Task 5: Worked on implementation of turtle shooting gunshots in Greenfoot

### Planned Next Week

- Finish the design pattern (Decorate Shield)
- Start implementation on the feature (Points System).
- Create sequence diagrams for my two features

### Problems

- None

### Time Spend

- Task1: 2 hrs
- Task2: 4 hrs
- Task 3: 4 hours
- Task 4: 2 hours

### Ensuring my XP core value of Simplicity

Since we have started development this week, a lot of features are dependent on each other and most of them are in development state. I made sure that we were stubbing dependent code and there were no blockers so that we can proceed with our development. Using this simple technique we were able to progress smoothly.
<h2></h2>
<h2><NAME></h2>

### Finished Last Week 
- Task 1: Some more research on new features and how to refactor using patterns.

- Task 2: I got my two stories assigned (Snake Attracted to turtle in its vicinity, Shield for Turtle) and
- created wireframes for these using Balsamic. I also created use case specifications for these.

- Task 3: Implemented speed and movement of snake and logic so that Snakes don't get too close to each other. Snake tries to repel other Snake
- I spent time on process 
	-	How to use Github issue tracking
	-	How to create branching
	-	Understanding how our team was going to work on github
	-	Also learned how to effectively use Standbot on Slack for daily standups.

### Planned Next Week 
- Code my two stories 
- Create sequence diagrams for my two stories 


### Problems

N/A

### Time Spend

- Task1: 4 hrs
- Task2: 6 hrs 
- Task 3: 4 hours

### Ensuring my XP core value of Communication

I have ensured that our team has regular meetings whenever needed. Also that team is comfortable with the meeting timings and duration.
<file_sep>import java.util.List;

import greenfoot.*;

public class Snake extends Animal {
    /**
     * Act - do whatever the Snake wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() {
        List<Snake> snakes = this.getNeighbours(30, false, Snake.class);
        if (!snakes.isEmpty()) {
            this.turn(WorldConfig.getInstance().TURTLE_DEGREE);
            move(WorldConfig.getInstance().SPEED_OF_SNAKES * 5);
        }

        List<Turtle> turtles = this.getNeighbours(WorldConfig.getInstance().SNAKES_ATTRACTION, true, Turtle.class);
        if (!turtles.isEmpty()) {
            this.setImage("snake2_red.png");

            Turtle turtle = turtles.get(0);
            this.turnTowards(turtle.getX(), turtle.getY());
            move(0);
        } else {
            move(WorldConfig.getInstance().SPEED_OF_SNAKES);
            this.setImage("snake2.png");
            randomTurn();
        }
        worldEdge();
        eatTurtle();
    }

    /**
     * Check if lettuce there and then eat
     */
    public void eatTurtle() {
        if (canSee(Turtle.class) && (Turtle.getShield().power == 1)) {
            World world = Turtle.getTurtle().getWorld();
            eat(Turtle.class);
            eat(Shield.class);
            Helper.loadEndScreen("Looser", world); 

        }
    }

}
<file_sep>import greenfoot.*;
public interface ActorFactory  
{
    public Actor createActor(String type, int x, int y);
}
<file_sep>public interface IShield  
{
    void attack();
}<file_sep>/**
 * Write a description of class WorldConfig here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class WorldConfig {

    private static WorldConfig worldConfig;
    public DifficultyStrategy ds;

    private static int x = 800;
    private static int y = 800;
    private static int cellSize = 1;
    
    // Turtle configuration
    public int TURTLE_SPEED = 2;
    public int TURTLE_DEGREE = 3;
    
    // Ammo configuration
    public int SHOTS = 5;

    // Level  configuration
    public int MAX_LEVEL=10;
    public int LEVEL_FACTOR=20; // level increment in

    // Lettuce configuration
    public int NUM_OF_LETTUCE = 5;
    public int RED_LETTUCE_CREATION_ON_SCORE = 40;
    public int NUM_OF_RED_LETTUCE = 1;
    public int LETTUCE_CREATION_DELAY = 30;

    // Snake configuration
    // these will come from strategy pattern, defaults
    public int NUM_OF_SNAKES = 5;
    public int SPEED_OF_SNAKES = 1;
    public int SNAKES_ATTRACTION = 50;
    public int SNAKE_CREATION_DELAY = 30;

    // Bugs configuration
    public int NUM_OF_BUGS = 1;
    public int BUG_SPEED = 1;
    public int BUG_CREATION_DELAY = 60;

    private WorldConfig(DifficultyStrategy ds)
    {
        this.ds = ds;
        NUM_OF_SNAKES = ds.getNumberOfSnakes();
        SPEED_OF_SNAKES = ds.getSpeedOfSnake();
    }

    public static WorldConfig getInstance()
    {
        return worldConfig;
    }

    public static void createWorldConfig(DifficultyStrategy ds)
    {
        worldConfig = new WorldConfig(ds);
    }

    public static int getX() {
        return x;
    }

    public static int getY() {
        return y;
    }

    public static int getCellSize() {
        return cellSize;
    }
}
<file_sep>/**
 * @author (Saumil)
 */
public class DifficultyLevelHigh implements DifficultyStrategy  
{
    private int numberOfSnakes;
    private int speedOfSnake;
    private int snakeVisibilityRadius;
    
    public DifficultyLevelHigh()
    {
        this.numberOfSnakes = 10;
        this.speedOfSnake = 3;
        this.snakeVisibilityRadius = 30;
    }
    
    public int getNumberOfSnakes()
    {
        return this.numberOfSnakes;
    }
    
    public int getSpeedOfSnake()
    {
        return this.speedOfSnake;
    }
    
    public int getSnakeVisibilityRadius()
    {
        return this.snakeVisibilityRadius;
    }
}
