package com.pm.server.manager;

import com.pm.server.datatype.GameState;
import com.pm.server.datatype.Pacdot;
import com.pm.server.registry.GameStateRegistry;
import com.pm.server.registry.PacdotRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GameStateManagerImpl implements GameStateManager {

    private GameStateRegistry gameStateRegistry;
    private PacdotRegistry pacdotRegistry;

    @Autowired
    public GameStateManagerImpl(
            GameStateRegistry gameStateRegistry,
            PacdotRegistry pacdotRegistry) {
        this.gameStateRegistry = gameStateRegistry;
        this.pacdotRegistry = pacdotRegistry;
    }

    @Override
    public Integer getScore() {
        Integer score = 0;
        List<Pacdot> pacdotList = pacdotRegistry.getAllPacdots();
        for(Pacdot pacdot : pacdotList) {
            if(pacdot.getEaten()) {
                if(pacdot.getPowerdot()) {
                    score += 50;
                }
                else {
                    score += 10;
                }
            }
        }
        return score;
    }

    @Override
    public GameState getCurrentState() {
        return gameStateRegistry.getCurrentState();
    }

}

@@ -195,24 +195,70 @@
 otRegistry;%0A
+import com.pm.server.registry.PlayerRegistry;%0A
 import org.s
@@ -308,16 +308,16 @@
 owired;%0A
-
 import o
@@ -545,16 +545,59 @@
 egistry;
+%0A    private PlayerRegistry playerRegistry;
 %0A%0A    @A
@@ -728,16 +728,59 @@
 Registry
+,%0A            PlayerRegistry playerRegistry
 ) %7B%0A    
@@ -869,24 +869,70 @@
 otRegistry;%0A
+        this.playerRegistry = playerRegistry;%0A
     %7D%0A%0A    @
@@ -999,16 +999,17 @@
 re = 0;%0A
+%0A
         
@@ -1318,32 +1318,32 @@
 %7D%0A            %7D%0A
-
         %7D%0A      
@@ -1328,32 +1328,92 @@
     %7D%0A        %7D%0A
+%0A        score += playerRegistry.getCapturedGhosts() * 50;%0A%0A
         return s

Add eaten Ghosts to game score