@@ -51,14 +51,19 @@ const isValidNetDefinition = (
5151/**
5252 * Converts SimulationState to a 2D array format.
5353 * Each step becomes an array of objects with placeId, marking, and placeLabel.
54+ *
55+ * Marking is also converted to a representation of an association list.
5456 */
55- const simulationStateTo2DArray = (
57+ const simulationStateToHazelFormat = (
5658 simulationState : SimulationState ,
5759) : HazelSimulationState => {
5860 return simulationState . map ( ( step ) => {
5961 return Object . entries ( step ) . map ( ( [ placeId , { marking, placeLabel } ] ) => ( {
6062 placeId,
61- marking,
63+ marking : Object . entries ( marking ) . map ( ( [ tokenId , count ] ) => ( {
64+ 0 : tokenId ,
65+ 1 : count ,
66+ } ) ) ,
6267 placeLabel,
6368 } ) ) ;
6469 } ) ;
@@ -77,7 +82,7 @@ const convertSimulationStateForHazel = (
7782 return undefined ;
7883 }
7984
80- return simulationStateTo2DArray ( simulationState ) ;
85+ return simulationStateToHazelFormat ( simulationState ) ;
8186} ;
8287
8388/**
@@ -95,8 +100,6 @@ export const App = () => {
95100 id,
96101 codec : "json" ,
97102 onInit : ( value ) => {
98- console . log ( "Received value" , value ) ;
99-
100103 try {
101104 const parsedValue = JSON . parse ( value ) ;
102105
@@ -123,7 +126,6 @@ export const App = () => {
123126
124127 const reportSimulationState = useCallback (
125128 ( simulationState : SimulationState ) => {
126- console . log ( "Simulation state reported" ) ;
127129 setSimulationState ( simulationState ) ;
128130
129131 setSyntax ( {
0 commit comments