Reference Source
public class | source

Wheel

A WOJ wheel for a specific board and maximum spins. The number of slots on the wheel will be the number of categories + the number of special sectors (6). Slots are fixed on the wheel. Each special and category is a sector. Each sector can be randomly assigned to a slot on the wheel. Categories are always populated in the sector list first, followed by special sectors, i.e. category 0 on the board is always sector 0 on the wheel.

Constructor Summary

Public Constructor
public

constructor(board: Board, maxSpins: number)

Member Summary

Public Members
public get
public get
public
public
public

Method Summary

Public Methods
public

Assigns sectors numbers to each slot ordered by categories then special.

public

Return a random slot number from the wheel.

public

getSectorName(sectorNumber: number): number

Get sector name for the specific sector number.

public

Get sector number at a specific slot number.

public

Randomizes sectors in the slots.

public

reset()

Resets used spins to 0.

public

sectorIsCategory(sectorNumber: number): boolean

Check if the sector is a category (vs a special sector).

public

spin(): Spin

Spins the wheel and returns a random sector.

Public Constructors

public constructor(board: Board, maxSpins: number) source

Params:

NameTypeAttributeDescription
board Board

an initialized WOJ board.

maxSpins number
  • optional
  • default: 50

the max spins allowed.

Public Members

public get complete: boolean source

public get sectors: string[] source

public slots: number source

public specialSectors: string[] source

public usedSpins: number source

Public Methods

public assignSectors() source

Assigns sectors numbers to each slot ordered by categories then special.

public getRandomSlot(): number source

Return a random slot number from the wheel.

Return:

number

a random slot number.

public getSectorName(sectorNumber: number): number source

Get sector name for the specific sector number.

Params:

NameTypeAttributeDescription
sectorNumber number

sector number.

Return:

number

sector name for the sector number.

public getSectorNumber(slot: number): number source

Get sector number at a specific slot number.

Params:

NameTypeAttributeDescription
slot number

slot number in the wheel.

Return:

number

sector number at the specified slot.

public randomizeSectors() source

Randomizes sectors in the slots.

public reset() source

Resets used spins to 0.

public sectorIsCategory(sectorNumber: number): boolean source

Check if the sector is a category (vs a special sector).

Params:

NameTypeAttributeDescription
sectorNumber number

number of the sector.

Return:

boolean

true if the sector is a category.

public spin(): Spin source

Spins the wheel and returns a random sector. Populates the Spin object with the spin results. If the result is a category, a clue will be retrieved. If all clues are used, the spin again field will be true.

Return:

Spin

object summarizing result of the spin.