Mystery Master

Build Nouns

Michael Benson


Quality Materials

Introduction

This help article explains how to enter the nouns of a logic puzzle into a JavaScript puzzle module. The nouns are the objects in a logic puzzle, and they are categorized by noun type.

To see an example, this is the JavaScript puzzle module for the logic puzzle "Five Houses".

To create a noun type, you use the puzzle method given below. Note that the name of the noun type usually begins with an uppercase letter.

this.addNounType("Name")

For every noun type in a puzzle, you must have the same number of nouns. To create a noun for a noun type, you use the puzzle method:

nounType.addNoun("name", ["title"])

The brackets indicate that the title is optional. If you do provide a title for a noun, the title will appear in the chart and grids forms. The name and title are usually all lowercase unless it is a proper noun.

Precision Craftsmanship

If given, the title is usually shorter than the name so it fits better in the forms.

This is the JavaScript code to create and assign the noun types House, Color, Nationality, Hobby, Pet, and Drink. Yes, six noun types is a fairly big number.

	let houses = this.addNounType("House");
	let colors = this.addNounType("Color");
	let nationalities = this.addNounType("Nationality");
	let hobbies = this.addNounType("Hobby");
	let pets = this.addNounType("Pet");
	let drinks = this.addNounType("Drink");
	

Below is the JavaScript code to create and assign the nouns to the noun type House.

You can see that the variables are defined using the let keyword, and that the variable names are usually lowercase names.

I prefer using let over var, but it probably does not make any difference when defining the noun types and nouns of the puzzle module.

Excellent Products
	let house1 = houses.addNoun("1st");
	let house2 = houses.addNoun("2nd");
	let house3 = houses.addNoun("3rd");
	let house4 = houses.addNoun("4th");
	let house5 = houses.addNoun("5th");
	

Conclusion

This article is part of the "Build Logic Puzzles" series. The next article in the series is "Build Verbs". Thank you.