In this last lesson, we will learn how to attack a project more ambitious than those we considered up until now. That is, how to decompose this project into easily-solved sub-problems until we know how to write the final program. To illustrate this, we have chosen a game of connect 4. You no doubt know the rules of connect 4. It is a two-player game with a grid of seven columns and 6 rows. The players drop a chip of their own color one after another in the column they choose, until one player manages to line up four chips of his color or until the grid is completely filled. First, please note that we are not going to develop a pretty graphical interface. What we are interested in here is having a program which can follow the mechanics of the game, and we will make do with a text-based display of the grid and chips, that is, something that would look like this. Generally, how should you approach such large problem as this one? You should definitely not try to write the program all at once, you won't manage that. You should know how to break down the problem into sub-problems to write the program step-by-step. And at each step, you must test the code that you have written in order to continue on solid bases. First of all, we must identify what types our program needs to work, what data our program needs. In our example, it essentially needs to be able to represent the grid. Then, we will have to identify the methods that will work on these types and test them as we code them. Then, when a method is hard to write, we can introduce an extra method for each of the difficult steps. I said that we should start by identifying the types. What does this mean? We will start by identifying the data which our program needs and finding how to represent these data. In this case, for our game of connect 4, the main data are the grid and the chips it contains or more precisely, we want to know, for each cell, what the cell contains. Is it a red chip, a yellow chip, or nothing at all? The simplest and surely the most practical way of representing the grid in our Java program is to use a two-dimensional array where each element of the two-dimensional array corresponds to a cell of the grid. We shall decree that the first index of the array corresponds to the line number, where line 0 corresponds to the line at the top of the grid and that the second index corresponds to the column number. And here again, we must decide on a convention and we shall say that the left-most column will be column 0. We still have to choose the type of the array's elements, which corresponds to cells in the grid. We will choose an <i>int</i> type here, and define constants of type <i>int</i>. The three constants will be named <i>VIDE</i>, <i>JAUNE</i> and <i>ROUGE</i> (TN: <i>EMPTY</i>, <i>YELLOW</i> and <i>RED</i>). All three will be initialized with different values which will allow us to use these three constants to gives values to the chips or cells of our grid. There are other ways of doing this, using for example enumerated types, but we will not talk about these in this video. Updating the grid will then be done in the following way: for example, this instruction will give the value VIDE (TN: EMPTY), that is, 0, in the element of the grid array which is on line 0 and column 0, which corresponds, if we respect the conventions we described a few slides earlier, to this cell right here, in which we will put the value <i>VIDE</i> (= 0). With this instruction, we will assign to cell 2, since we start with the top-most cell which has the index 0. We change the element of this line 2 which has an index of 3. So, 0, 1, 2, 3. This one. We assign the value JAUNE (TN: "YELLOW") which equals 1. But I could easily have represented this assignment in this way to show that it corresponds to a cell of my grid that should be marked as yellow. In the next video, we will learn how to write the functions which will allow us to initialize and display the grid.