diff --git a/src/app/project/game-model/gamesystems/ProductGamesystem.ts b/src/app/project/game-model/gamesystems/ProductGamesystem.ts index a7d380f..eade33e 100644 --- a/src/app/project/game-model/gamesystems/ProductGamesystem.ts +++ b/src/app/project/game-model/gamesystems/ProductGamesystem.ts @@ -11,6 +11,7 @@ import {ScriptAccountAction} from "./actions/ScriptAccountAction"; import {ProductSystemGenerator} from "./productSystemGenerator/ProductSystemGenerator"; import {TemplateType} from "../templates/TemplateType"; import {ProductTemplateSystem} from "../templates/productGamesystem/ProductTemplateSystem"; +import {IsolatedProductStateGenerator} from "./productSystemGenerator/IsolatedProductStateGenerator"; export class ProductGamesystem extends Gamesystem { @@ -74,6 +75,9 @@ export class ProductGamesystem extends Gamesystem, Transition>) { diff --git a/src/app/project/game-model/gamesystems/productSystemGenerator/IsolatedProductStateGenerator.ts b/src/app/project/game-model/gamesystems/productSystemGenerator/IsolatedProductStateGenerator.ts new file mode 100644 index 0000000..99b8919 --- /dev/null +++ b/src/app/project/game-model/gamesystems/productSystemGenerator/IsolatedProductStateGenerator.ts @@ -0,0 +1,53 @@ +import {ProductSystemGenerator} from "./ProductSystemGenerator"; +import {ProductGenerationData} from "./ProductGenerationData"; +import {ProductGeneratorResult} from "./ProductGeneratorResult"; +import {ProductState} from "../states/ProductState"; + +export class IsolatedProductStateGenerator extends ProductSystemGenerator { + + generateIsolatedProductStates() { + if(this.productGamesystem.innerGamesystems.length < 2) return; + + const leftInitialData = this.prepareChildsystemForGeneration(this.productGamesystem.innerGamesystems[0]) + const rightInitialData = this.prepareChildsystemForGeneration(this.productGamesystem.innerGamesystems[1]) + + const initialGenerationResult = this.generateBinaryIsolatedProductStates(leftInitialData, rightInitialData); + + if(this.productGamesystem.innerGamesystems.length > 2) { + for(let i=2; i { + if(leftState.outgoingTransitions.length == 0 && leftState.incomingTransitions.length == 0) { + rightSystemData.states.forEach(rightState => { + if(rightState.outgoingTransitions.length == 0 && rightState.incomingTransitions.length == 0) { + const leftConditions = this.getStateConditions(leftState, true); + const rightConditions = this.getStateConditions(rightState, true); + + if(!this.contradictCombinedConditions(leftConditions, rightConditions)) { + this.generateBinaryProductState(leftState, rightState, generatedProductStates); + } + } + }) + } + }) + return new ProductGeneratorResult(generatedProductStates, []); + } + +}