mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-24 18:22:58 +02:00
CONTRACTS: Display contract answers on completely failed contracts (#2440)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { CodingContractName } from "@enums";
|
||||
import { CodingContractTypes, removeBracketsFromArrayString } from "../ContractTypes";
|
||||
import { exceptionAlert } from "../../utils/helpers/exceptionAlert";
|
||||
import { getRandomIntInclusive } from "../../utils/helpers/getRandomIntInclusive";
|
||||
|
||||
export const generateIPAddresses: Pick<CodingContractTypes, CodingContractName.GenerateIPAddresses> = {
|
||||
@@ -28,7 +29,7 @@ export const generateIPAddresses: Pick<CodingContractTypes, CodingContractName.G
|
||||
|
||||
return str;
|
||||
},
|
||||
solver: (data, answer) => {
|
||||
getAnswer: (data) => {
|
||||
const ret: string[] = [];
|
||||
for (let a = 1; a <= 3; ++a) {
|
||||
for (let b = 1; b <= 3; ++b) {
|
||||
@@ -51,6 +52,18 @@ export const generateIPAddresses: Pick<CodingContractTypes, CodingContractName.G
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
},
|
||||
solver: (data, answer) => {
|
||||
const ret = generateIPAddresses[CodingContractName.GenerateIPAddresses].getAnswer(data);
|
||||
if (ret === null) {
|
||||
exceptionAlert(
|
||||
new Error(
|
||||
`Unexpected null when calculating the answer for ${CodingContractName.GenerateIPAddresses} contract. Data: ${data}`,
|
||||
),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return ret.length === answer.length && ret.every((ip) => answer.includes(ip));
|
||||
},
|
||||
convertAnswer: (ans) => {
|
||||
|
||||
Reference in New Issue
Block a user