| Line 79: |
Line 79: |
| | console.log("instructions are an object, in path " + path); | | console.log("instructions are an object, in path " + path); |
| | | | |
| − | //|||||||||||||||||| Check if elements of instruction object are arrays themselves |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| | + | //||||||||||||||||||||||||||[ Check if elements of instruction object are arrays themselves ]|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |
| | | | |
| | if ( Array.isArray (read[path]) ) { | | if ( Array.isArray (read[path]) ) { |
| Line 87: |
Line 87: |
| | console.log("instructions are an array of arrays, going through " + read[ path ][ path2 ] ); | | console.log("instructions are an array of arrays, going through " + read[ path ][ path2 ] ); |
| | future_return_partition = data_function( future_return_partition, read[ path ][ path2 ] ); | | future_return_partition = data_function( future_return_partition, read[ path ][ path2 ] ); |
| − | //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| + | |
| | //|||||||||||||||||||||||||||||||||||||||||||||||||||[ I N S T R U C T I O N S C O N T R O L |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| | | //|||||||||||||||||||||||||||||||||||||||||||||||||||[ I N S T R U C T I O N S C O N T R O L |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |
| | | | |
| Line 99: |
Line 99: |
| | | | |
| | //|||||||||||||||||| If instruction object element is not an array anymore, lets just do one step |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| | | //|||||||||||||||||| If instruction object element is not an array anymore, lets just do one step |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |
| − | //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |
| | | | |
| | else { | | else { |
| Line 112: |
Line 111: |
| | } | | } |
| | | | |
| − | //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |
| | //||||||||||||[ If we are not in instruction object, let's see if we have an instruction array ]||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| | | //||||||||||||[ If we are not in instruction object, let's see if we have an instruction array ]||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |
| | | | |
| Line 122: |
Line 120: |
| | } | | } |
| | | | |
| − | //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |
| | //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| | | //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |
| | | | |
| Line 128: |
Line 125: |
| | temp_obj = data_function( temp_obj, read ); | | temp_obj = data_function( temp_obj, read ); |
| | } | | } |
| − |
| + | |
| | return temp_obj; | | return temp_obj; |
| | } | | } |
| | | | |
| − |
| |
| − |
| |
| − |
| |
| − |
| |
| − |
| |
| − | //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |
| | //|||||||||||||||||||||||||||||||||||||||||||||||||||||[ S T E P B L O C K ]||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| | | //|||||||||||||||||||||||||||||||||||||||||||||||||||||[ S T E P B L O C K ]||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |
| | | | |
| Line 155: |
Line 146: |
| | // if we are not on an array level, proceed with the path | | // if we are not on an array level, proceed with the path |
| | console.log("data is on an objective level"); | | console.log("data is on an objective level"); |
| − | temp_obj = checkdive( temp_obj, moving ); | + | future_temp_obj = checkdive( temp_obj, moving ); |
| | + | if ( future_temp_obj !== undefined ){ |
| | + | temp_obj = future_temp_obj; |
| | + | } else { |
| | + | if temp_obj.includes(moving) { |
| | + | return moving; |
| | + | } |
| | + | } |
| | | | |
| | } | | } |
| Line 176: |
Line 174: |
| | return potential_return; | | return potential_return; |
| | } | | } |
| | + | if ( array == read || ) |
| | } | | } |
| | | | |