Creation of the game "Word from Word" / Habr

Good afternoon! I want to present to your attention the project-game Words from the word. Relatively recently, I began to study web programming and, since the best teacher is practice, I decided to write my own …

Creating a game Word from a word

Good afternoon! I want to present to your attention the project-game Words from the word. Relatively recently, I began to study web programming and, since the best teacher is practice, I decided to write my own version of the rather famous game “Word from Word”. The main goal is to use pure JavaScript without connecting additional libraries.

Description of the game

The task of the player is from the letters of the word presented on the screen to make others. The composed word should be a common noun in the singular, diminutive forms, as well as contractions are not taken. The minimum length is 3 letters. For each guessed word, glasses are awarded depending on its length (the base rate for each letter multiplied by the coefficient). The base rate is ten points. The coefficient is calculated as follows:

  • Three letters – 1;
  • from four to five letters – 1.25;
  • from six to seven letters – 1.5;
  • from eight to nine letters – 1.75;
  • More than nine letters – 2.
  • Guess 40 percent. possible words at the level (1,000 points);
  • guess three words starting in the same letter as the word level (500 points);
  • Guess all possible words at the level (50,000 points).

Used techniques and techniques

In the course of work on the application, MVC (Model, View, Controller) approach elements were used. Sound control is also used in separate components, processing the results of the game and general methods for the entire application.

In the process of development, I felt all the advantages of using shorts and immediately caused functions. So, their use saved from constant search for elements on the page by means of Getelementbyid, etc.

Stages of execution of the application

In the process of initialization of the application, all the necessary HTML elements are created, and description objects are formed to simplify access to them.

All information about the passage by the player of the level is saved in the object Game.model.level

In order to somehow maintain progress and not to use server scripts and databases, a method of saving in the Localstorage browser was chosen. In addition, I implemented a “record table” for players who use this application in the same browser

Thus, I present my project for discussions. I will be glad to listen to constructive criticism and suggestions both in the comments and in personal communication. If you are interested in the details, I will gladly talk about the writing process in more detail.

Related Posts