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
7 votes
2 answers
155 views

simple connect four game

I made a simple connect four terminal game in C and was wondering if I could get feedback on it. I mainly want to know where pointers could have optimised my code, and if there are any major ...
Willem's user avatar
  • 71
3 votes
0 answers
278 views

minimax algorithm optimization for connect 4

I made a minimax algorithm for a connect 4 and I would like to optimize it to improve the calculation time. I have already done the classic optimization such as alpha beta pruning and a variable where ...
Hyrhoo's user avatar
  • 31
3 votes
1 answer
163 views

Connect4 game with "Minimax-AI" and raylib

I am just trying to understand the minimax algorithm better and how it works, so I made this basic connect4 game with raylib. It works fine, but I think there must be some kind of flaw in the logic, ...
Maxell 's user avatar
2 votes
1 answer
186 views

C++ Connect 4 in SFML

After a substantial amount of programming experience in high level languages like Javascript and Python, I decided to try learning a low level language for once, so I did C++. As my first project I ...
Kotetsu Chan's user avatar
2 votes
1 answer
87 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 ...
user259137's user avatar
1 vote
1 answer
137 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 ...
Gabriel's user avatar
  • 1,053
8 votes
2 answers
2k 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 ...
Andreas Friberg's user avatar
2 votes
0 answers
112 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-...
Ibrahim Bholat's user avatar
2 votes
2 answers
485 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 ...
Hannah K's user avatar
3 votes
3 answers
2k 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? ...
Alexander Müller's user avatar
5 votes
2 answers
241 views

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

Here is the improved code ...
Ahmed Elsayed's user avatar
6 votes
2 answers
530 views

Improving C++ Connect-four game with little AI

Here is the code for the game : ...
Ahmed Elsayed's user avatar
1 vote
1 answer
676 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. ...
PARTH's user avatar
  • 145
4 votes
1 answer
4k 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 ...
Ashkanxy's user avatar
  • 141
0 votes
2 answers
100 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 ...
mastmartelli's user avatar
4 votes
1 answer
646 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: ...
Ryan Stone's user avatar
3 votes
0 answers
105 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 ...
coder1532's user avatar
  • 177
1 vote
1 answer
3k 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 ...
HelpMePlease's user avatar
4 votes
1 answer
10k 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
2k 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 <...
Dalibor Trampota's user avatar
2 votes
1 answer
320 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. ...
coderodde's user avatar
  • 27k
4 votes
1 answer
116 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 ...
jakstack's user avatar
  • 143
6 votes
1 answer
2k 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: ...
Marten's user avatar
  • 585
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
2k 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
11k 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 ...
dgr27's user avatar
  • 81
3 votes
1 answer
302 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). ...
T. Malm's user avatar
  • 51
2 votes
2 answers
238 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 ...
glera's user avatar
  • 21
7 votes
1 answer
5k views

Simple Game Connect Four in Python 3

Please Review and share suggestion : https://github.com/prosenjitj/ConnectFour Code: ...
PROSENJIT DAS's user avatar
13 votes
1 answer
696 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 ...
Tweakimp's user avatar
  • 769
7 votes
2 answers
22k 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 ...
included's 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: ...
W. MacTurk's 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 ...
Luke's user avatar
  • 501
0 votes
1 answer
2k 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 ...
Ibrahim Ali's user avatar
3 votes
2 answers
441 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 ...
Rocket Pingu's user avatar
1 vote
1 answer
896 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. ...
Emank's user avatar
  • 13
4 votes
2 answers
133 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 ...
Beny Benz's 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....
Tweakimp's 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? ...
NewToJavaPleaseHelp's user avatar
2 votes
2 answers
191 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 ...
Kay's user avatar
  • 29
5 votes
1 answer
205 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. ...
Teodor Dyakov's user avatar
5 votes
2 answers
7k 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 ...
Micheal C.'s user avatar
9 votes
1 answer
19k 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 ...
Aleksandr Hovhannisyan's user avatar
5 votes
2 answers
4k 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 ...
Timothy Truckle's 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 ...
HeadOfJarg's user avatar
7 votes
4 answers
30k 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 ...
bubblez go pop's user avatar
10 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 ...
bubblez go pop's 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 <...
coderodde's user avatar
  • 27k
6 votes
1 answer
849 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:...
Smarticles101's user avatar
5 votes
1 answer
21k 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 ...
Smarticles101's user avatar