automated-gameplay-transmitter
v0.6.4
Published
This package provides a **generic automation engine** for browser‑based games and a set of shared React components/contexts.
Readme
Automated Gameplay Transmitter
This package provides a generic automation engine for browser‑based games and a set of shared React components/contexts.
- Browser and socket interfaces (
src/lib/Browser,src/lib/Socket) - Game modules (e.g.
cookieclicker) exposing state, actions and DOM scrapers - React UI building blocks (
components/andcontexts/) for displaying stream information, comments, speech, etc.
Markov Chain Model
The package exports a Markov chain model as MarkovModel from both root entry points.
You can create and train a model with MarkovModel.create(...).
import { MarkovModel } from "automated-gameplay-transmitter";
// or: import { MarkovModel } from "automated-gameplay-transmitter/server";
const model = MarkovModel.create();
model.learn("こんにちは。");
const reply = model.reply("元気ですか?");Trace mode
Pass { trace: true } as the third argument to model.gen() to receive both the
generated text and the sequence of nodes (words) that were picked during generation:
const result = model.gen('', 1, { trace: true }) as { text: string; nodes: string[] };
console.log(result.text); // e.g. "こんにちは。"
console.log(result.nodes); // e.g. ["こ", "ん", "に", "ち", "は", "。"]Without the trace option (default behaviour) gen returns a plain string.
Layout Example
The Layout component arranges three panels — main, side, and bottom — in a 16:9 grid.
Each panel can be wrapped with a Container and Box component for a styled container.
(source)
import { Box, Container, Layout } from "automated-gameplay-transmitter";
export function App() {
return (
<Layout count={10} span={8} className="text-white">
<Container><Box>Main Panel</Box></Container>
<Container><Box>Side Panel</Box></Container>
<Container><Box>Bottom Panel</Box></Container>
</Layout>
);
}
The Box component defaults to a black background with a white solid border.
Style props (bgColor, borderColor, borderStyle, borderWidth, rounded) can be used to customize the appearance:
<Box bgColor="bg-slate-900" borderColor="border-emerald-300" borderStyle="border-double" borderWidth="border-4" rounded="rounded-xl">
Custom styled panel
</Box>