feat: added a behavior program reduction algorithm

This commit is contained in:
Gerla, J. (Justin)
2025-11-05 15:21:59 +00:00
parent 52b839ae51
commit c4845c6738
9 changed files with 1401 additions and 73 deletions

View File

@@ -10,12 +10,13 @@ import '@xyflow/react/dist/style.css';
import {useShallow} from 'zustand/react/shallow';
import {
StartNode,
EndNode,
PhaseNode,
NormNode
StartNodeComponent,
EndNodeComponent,
PhaseNodeComponent,
NormNodeComponent
} from './visualProgrammingUI/components/NodeDefinitions.tsx';
import {DndToolbar} from './visualProgrammingUI/components/DragDropSidebar.tsx';
import graphReducer from "./visualProgrammingUI/GraphReducer.ts";
import useFlowStore from './visualProgrammingUI/VisProgStores.tsx';
import type {FlowState} from './visualProgrammingUI/VisProgTypes.tsx';
import styles from './VisProg.module.css'
@@ -26,10 +27,10 @@ import styles from './VisProg.module.css'
* contains the types of all nodes that are available in the editor
*/
const NODE_TYPES = {
start: StartNode,
end: EndNode,
phase: PhaseNode,
norm: NormNode
start: StartNodeComponent,
end: EndNodeComponent,
phase: PhaseNodeComponent,
norm: NormNodeComponent
};
/**
@@ -123,6 +124,12 @@ function VisualProgrammingUI() {
);
}
// currently outputs the prepared program to the console
function runProgram() {
const program = graphReducer();
console.log(program);
}
/**
* houses the entire page, so also UI elements
* that are not a part of the Visual Programming UI
@@ -132,6 +139,7 @@ function VisProgPage() {
return (
<>
<VisualProgrammingUI/>
<button onClick={runProgram}>run program</button>
</>
)
}