Skip to content

Commit

Permalink
Renovação do projeto
Browse files Browse the repository at this point in the history
  • Loading branch information
h3nc4 committed Dec 18, 2023
1 parent 3aaa29d commit 3552869
Show file tree
Hide file tree
Showing 12 changed files with 421 additions and 272 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
velha.exe
*.json
jogo-da-velha.exe
velha
37 changes: 20 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
MIT License
BSD 2-Clause License

Copyright (c) 2022 Henrique Almeida <hcarvalhoalmeida7@gmail.com>
Copyright (c) 2022-2023, Henrique Almeida <me@h3nc4.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 changes: 16 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,38 @@

This is a Tic-Tac-Toe game implementation with an artificial intelligence player written in C using the mini-max algorithm. The game allows a player to play against the AI, where the player always starts first and plays as X.

## Requirements

To run this game, you will need to have a C compiler installed on your computer.

## How to Play

1. Clone the repo:

```bash
git clone https://github.com/henrish0/jogo-da-velha.git
```

2. Navigate to the code:
### Clone the repo

```bash
cd jogo-da-velha/code
```
```bash
git clone https://github.com/henrish0/jogo-da-velha.git
```

3. Compile the code:
### Build the project

```bash
gcc velha.c -o velha
```
```bash
cd jogo-da-velha/
./scripts/build.sh
```

4. Run the game:
Run the game

```bash
velha
```
```bash
./velha
```

Or you can also see releases for the exe file
You can also see **[releases](https://github.com/henrish0/jogo-da-velha/releases)** for the compiled Windows version.

## Game Rules

- The game is played on a 3x3 grid.
- The player always starts first and plays as X.
- The player starts first and plays as X.
- The AI plays as O.
- Players take turns placing their mark on an empty cell in the grid.
- The first player to get three of their marks in a row (horizontally, vertically, or diagonally) wins the game.
- If all cells are filled and no player has won, the game is a tie.
- The starting player alternates between games, so the AI plays next.

## How the AI Works

Expand Down
230 changes: 0 additions & 230 deletions code/velha.c

This file was deleted.

2 changes: 2 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gcc src/* -o ./velha
chmod +x velha
Binary file added scripts/tic-tac-toe.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions scripts/win.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
echo 0 ICON "tic-tac-toe.ico" | windres -O coff -o i.o
gcc ..\src\* i.o -o ../jogo-da-velha.exe
del i.o
Loading

0 comments on commit 3552869

Please sign in to comment.