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
0
votes
1answer
72 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 <...
2
votes
1answer
60 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. ...
4
votes
1answer
47 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 ...
5
votes
1answer
80 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: ...
0
votes
0answers
107 views

Basic Connect Four Game [Follow Up 1]

Here is an updated version of a basic connect four game I had posted previously. Changes include: an overhauled validator, simplifying the process by knowing where the last move was made Utilized an ...
2
votes
1answer
881 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 ...
2
votes
1answer
243 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 ...
2
votes
1answer
2k 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 ...
3
votes
1answer
110 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). ...
2
votes
2answers
142 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 ...
6
votes
1answer
2k views

Simple Game Connect Four in Python 3

Please Review and share suggestion : https://github.com/prosenjitj/ConnectFour Code: ...
12
votes
1answer
391 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 ...
7
votes
2answers
6k 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 ...
3
votes
1answer
880 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: ...
9
votes
3answers
2k 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 ...
0
votes
1answer
675 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 ...
3
votes
2answers
332 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 ...
1
vote
1answer
378 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. ...
4
votes
2answers
103 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 ...
4
votes
3answers
826 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....
5
votes
1answer
2k 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? ...
2
votes
2answers
133 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 ...
5
votes
1answer
128 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. ...
5
votes
2answers
4k 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 ...
7
votes
1answer
5k 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 ...
5
votes
2answers
1k 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 ...
6
votes
1answer
5k 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 ...
5
votes
4answers
15k 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 ...
8
votes
1answer
15k 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 ...
3
votes
1answer
2k 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 <...
6
votes
1answer
635 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:...
4
votes
1answer
10k 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 ...
4
votes
1answer
979 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 ...
5
votes
2answers
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! ...
2
votes
1answer
2k 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 ...
8
votes
1answer
777 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. ...
4
votes
2answers
53k views

Connect Four game in Java

I was wondering if you guys could point out any mistakes I've made in this program, and how to improve the code. It's a simple console-based Connect Four game. You use 0-5 to place your piece in the ...
10
votes
2answers
7k views

Connect 4 (glorified tic-tac-toe) implementation

I'm posting here my implementation of the game Connect 4. It's obviously a pretty trivial game and code but I'm primarily interested in any advice concerning improvements to the code structure: types, ...
4
votes
3answers
3k views

Evaluation function for Connect Four

Here is some code I have written as a connect four negamax evaluation function. The state of the board is stored inside a class state. ...
3
votes
1answer
926 views

Improving AI for a Connect 3 game

I am attempting to complete an assignment, which is basically Connect 3, instead of the classic Connect 4 game. The AI I am using is the exact same as the opponent, but the opponent wins more because ...
4
votes
2answers
4k views

Connect 4 game for AI agents

This Connect 4 game will be used for implementing game-playing AI. Sample players are supplied. One takes user input, and the other plays randomly. Right now it's set for a human player to play ...
4
votes
1answer
811 views

Winning Loop Connect 4

I am writing a fully functional single player Connect 4 game. I am working on the second player and the while loop that tells the player who won. GUI ...
11
votes
3answers
7k views

Find longest sequence horizontally, vertically or diagonally in Connect Four game

I'm new to programming and also to Java and working on problems in Intro to Java by Robert Sedgewick. Here is my question: Connect Four: Given an N-by-N grid with each cell either occupied by an ...
4
votes
2answers
26k views

Connect Four game

I wrote this a couple months ago and just wanted to get some feedback on it. In the printBoard() function, you see I commented out the system function. I've read ...