Sierpinski fractales demo for sarl language
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
Antoine Bartuccio 30d45b7d62 Add Readme 2 年前
src/main/sarl/io/sarl/demos/sierpinski Documentation 2 年前
.gitignore Implements fractals 2 年前
Fractal_en.png Add Readme 2 年前
LICENSE Create LICENSE 2 年前
MVC_en.png Add Readme 2 年前
README.md Add Readme 2 年前
sierpinski-fractales.iml Implements fractals 2 年前
sierpinski_screenshot.png Add Readme 2 年前

README.md

MVC pattern

This application follows a MVC (Model-View-Controller) pattern for the GUI communication.

MVC pattern applied on this project

Sierpinski's fractals demo

This demo is about Sierpinski's fractals. Those are 3 triangles inside a triangle.

Agents organization in the fractal demo

To create this demo, only one agent was required. The idea is to create a main agent and then create 3 other agents in the inner context of the main agent. Then the main agent becomes an event broadcaster and so on and so forth for each fractals newly created.

agent Fractal {
	...

	on Initialize {
		if (occurrence.parameters.size >= 2){
			// If initialized with arguments

			screenSurface = occurrence.parameters.get(0) as Square
			positions = occurrence.parameters.get(1) as Positions

			if (occurrence.parameters.size.equals(3)){
				// If initialized by the GUI
				var ctrl = occurrence.parameters.get(2) as FXMLViewerController
				guiSpace =  defaultContext.createSpace(
					OpenEventSpaceSpecification, UUID.randomUUID)
				ctrl.setGUISpace(guiSpace)
				guiSpace.register(asEventListener)
			}
		} else {
			// If initialized without argument
			screenSurface = new Square
			positions = new Positions
		}
		screenWidth = screenSurface.width
		this.generatePoints
	}

	...

}

Application with the GUI