Questions tagged [connect-four]

A game in which two players take turns dropping chips into a vertical grid until one player forms a line of four chips horizontally, vertically, or diagonally.

Filter by
Sorted by
Tagged with
2 votes
1 answer
52 views

Connect4 game multiplayer

I made a connect4 game in c++ please tell my how I can make the code better, thanks. I already asked some people and they told me i should be using fixed witdh ints and [[nodiscard]] on functions that ...
user avatar
1 vote
1 answer
73 views

Connect Four in C++

This is a library that implements the logic of Connect Four. There's nothing related to graphics or user input here. This library is supposed to be integrated into any environment where one could run ...
user avatar
  • 993
7 votes
2 answers
789 views

Four-in-a-Row game

I've made a working Four-in-a-Row game with grid lists and winning system. Both vertically and diagonally, is there some clear improvements to be made or common mistakes which could perhaps shorten it ...
user avatar
2 votes
0 answers
58 views

Connect 4 project for three players with PyGame graphics

I am currently working on a Connect 4 game for a project and it works. We added support so that it can be played by 3 players instead of 2. I know there is multiple instances of repeated code or un-...
user avatar
2 votes
2 answers
184 views

Print a Connect 4 board

I am required to code (as part of a 3-question assignment) a variable-size connect 4 board with a standard size of 6x7, with a minimum size of 2x2 and a maximum of 20x20. The professor said that he ...
user avatar
  • 21
3 votes
3 answers
383 views

Terminal based "Connect 4" game in Python

I started learning Python a few weeks ago and coded this "Connect 4" game. What could I have done better? How efficient is this code and how could I improve on that? ...
user avatar
5 votes
2 answers
149 views

C++ Connect-four game with little AI (Version two)

Here is the improved code ...
user avatar
6 votes
2 answers
399 views

Improving C++ Connect-four game with little AI

Here is the code for the game : ...
user avatar
0 votes
0 answers
294 views

C# Console, Connect 4 Game

this is my second post here, and the second project I made. I wanted to know, how to improve my code of connect-4 made in c# for console. ...
user avatar
  • 125
5 votes
1 answer
3k views

Connect 4 Game Design in C++

I am working on designing a simple version of a Connect 4 game. Here is my first draft code. I would like some feedback on it, and also required modification for these follow up questions: Add some ...
user avatar
  • 151
0 votes
2 answers
76 views

Connect Four Shared Keyboard Game

I wrote a connect four game for two players, where each player uses the same keyboard. I programmed this solely in hopes of improving my skills. I'm open to and looking for any sort of feedback. Do ...
user avatar
4 votes
1 answer
345 views

Custom Connect Four game on CodePen using JavaScript

Can this code be shortened, optimized or remove any unnecessary parts. Just curious if this is the right way to achieve the given result in this CodePen example: CodePen Connect Four Here is my code: ...
user avatar
3 votes
0 answers
87 views

A game implementation in Python

I have the following Connect 4 implementation. Is there a way to refactor it and maybe make it better. It's a fully working solution. However, I see that the correct result is not returned in certain ...
user avatar
  • 177
1 vote
1 answer
2k views

Simple Connect Four Game With GUI added

I am trying to improve my coding skills in Java by taking existing code, studying it, and adding on to it. In this code example, I took code from Connect Four game in Java and edited it. The most ...
user avatar
4 votes
1 answer
7k views

A Simple Connect 4 game in Python

I have made a simple command line version of connect 4. It is my first time using classes and importing one part of my project into another so any feedback on how I've done and any way it could be ...
user avatar
0 votes
1 answer
1k views

Simple "Connect 4" game

I made this easy game to improve my C++. The functions like NoFlicker and ShowCursor are copied from the Internet, but I made <...
user avatar
2 votes
1 answer
273 views

A Connect Four evaluation function in Java is not smart enough [closed]

I have a couple of projects: GameAI ConnectFour GameAI implements a couple of algorithms: Minimax, Alpha-beta pruning and Alpha-beta pruning with state ordering. ...
user avatar
  • 25.6k
