This is a winning line in the game Connect 4 on a 4×5 board. Winning lines can be horizontal, vertical or diagonal.Investigate the number of winning lines in the game Connect 4.The task asks for an investigation of the number of Connect 4 solutions in different sized grids. In Connect 4 the rules are that a winning line is a straight line of four connected counters in either a vertical, horizontal or diagonal line.

To investigate this I must count the total number of possible winning solutions in a grid. The grid does not have too be any particular size however I will begin my investigation by using small grids, therefore the number of solutions will be smaller and easier to count. My results will be recorded in tables to make it easier to spot any patterns or trends.

My aim is to establish formulae’s that will enable me too calculate the total number of winning lines for any given grid size. These are the steps I will take to complete the set task:1. I will draw a range of differently sized grids and count the total amount of possible winning solutions each has on it, this will aid me in creating a formula.

2. After I have gathered all my results I will record them in tables.3.

Using the table I will look for patterns and possible links.4. Using the data I have collected I will attempt to calculate a Connect 4 general formula.5. After I have established this formula I will try to extend the investigation perhaps for a new game of Connect 5.To start the task I decided to find a formula for a basic game of Connect 4.The formula I decided to establish first was the one that will tell me how to work out the number of horizontal winning lines on a small grid. I began by drawing small grids and drawing on the winning lines.

I then recorded the results I calculated into a table (below) and spotted the following pattern -To find the number of winning lines (horizontal only).Height (h)Width (w)No. of winning lines1411521631741ww-3Therefore on a 1 x (w) board, the number of winning lines = w – 3I then decided to alter the height of the grid, instead of constantly keeping it at 1 square I decide to increase it by 1 square on each separate grid. However I still only drew on the winning horizontal lines.

These are my results after I had extended the height of the grid by 1 square instead of keeping it at a constant 1 square.Height (h)Width (w)No. of winning lines2w2x as many3w3x as many4w4x as manyhww x as manyIf Connect 4 were only possibly won by using horizontal lines, the general formula for a (w) x (h) board would be:Winning lines = h (w – 3)To work out the total number of winning vertical lines, I used the same method as I had for the number horizontal winning lines.I again used small sized grids as shown below, however this time the width stayed as 1 square as the height measurement was increased.

This table shows the number of vertical winning lines recorded from the grids on the previous page.Height (h)Width (w)No. of winning lines411512613714h1h-3Therefore on a 1 x (h) board the total number of winning lines=h – 3.I then decided to alter the width of the grid, instead of constantly keeping it at 1 square I decide to increase it by 1 square on each separate grid.

However I still only drew on the winning vertical lines.The table shows the results I tabulated from the grids I decided to alter the size of on the previous page.Height (h)Width (w)no.

of winning linesh22x as manyh33x as manyh44x as manyhwwx as manyIf Connect 4 were only possibly won by using only vertical lines, the general formula for a (w) x (h) board would be:Winning lines = w (h – 3)Now that I have established two separate formulas that tell me the total number of vertical and horizontal winning lines, I will add them together therefore giving me a larger more specific formula that tells me the number of both horizontal and vertical winning lines on a (w) x (h) grid.The addition of the two smaller formulas.= h(w-3) + w(h-3)= wh – 3w + wh – 3h= 2wh – 3h – 3w : FormulaThis larger formula tells me that when w = the width of the board and h = the height of the board, the number of horizontal and vertical winning lines can be calculated.I will assure this by predicting the total number of winning lines on a 5×4 grid for a game of Connect 4, not including any possible winning diagonal lines.w=5h=4= 2wh – 3h – 3w= 2(5×4) – (3×4) – (3×5)= 40 – 12 – 15=13 winning lines in total.My prediction is that on a 5×4-sized grid, there are a total of 13 winning lines excluding the possible 4 diagonal winning lines. The diagram below justifies this being correct.This grid is a 4 x 4 sized grid and it shows the solution for a winning diagonal line.

XXXxTo make the equation slightly easier, I will only count one diagonal line on this board for now, then double it after.I will begin by keeping the width at a constant total of 4 squares to begin with. The lowest value that w could be is 4, as if it were any lower there would be no possible diagonal winning lines.This is a table showing the results I extracted from the grids on the previous page.Height (h)Width (w)No. of winning linesSolutions442154426463h42h-3h-3These would be the results I would gather if I were to increase the width of the board.Height (h)Width (w)No.

