@notcc/logic
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

NotCC logic

This package contains all the game logic for NotCC, a Chip's Challenge 2® emulator.

Legal notice

Chip's Challenge is a registered trademark of Bridgestone Media Group LLC, used here for identification purposes only. Not affiliated with, sponsored, or endorsed by Bridgestone Media Group LLC.

Example

// Verify a level's built-in solution

import { parseC2M, createLevelFromData, GameState } from "@notcc/logic"
import { readFileSync } from "fs"

const levelData = parseC2M(readFileSync("./funLevel.c2m").buffer)

const level = createLevelFromData(levelData)

level.playbackSolution(levelData.associatedSolution)

let bonusTicks = 60 * 60

while (level.gameState === GameState.PLAYING && bonusTicks > 0) {
	level.tick()
	if (level.solutionSubticksLeft === Infinity) {
		bonusTicks -= 1
	}
}

console.log(`Level built-in solution result: ${GameState[level.gameState]}`)

Readme

Keywords

none

Package Sidebar

Install

npm i @notcc/logic

Weekly Downloads

0

Version

1.1.6

License

MIT

Unpacked Size

842 kB

Total Files

89

Last publish

Collaborators

  • glander