Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refinement #247

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ When in doubt simplify.
* [The Impossible Halting Turing Machine](https://github.com/Phuire-Research/Stratimux/blob/main/Index.md) - Original Paper for Stratimux
* [Muxified Turing Machine](https://github.com/Phuire-Research/Stratimux/blob/main/The-Muxified-Turing-Machine.md) - The governing concept for this entire framework.:|

## Change Log ![Tests](https://github.com/Phuire-Research/Stratimux/actions/workflows/node.js.yml/badge
## Change Log ![Tests](https://github.com/Phuire-Research/Stratimux/actiActionStrategies are working as intended.ons/workflows/node.js.yml/badge)
### Strategy Determine 0.2.47
* Ensured that the Strategy Determine helper function is working as intended. Noting it creates a single Action Strategy, this is used primarily in Methods to ensure Halting Completeness.
* Now accepts Any Action and no longer requires an options object.
### Verbose Bad Actions 0.2.46
* The Muxium Bad Action Quality is now being utilized and setting the muxium's bad action property as intended.
### Restored Dialog Functionality 0.2.44
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "stratimux",
"license": "GPL-3.0",
"version": "0.2.46",
"version": "0.2.47",
"description": "Muxified Turing Machine",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
12 changes: 6 additions & 6 deletions src/model/action/strategy/actionStrategyConsumersAdvanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This provides additional functionality for the consumption of ActionStrategies n
$>*/
/*<#*/
import { muxiumConclude } from '../../../concepts/muxium/qualities/conclude.quality';
import { Action, nullActionType } from '../action.type';
import { Action, AnyAction, nullActionType } from '../action.type';
import { ActionNode, ActionStrategy } from './actionStrategy.type';
import { createActionNode, createStrategy } from './actionStrategy';
import { createSentence } from './actionStrategyHelpers';
Expand Down Expand Up @@ -57,17 +57,17 @@ export const strategyBackTrack = (_strategy: ActionStrategy): Action => {
};

export const strategyDetermine = <T extends Record<string, unknown>>(
action: Action,
options: {
action: AnyAction,
options?: {
topic?: string,
priority?: number,
data?: T
}): Action => {
return strategyBegin(createStrategy({
topic: options.topic ? options.topic : 'STRATEGY DETERMINED',
topic: options?.topic ? options.topic : 'STRATEGY DETERMINED',
initialNode: createActionNode(action),
priority: options.priority,
data: options.data
priority: options?.priority,
data: options?.data
}));
};

Expand Down
45 changes: 45 additions & 0 deletions src/test/strategyDetermine.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*<$
For the asynchronous graph programming framework Stratimux, generate a test that ensures that the strategyDetermine helper function is
dispatching a single action ActionStrategy, and is also able to accept any possible Action.
$>*/
/*<#*/
import { muxification } from '../model/muxium/muxium';
import { CounterState, createCounterConcept, CounterQualities } from '../concepts/counter/counter.concept';
import { Concept } from '../model/concept/concept.type';
import { strategyDetermine } from '../model/action/strategy/actionStrategyConsumersAdvanced';

test('Muxium Strategy Determine', (done) => {
const cpts = {counter: createCounterConcept()};
const muxium = muxification('muxiumStrategyTest', cpts, {logging: true, storeDialog: true});
const FINAL_COUNT = 7;

type DECK = {
counter: Concept<CounterState, CounterQualities>;
};
const plan = muxium.plan<DECK>('Counting Strategy Plan',
({stage}) => [
stage(({dispatch, d, e}) => {
// Ensure that the entry is assigned to the Muxium for the sake of testing.
e.muxiumKick();
// Specified test starts here.
dispatch(strategyDetermine(d.counter.e.counterAdd()), {
iterateStage: true
});
}),
stage(({dispatch, d}) => {
expect(d.counter.k.count.select()).toBe(1);
dispatch(strategyDetermine(d.counter.e.counterSetCount({
newCount: FINAL_COUNT
})), {
iterateStage: true
});
}),
stage(({d}) => {
expect(d.counter.k.count.select()).toBe(FINAL_COUNT);
setTimeout(() => {done();}, 500);
plan.conclude();
muxium.close();
})
]);
});
/*#>*/
Loading