4 votes
1 answer
92 views

Print a Connect 4 grid based on some rules for each cell

In a game of Connect4: we start with an empty grid two players place pieces X and O on the grid the first player to achieve 4 pieces in a line wins! this is a text based console game Here is the ...
user avatar
  • 143
6 votes
1 answer
1k views

JavaFX Connect Four AI

I made a Connect Four AI with minimax algorithm. It's my first bigger JavaFX project. Any help for improvements would be really appreciated. Board: ...
user avatar
  • 575
2 votes
1 answer
3k views

Connect 4 on a 4×4 board in Python

I'm having some trouble improving the Connect 4 game that is made in Python. I was wondering if I could get rid of the global statements and pass the variables ...
user avatar
2 votes
1 answer
1k views

Text-based Connect 4 Game

I have made Connect 4 in C#. If you have never played Connect 4, it is like Tic Tac Toe, except the pieces fall to the bottom of the grid, and the grid is usually 6x7. This is the first big project I ...
user avatar
3 votes
1 answer
8k views

Basic Connect Four game

Here is a simple text-based version of connect four I made. I have been building this in an attempt to improve my Java skills (and possibly mention on my resume). My goals with this project are as ...
user avatar
  • 81
3 votes
1 answer
264 views

Connect Four variant, allowing only horizontal and vertical wins

