balancing
This commit is contained in:
parent
38d77bcc7c
commit
43198a382b
|
@ -5,7 +5,7 @@ import { shuffle } from './utils'
|
|||
type HistoryType = { a: number; b: number; op: OperatorType }[]
|
||||
|
||||
export function isHardEnough(num: number): boolean {
|
||||
return num % 100 > 0
|
||||
return num % 100 > 0 && num % 50 > 0
|
||||
}
|
||||
|
||||
export function isOperationResultValid(op: Operation): boolean {
|
||||
|
|
|
@ -12,14 +12,18 @@ function getSharingText(): string {
|
|||
const endResult = operations[operations.length - 1].result?.value ?? 0
|
||||
const success = result.value === endResult
|
||||
|
||||
const allSymbols = ['🄰', '🄱', '🄲', '🄳', '🄴', '🄵', '🄶', '🄷', '🄸', '🄹']
|
||||
// const allSymbols = ['𝙰', '𝙱', '𝙲', '𝙳', '𝙴', '𝙵', '𝚅', '𝚆', '𝚇', '𝚈', '𝚉']
|
||||
const abcSymbols = ['𝚊', '𝚋', '𝚌', '𝚍', '𝚎', '𝚏']
|
||||
const xyzSymbols = ['𝚟', '𝚠', '𝚡', '𝚢', '𝚣'].slice(-(operations.length - 1))
|
||||
// const xyzSymbols = ["𝚊'", "𝚋'", "𝚌'", "𝚍'", "𝚎'", "𝚏'"]
|
||||
// const xyzSymbols = ['𝚅', '𝚆', '𝚇', '𝚈', '𝚉']
|
||||
const squares = ['🟦', '🟩', '🟨', '🟧', '🟥']
|
||||
|
||||
const lines: string[] = []
|
||||
for (const op of operations) {
|
||||
op.left!.symbol = op.left!.symbol ?? allSymbols.shift()
|
||||
op.right!.symbol = op.right!.symbol ?? allSymbols.shift()
|
||||
op.result!.symbol = op.result!.symbol ?? allSymbols.shift()
|
||||
op.left!.symbol = op.left!.symbol ?? abcSymbols.shift()
|
||||
op.right!.symbol = op.right!.symbol ?? abcSymbols.shift()
|
||||
op.result!.symbol = op.result!.symbol ?? xyzSymbols.shift()
|
||||
|
||||
let s = ''
|
||||
switch (op.operator) {
|
||||
|
@ -43,7 +47,9 @@ function getSharingText(): string {
|
|||
)
|
||||
}
|
||||
|
||||
return `N0mbers #${numberOfGamesSinceStart()} - ${isHardMode.value ? 'Advanced' : 'Normal'}
|
||||
return `N0mbers #${numberOfGamesSinceStart()} - ${
|
||||
isHardMode.value ? 'Advanced' : 'Normal'
|
||||
}
|
||||
${lines.join('\n')} ${success ? '✔' : '❌'}
|
||||
https://n0mbers.scambier.xyz`
|
||||
}
|
||||
|
|
|
@ -7,18 +7,10 @@ export const LSK_STATS = 'n0_stats'
|
|||
|
||||
export const operators = ['+', '-', '*', '/'] as const
|
||||
|
||||
export const normalPools = {
|
||||
1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 25, 50],
|
||||
2: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
3: [5, 5, 5, 5, 5, 2, 2, 2, 2, 2],
|
||||
4: [1, 1, 2, 3, 5, 8, 13, 21],
|
||||
} as const
|
||||
|
||||
export const advancedPools = {
|
||||
export const pools = {
|
||||
1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 25, 50, 75, 100],
|
||||
2: [2, 2, 3, 3, 5, 5, 7, 7, 11, 13, 17, 19, 23],
|
||||
3: [5, 5, 5, 5, 5, 2, 2, 2, 2, 2],
|
||||
4: [1, 1, 2, 3, 5, 8, 13, 21],
|
||||
3: [1, 1, 2, 3, 5, 8, 13, 21],
|
||||
} as const
|
||||
|
||||
export enum GameStateType {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
advancedPools
|
||||
<template>
|
||||
<div class="w-full">
|
||||
<!-- Number to find -->
|
||||
|
@ -112,12 +111,7 @@ import {
|
|||
result,
|
||||
} from '@/composables/game-state'
|
||||
import * as sharing from '@/composables/sharing'
|
||||
import {
|
||||
advancedPools,
|
||||
GameDifficultyType,
|
||||
GameStateType,
|
||||
normalPools,
|
||||
} from '@/globals'
|
||||
import { GameDifficultyType, GameStateType, pools } from '@/globals'
|
||||
import { OperatorType, Plaquette } from '@/types'
|
||||
import { randItem, random, randRange, setDailyPRNG, setMathPRNG } from '@/utils'
|
||||
import IconReload from '~icons/ph/arrow-clockwise'
|
||||
|
@ -129,7 +123,7 @@ const { t } = useI18n() // call `useI18n`, and spread `t` from `useI18n` return
|
|||
* Computed & refs
|
||||
*/
|
||||
|
||||
const poolType = ref<1 | 2 | 3 | 4>(1)
|
||||
const poolType = ref<1 | 2 | 3>(1)
|
||||
const cmpPlaquettes = ref<InstanceType<typeof PlaquettesList> | null>(null)
|
||||
|
||||
const isPracticeMode = ref(false)
|
||||
|
@ -199,19 +193,17 @@ function selectOperator(o: OperatorType): void {
|
|||
function reboot(): void {
|
||||
gameState.value = GameStateType.Playing
|
||||
|
||||
// The daily number is >= 500 to have a minimum challenge
|
||||
const minValue = isHardMode.value && !isPracticeMode.value ? 500 : 101
|
||||
const minValue = 101
|
||||
const numPlaquettes = isHardMode.value || isPracticeMode.value ? 6 : 5
|
||||
do {
|
||||
// Find a problem
|
||||
poolType.value = randItem([1, 1, 1, 1, 1, 2, 2, 3, 4, 4])
|
||||
poolType.value = randItem([1, 1, 1, 1, 1, 2, 3])
|
||||
result.value = randRange(minValue, 1000)
|
||||
// Reset Operations list
|
||||
clearOperationsList()
|
||||
|
||||
// Generate result and plaquettes
|
||||
plaquettes.value = []
|
||||
const pools = isHardMode.value ? advancedPools : normalPools
|
||||
const poolCopy = [...pools[poolType.value]]
|
||||
for (let i = 0; i < numPlaquettes; ++i) {
|
||||
const rndItem = Math.floor(random() * poolCopy.length)
|
||||
|
|
Loading…
Reference in New Issue
Block a user