Skip to content

Commit

Permalink
Project push to git
Browse files Browse the repository at this point in the history
  • Loading branch information
SeiyaGame committed May 21, 2024
0 parents commit 1dbe11b
Show file tree
Hide file tree
Showing 12 changed files with 729 additions and 0 deletions.
118 changes: 118 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Created by https://www.toptal.com/developers/gitignore/api/qtcreator,qt,c++
# Edit at https://www.toptal.com/developers/gitignore?templates=qtcreator,qt,c++

### C++ ###
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

### Qt ###
# C++ objects and libs
*.so.*

# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl

# Qt unit tests
target_wrapper.*

# QtCreator
*.autosave

# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*

# QtCreator CMake
CMakeLists.txt.user*

# QtCreator 4.8< compilation database
compile_commands.json

# QtCreator local machine specific files for imported projects
*creator.user*

*_qmlcache.qrc

### QtCreator ###
# gitignore for Qt Creator like IDE for pure C/C++ project without Qt
#
# Reference: http://doc.qt.io/qtcreator/creator-project-generic.html



# Qt Creator autogenerated files


# A listing of all the files included in the project
*.files

# Include directories
*.includes

# Project configuration settings like predefined Macros
*.config

# Qt Creator settings
*.creator

# User project settings
*.creator.user*

# Qt Creator backups

# Flags for Clang Code Model
*.cxxflags
*.cflags

# End of https://www.toptal.com/developers/gitignore/api/qtcreator,qt,c++

build
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Puissance 4

Made with [Guetom](https://github.com/Guetom)
This is a reupload of the project I did at school

## Introduction

Puissance 4 is a graphical implementation of the classic Connect 4 game using the Qt framework.
This project features a simple user interface where players can compete against a bot.
The game supports basic functionalities including grid initialization, player and bot moves, and win condition checking.

## Features

- Graphical grid display with dynamic QLabel elements.
- Interactive buttons for player moves.
- Bot that makes random moves.
- Win condition checks for rows, columns, and diagonals.
- End game messages for both player and bot victories.

## Prerequisites

- Qt 5.x or higher
- C++11 or higher

## Project Structure

- `puissancequatre.h` and `puissancequatre.cpp`: Main game logic and UI setup.
- `ui_puissancequatre.h`: UI definitions generated by Qt Designer.
- `lunchpuissancequatre.h` and `lunchpuissancequatre.cpp`: Launcher class for starting the game.
- `qpushbuttoncustom.h` and `qpushbuttoncustom.cpp`: Custom QPushButton class for handling button clicks.

## How to Build and Run

### 1. Clone the repository

```bash
git clone https://github.com/yourusername/puissancequatre.git
cd puissancequatre
```

### 2. Open the project in Qt Creator

- Open Qt Creator
- Go to File -> Open File or Project...
- Select the `puissancequatre.pro` file

### 3. Build the project

Click on the Build button or press Ctrl+B.

### 4. Run the project

Click on the Run button or press Ctrl+R.

## Game Instructions

### 1. Start the game

Click on the Play button in the launcher.

### 2. Make a move

Click on one of the buttons at the top of the grid to drop your piece in the corresponding column.

### 3. Bot move

The bot will automatically make a move after the player.

## Win the game

The game checks for four consecutive pieces in a row, column, or diagonal.
A message will display the winner and the game will disable further moves
12 changes: 12 additions & 0 deletions lunchpuissancequatre.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "lunchpuissancequatre.h"

// Lancer le jeu via le luncheur.
void LunchPuissanceQuatre::play()
{
this->puissanceQuatre = new PuissanceQuatre();
this->puissanceQuatre->show();
}

LunchPuissanceQuatre::LunchPuissanceQuatre()
{
}
21 changes: 21 additions & 0 deletions lunchpuissancequatre.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef LUNCHPUISSANCEQUATRE_H
#define LUNCHPUISSANCEQUATRE_H

#include "puissancequatre.h"
#include <QObject>

class LunchPuissanceQuatre : public QObject
{
Q_OBJECT

public:
LunchPuissanceQuatre();

private slots:
void play();

private:
PuissanceQuatre *puissanceQuatre;
};

#endif // LUNCHPUISSANCEQUATRE_H
11 changes: 11 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "puissancequatre.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
PuissanceQuatre w;
w.show();

return a.exec();
}
14 changes: 14 additions & 0 deletions puissance-4.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
INCLUDEPATH += $$PWD

SOURCES += \
$$PWD/puissancequatre.cpp \
$$PWD/qpushbuttoncustom.cpp \
$$PWD/lunchpuissancequatre.cpp

HEADERS += \
$$PWD/puissancequatre.h \
$$PWD/qpushbuttoncustom.h \
$$PWD/lunchpuissancequatre.h

FORMS += \
$$PWD/puissancequatre.ui
32 changes: 32 additions & 0 deletions puissance-4.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#-------------------------------------------------
#
# Project created by QtCreator 2021-12-22T09:11:44
#
#-------------------------------------------------

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = puissance-4
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0


include(puissance-4.pri)
SOURCES += \
main.cpp

#HEADERS += \

#FORMS += \
Loading

0 comments on commit 1dbe11b

Please sign in to comment.