<commit_before>import { getRule } from "./validationrules";
import { getBoardInfoByIndex, getArrowRotationLimit } from "../adapter/boardinfo";
import { Game } from "../types";
import "./validation.common";
import { BankEvent, ItemShopEvent, BooEvent } from "../events/builtin/events.common";

const commonRules = [
  getRule("TOOMANYBOWSERS", { limit: 0 }),
  getRule("TOOMANYKOOPAS", { limit: 0 }),
  getRule("GATESETUP"),
  getRule("OVERRECOMMENDEDSPACES", { max: 128 }),
  getRule("ADDITIONALBGCODEISSUE"),
];

export function getValidationRulesForBoard(gameID: Game, boardIndex: number) {
  const rules = commonRules.slice(0);
  const boardInfo = getBoardInfoByIndex(gameID, boardIndex);

  const totalArrowsToWrite = getArrowRotationLimit(boardInfo);
  rules.push(getRule("TOOMANYARROWROTATIONS", { limit: totalArrowsToWrite }));

  if (boardIndex === 0) {
    rules.push(getRule("TOOMANYOFEVENT", { event: BankEvent, high: 2 }));
    rules.push(getRule("TOOMANYBANKS", { limit: 2 }));
    rules.push(getRule("TOOMANYOFEVENT", { event: ItemShopEvent, high: 2 }));
    rules.push(getRule("TOOMANYITEMSHOPS", { limit: 2 }));
    rules.push(getRule("TOOMANYOFEVENT", { event: BooEvent, high: 1 }));

    // TODO: gamemasterplc: @PartyPlanner64 replace 0x323AAC in ROM with a NOP if you want more boos
    rules.push(getRule("TOOMANYBOOS", { limit: 1 }));
    rules.push(getRule("TOOMANYGATES", { limit: 2 }));

    // TODO: gamemasterplc: if you want to fix being able to pick up stars with few of them @PartyPlanner64 overwrite rom offset 0x320058 with all zeroes
    rules.push(getRule("BADSTARCOUNT", { low: 8, high: 8 }));

    // No longer needed? See MP3 onAfterOverwrite.
    //rules.push(getRule("TOOFEWBLUESPACES", { low: 14 }));
    //rules.push(getRule("TOOFEWREDSPACES", { low: 1 }));
  }
  return rules;
}<commit_msg>Forgot to validate all MP3 boards the same.<commit_after>import { getRule } from "./validationrules";
import { getBoardInfoByIndex, getArrowRotationLimit } from "../adapter/boardinfo";
import { Game } from "../types";
import "./validation.common";
import { BankEvent, ItemShopEvent, BooEvent } from "../events/builtin/events.common";

const commonRules = [
  getRule("TOOMANYBOWSERS", { limit: 0 }),
  getRule("TOOMANYKOOPAS", { limit: 0 }),
  getRule("GATESETUP"),
  getRule("OVERRECOMMENDEDSPACES", { max: 128 }),
  getRule("ADDITIONALBGCODEISSUE"),
];

export function getValidationRulesForBoard(gameID: Game, boardIndex: number) {
  const rules = commonRules.slice(0);
  const boardInfo = getBoardInfoByIndex(gameID, boardIndex);

  const totalArrowsToWrite = getArrowRotationLimit(boardInfo);
  rules.push(getRule("TOOMANYARROWROTATIONS", { limit: totalArrowsToWrite }));

  rules.push(getRule("TOOMANYOFEVENT", { event: BankEvent, high: 2 }));
  rules.push(getRule("TOOMANYBANKS", { limit: 2 }));
  rules.push(getRule("TOOMANYOFEVENT", { event: ItemShopEvent, high: 2 }));
  rules.push(getRule("TOOMANYITEMSHOPS", { limit: 2 }));
  rules.push(getRule("TOOMANYOFEVENT", { event: BooEvent, high: 1 }));

  // TODO: gamemasterplc: @PartyPlanner64 replace 0x323AAC in ROM with a NOP if you want more boos
  rules.push(getRule("TOOMANYBOOS", { limit: 1 }));
  rules.push(getRule("TOOMANYGATES", { limit: 2 }));

  // TODO: gamemasterplc: if you want to fix being able to pick up stars with few of them @PartyPlanner64 overwrite rom offset 0x320058 with all zeroes
  rules.push(getRule("BADSTARCOUNT", { low: 8, high: 8 }));

  // No longer needed? See MP3 onAfterOverwrite.
  //rules.push(getRule("TOOFEWBLUESPACES", { low: 14 }));
  //rules.push(getRule("TOOFEWREDSPACES", { low: 1 }));

  return rules;
}
{'fraction_non_alphanumeric': 0.149491618576532, 'fraction_numerical': 0.01923605386095081, 'mean_word_length': 5.026490066225166, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2245765', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1233, 'n_words': 288}