I'm brand new in JavaScript (and in programming in general). I've made a Connect Four game that checks for the winner vertically and horizontally (I haven't figured out how to solved it diagonally). ...
user avatar
  • 51
2 votes
2 answers
208 views

Checking for win on a wrap-around Connect 6 board

I have a method, that checks win conditions on a "Torus" board, which is a board without any borders. This means that if you place 4 diagonal stones on the top left, and 2 diagonal stones in the ...
user avatar
6 votes
1 answer
5k views

Simple Game Connect Four in Python 3

Please Review and share suggestion : https://github.com/prosenjitj/ConnectFour Code: ...
user avatar
12 votes
1 answer
622 views

Connect4 variant in Python

I built a variant of connect4 in Python. The game runs just in the command line. It is on a 7×7 board and the players take turns putting tokens in a column (the token falls down) OR turn the board by ...
user avatar
  • 769
7 votes
2 answers
18k views

Connect 4 in C++

I just wrote a very simple game - "Connect 4". It's working -- at least I think so -- but I wanted to ask for some advice for the future and find out what can be done better. I'm really new to ...
user avatar
  • 125
3 votes
1 answer
3k views

Make a smart move in a connect-4 program

An assignment this past semester was to write functions such that the following C program would run: ...
user avatar
9 votes
3 answers
3k views

Stock Monte Carlo Tree Search implementation to a simple connect 5 game in Python

Requires Python version: 3.6+ fstrings included! External link: https://github.com/thejhonnyguy/Python-Stock-MCTS (Questions below) Main program: mcts.py ...
user avatar
  • 501
0 votes
1 answer
1k views

Connect Four best way to get diagonals

I've checked many classes that implement the major diagonal cases but I didn't find efficient one. I tried to implement major diagonal on the path that I used with rows and columns but it's not ...
user avatar
3 votes
2 answers
421 views

A TDD Exercise on ConnectFour

I'm practicing my TTD skills and trying to apply best practices in Java. I finished (passing all the test cases) the Connect Four kata in the Agile Katas and I would like to know if there is a way to ...
user avatar
1 vote
1 answer
852 views

9×9 Connect 4 for 2 players

As a high school assignment, I was asked to make a Connect 4 game in Java. I have created a 9×9 2-D array that two players can play. I'd appreciate any feedback or suggestions. ...
user avatar
  • 13
4 votes
2 answers
117 views

Counting the maximum number of four-in-a-row wins

It all started during a "fourInARow" game... A friend of mine asked: "If you drop in all 42 stones, what will the number of "four in a row"s be with the optimal configuration?" I thought it should be ...
user avatar
4 votes
3 answers
2k views

Check for wins in a Connect4 variant

Me and my friend are trying to build a Connect4 game with a twist. The twist requires us to have a 7*7 board and to be always able to check all possibilities for a win for both players after each move....
user avatar
  • 769
5 votes
1 answer
3k views

Connect Four class project

I am in a computer coding class and we have to make a project for Java. Is there any way we can better our existing connect four code? ...
user avatar
2 votes
2 answers
150 views

Library to play and create AI for "Connect Four"

I am looking for some advice to this code I made, which enables a fellow programmer to create his own AI for Connect Four whilst not really having to code the game itself. Match class ...
user avatar
  • 29
5 votes
1 answer
188 views

Connect Four game without diagonals check or validation

This is a simple implementation of Connect four in Java. It is working correctly so far. What I haven't done yet are the diagonals check and input validation. ...
user avatar
5 votes
2 answers
6k views

Connect Four game with minimax AI

I have created a connect four game between a bot and a player. It was quite a bit of a challenge since I wasn't too fond of the minmax algorithm until now. I know there's always room for improvement ...
user avatar
8 votes
1 answer
16k views

"Connect four" code to check for horizontals, verticals, and diagonals

My textbook (David Liang's Introduction to Java Programming) asks me to write a program which prompts a user to specify the number of rows and columns in a matrix prompts the user to enter each ...
user avatar
5 votes
2 answers
3k views

Connect Four (the OO approach)

I saw some approaches to the Connect Four game on a site. None of them seemed very OO like, therefore I'd like to present my implementation and request suggestions on how to make this code more ...
user avatar
6 votes
1 answer
7k views

Connect Four in Java

I wrote this program as an assignment for an introductory programming course in Java, which I then decided to improve past the minimum assignment requirements. It allows two human players to play ...
user avatar
6 votes
4 answers
29k views

Creating a grid to the specified size using lists

My code creates a "grid" of empty places, where 0 is used as the place holder, in a size specified by the user. I was wondering if there were more efficient ways of doing this,or perhaps ways that ...
user avatar
9 votes
1 answer
28k views

Python Connect-Four

I am currently using Python 3.5.2 to create a connect four basic game. My game should work for two players and tell you when you have won, be it horizontal vertical or diagonal. However I do not know ...
user avatar
3 votes
1 answer
3k views

Connect Four in Java for two human players

Connect Four kinda caught my eye, and I decided to start from the very basics. Here I have bare-bones implementation for playing the game between two human players on the command line: Board.java <...
user avatar
  • 25.6k
6 votes
1 answer
801 views

Connect Four applet

I am making a Connect Four type of game in Java. I want to make sure that all the code seems nice before I decide to add more. This is what the applet game looks like: Player input: Victory screen:...
user avatar
5 votes
1 answer
19k views

Java Connect Four "Four in a row" detection algorithms

I am making a connect four type game for my end of the year project in my programming class. I am about to start building off of the console based version I have made and add a GUI, but I feel sort ...
user avatar
4 votes
1 answer
1k views

Checking winning conditions in a Connect Four game

I'm trying to refactor this C# code that uses one true brace style (it's enforced). I'm coming to C# from C++, in the former I could've made x and ...
user avatar
  • 143
4 votes
2 answers
5k views

Connect Four in Python

I've made a working version of Connect Four in Python. I'm pretty new to Python so it's decently primitive. Please take a look and let me know what you think! ...
user avatar
  • 141
2 votes
1 answer
3k views

Connect4 With AI

I have made a connect 4 console application in C++ and would love some feedback. In this project I have learned about inheritance and using virtual functions. Main.cpp ...
user avatar
9 votes
1 answer
1k views

Pygame version of my 3D Tic Tac Toe/Connect 4

I posted a question a while back asking for some feedback on the code of a game I made (it was limited to typing the input and drawing the output in ASCII). Now I've got it linked up with pygamef. ...
user avatar
  • 1,105