Skip to content

Latest commit

 

History

History
118 lines (89 loc) · 3.8 KB

README.md

File metadata and controls

118 lines (89 loc) · 3.8 KB

  Command-line Game

This project is a command-line game collection that includes different types of games such as math games, bomb defusing games, and flag-guessing games. The project is written in Swift and utilizes various programming concepts and skills, including Protocol-Oriented Programming (POP), Project organization and file structure (Clean Architecture), String manipulation using Result Builder and Extension and et cetera. The project also incorporates colorful and styled text output in the terminal to enhance the user experience (Terminal styling using ANSI escape codes).

Introduction Demo.

Table of Contents

Project Diagram

.
├── CommandLineGame
│   ├── App
│   │   ├── Controller
│   │   │   └── GameController.swift
│   │   └── View
│   │       ├── MessageView.swift
│   │       └── ResultBuilder
│   │           └── PrintExpensiveString.swift
│   ├── Core
│   │   ├── Entity
│   │   │   ├── BombGame.swift
│   │   │   ├── FlagGame.swift
│   │   │   ├── Game.swift
│   │   │   └── MathGame.swift
│   │   ├── Extention
│   │   │   └── StringColorsAndStyles.swift
│   │   └── ValueObjects
│   │       └── GameColor.swift
│   └── main.swift
│ 
├── CommandLineGame.xcodeproj
│ 
├── Documentation
│   ├── bombGame.mov
│   ├── flagGame.mov
│   ├── intro.mov
│   ├── mathGame.mov
│   └── usage.mov
│ 
├── LICENSE
│ 
└── README.md

Games Lists

The following games are currently included:

MathGame Demo.

BombGame Demo.

FlagGame Demo.

Each game has its own set of rules and gameplay mechanics. See the documentation in each respective file for more information.

Note

You can change the content of celebrateVictory() function from Game Controller to customize secret box's content. 🎁

Installation

To install this project, simply clone the repository to your local machine:

git clone https://github.com/mehdi2003karami/CommandLineGame.git

Usage

To run the game via Xcode simply build and run it.

  • Note: Make Sure that Terminal scheme is chosen.

To run the game via Terminal, navigate to the inner CommandLineGame directory and run the main.swift file for the game you wish to play:

swiftc \
main.swift \
App/Controller/GameController.swift \
App/View/MessageView.swift \
App/View/ResultBuilder/PrintExpensiveString.swift \
Core/Entity/BombGame.swift \
Core/Entity/FlagGame.swift \
Core/Entity/Game.swift \
Core/Entity/MathGame.swift \
Core/Extention/StringColorsAndStyles.swift \
Core/ValueObjects/GameColor.swift

Then enter the below command to execute compiled file.

./main

Usage Demo.

Contributors

Feel free to share your ideas or any other problems. Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

License

CommandLine Game is released under an MIT license. See LICENSE for more information.