S
S
Sergey Demin2018-06-29 20:33:20
JavaScript
Sergey Demin, 2018-06-29 20:33:20

How to write a 4 in a row game in Java Script?

Rebzya! Help! I've been sitting all day and can't figure out how to implement a self-learning task in JavaScript.
Here is the task: You
need a javascript game "4 in a row" https://www.youtube.com/watch?v=rYAbUVIfA3s
The playing field is 7 columns in 6 cells high. Players take turns choosing a row, in the lower free cell of which a chip of the color of the current player will appear.
That is, when the page loads, the playing field and information about the current player should appear. After clicking on a column, the chip of the current player should appear in the lower free cell of this column, and the player should change. Then the next player's turn, and so on.
Optionally, you can implement the definition of the winner, and the definition of filling the entire field (draw).
If the column is full, then you cannot move into it.
ps: I understand the logic of writing a program. First, we need to catch the Onclick event on the block with the game, then determine the player whose turn it is, then understand which column the player has chosen, then after clicking on this column, we need to make the cell unfilled below the color of the chip, and then actually arrange a check if verticals or horizontals or diagonals have the same color field then add points to the player. Guys help, otherwise I won’t fall asleep today. Here is the layout and my start on js :
https://codepen.io/anon/pen/GGPGOx

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor L, 2018-06-30
@Fzero0

Well, so?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question