of winning linesh52x as manyh63x as manyhw(w-3) (h-3)Therefore, to get the real number of solutions: 2 (w-3) (h-3)If I add together the formula for the horizontal/vertical lines and the new one I have achieved for diagonals (above in bold) I should achieve a formula that will tell me the number of winning lines in all possible 3 directions on any sized board for Connect 4.2 (w-3) (h-3) + h(w-3) + w(h-3)= 2wh – 6w – 6h +18 + wh – 3h +wh – 3w= 4wh – 9w – 9h +18 (Formula for winning lines on any sized board)To test the formula, I will do the same as I did before. I will predict the number of winning lines on a 5×4 board for a game of Connect 4 however this time I will include the possible diagonal winning lines, then use a diagram to prove my theory to be correct.w=5h=4= 4wh – 9w – 9h +18= 4(5×4) – (9×5) – (9×4) + 18= 80 – 45 – 36 +18= 17 winning lines in total.My prediction is that on a 5×4 board, there are 17 winning lines. The diagram proves that this is correct.

This tells me the number of winning lines on any sized board for Connect 4. I will now expand my investigation by repeating my Connect 4 investigation for Connect 5.Connect 5I began by drawing small boards that Connect 5 would be played on and drawing on the possible winning lines.To find the number of winning lines (horizontal only).Height (h)Width (w)No. of winning lines1511621731841ww-4Therefore on a 1 x (w) grid, the number of winning lines = w – 4I extended the height of the board by 1 square on each separate grid however I still only drew on horizontal winning lines.These are my results after I had extended the height of the grid by 1 square on each grid instead of keeping it at a constant 1 square.

Height (h)Width (w)No. of winning lines2w2x as many3w3x as many4w4x as manyhwwx as manyIf Connect 5 were only possibly won by using horizontal lines, the general formula for a (w) x (h) board would be:Winning lines = h (w – 4)To work out the total number of winning vertical lines, I used the same method as I had for the number horizontal winning lines.I again used small sized grids as shown below, however this time the width stayed as 1 square as the height measurement was increased.This table shows the number of vertical winning lines recorded from the grids on the previous page.Height (h)Width (w)No.

of winning lines511612713814H1h-4Therefore on a 1 x (h) board, the number of winning lines = h – 4.I then decided to alter the width of the grid, instead of constantly keeping it at 1 square I decide to increase it by 1 square on each separate grid. However I still only drew on the winning vertical lines.The table shows the results I tabulated from the grids I decide to alter the size of on the previous page.

Height (h)Width (w)No. of winning linesh22x as manyh33x as manyh44x as manyhwwx as manyIf connect 5 were only possibly won by using only vertical lines the general formula for a (w) x (h) board would be:Winning lines = w(h-4)Once again, I added the two formulas for the horizontal and vertical winning lines together:= h(w-4) + w(h-4)= wh – 4w + wh – 4h= 2wh – 4h – 4wTo find the number of winning lines (diagonal)Height (h)Width (w)No. of winning linesSolutions552165427563h52h-4h-4This is a table of results after I increased the width of the board instead of keeping it constantly at 5.Height (h)Width (w)No.

of winning linesh62x as manyh73x as manyhw(w-4) (h-4)Therefore, to get the real number of diagonal winning solutions: 2 (w-4) (h-4)Then I must add all the equations together to get the general formula for all winning lines in any direction on any size grid for a game of Connect 5:2 (w-4) (h-4) + h(w-4) + w(h-4)= 2wh – 8w – 8h +32 + wh – 4h +wh – 4w= 4wh – 12w – 12h +32To test the formula, I will do the same as I did before. I will predict the number of winning lines on a 5×4 board for a game of Connect 5 however this time I will include the possible diagonal winning lines, then use a diagram to prove my theory to be correct.w=6h=5= 4wh – 12w – 12h +32= 4(6×5) – (12×6) – (12×5) + 32= 120 – 72 – 60 + 32= 20 winning lines in total.My prediction is that on a 5×4 board, there are 20 winning lines. The diagram proves that this is correct