-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes the formulation of some tasks and adds ExtraSheetTask4 class for task 4 on the extra sheet
- Loading branch information
1 parent
2606b61
commit 84c5e94
Showing
19 changed files
with
187 additions
and
141 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
project/src/main/java/de/unistuttgart/informatik/fius/jvk/tasks/ExtraSheetTask4.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* This source file is part of the FIUS JVK 2019 project. | ||
* For more information see github.com/FIUS/JVK-2019 | ||
* | ||
* Copyright (c) 2019 the FIUS JVK 2019 project authors. | ||
* | ||
* This software is available under the MIT license. | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
package de.unistuttgart.informatik.fius.jvk.tasks; | ||
|
||
import java.util.Random; | ||
|
||
import de.unistuttgart.informatik.fius.icge.simulation.Position; | ||
import de.unistuttgart.informatik.fius.icge.simulation.Simulation; | ||
import de.unistuttgart.informatik.fius.icge.simulation.tasks.Task; | ||
import de.unistuttgart.informatik.fius.icge.simulation.tools.PlayfieldModifier; | ||
import de.unistuttgart.informatik.fius.jvk.provided.entity.Coin; | ||
import de.unistuttgart.informatik.fius.jvk.provided.entity.Neo; | ||
import de.unistuttgart.informatik.fius.jvk.provided.entity.Wall; | ||
import de.unistuttgart.informatik.fius.jvk.provided.factories.CoinFactory; | ||
import de.unistuttgart.informatik.fius.jvk.provided.factories.WallFactory; | ||
import de.unistuttgart.informatik.fius.jvk.provided.shapes.Rectangle; | ||
|
||
/** | ||
* @author Sara Galle | ||
*/ | ||
public class ExtraSheetTask4 implements Task{ | ||
|
||
@Override | ||
public void run(Simulation sim) { | ||
PlayfieldModifier pm = new PlayfieldModifier(sim.getPlayfield()); | ||
buildEnvironment(pm); | ||
Neo neo = new Neo(); | ||
neo.setCoinsInWallet(500); | ||
pm.placeEntityAt(neo, new Position(1, 2)); | ||
//your code here | ||
|
||
} | ||
|
||
private void buildEnvironment(PlayfieldModifier pm){ | ||
// build the outside wall | ||
pm.placeEntityAtEachPosition(new CoinFactory(), new Rectangle(new Position(0, 0), new Position(11, 4))); | ||
|
||
Random r = new Random(); | ||
for(int i = 1; i < 11; i++){ | ||
if(r.nextDouble() < 0.4) | ||
pm.placeEntityAt(new Coin(), new Position(i, 1)); | ||
|
||
if(r.nextDouble() < 0.4) | ||
pm.placeEntityAt(new Coin(), new Position(i, 3)); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.