https://github.com/rmssanali/shotgungame
A Windows Forms (C# .NET) school project – Shotgun Game from the course Objektorienterad programmering med C# .NET.
https://github.com/rmssanali/shotgungame
csharp game objectorientedprogramming schoolproject shotgungame winforms
Last synced: 9 months ago
JSON representation
A Windows Forms (C# .NET) school project – Shotgun Game from the course Objektorienterad programmering med C# .NET.
- Host: GitHub
- URL: https://github.com/rmssanali/shotgungame
- Owner: RMSSanali
- Created: 2025-08-19T18:09:58.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-08-19T19:44:14.000Z (10 months ago)
- Last Synced: 2025-08-31T17:13:00.934Z (10 months ago)
- Topics: csharp, game, objectorientedprogramming, schoolproject, shotgungame, winforms
- Language: C#
- Homepage:
- Size: 5.84 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Shotgun – Windows Forms Game 🎯
This repository contains my implementation of the **Shotgun** game as part of *Inlämningsuppgift 2* in the course **Objektorienterad programmering med C# .NET**.
The player competes against the computer using actions **Shoot**, **Load**, **Block**, and the special **Shotgun** move.
---
## Table of Contents
- Extended Description
- Assignment Scope
- Game Rules
- How to Run Locally
- Implementation Notes (OOP)
- Screenshots / Demo
- Project Documentation
- Author
- Assignment Status
---
## Extended Description
This project was created during the course *Objektorienterad programmering med C# .NET*.
The task was to build a playable **Windows Forms (WinForms)** application where the user plays *Shotgun* against a computer opponent that picks moves randomly.
Key objectives:
- Show each player’s current bullet count clearly at all times.
- Prevent shooting unless the player has bullets (same for the computer).
- Announce the winner and allow “Play Again.”
- Enable the **Shotgun** action only when the player has **≥ 3 bullets**.
- Write clean, object-oriented C# code following the course guidelines.
All core features are implemented as required for a passing grade (G).
---
## Assignment Scope
This submission focuses on:
- A functional **WinForms UI** for interaction and status display.
- A **game engine** enforcing rules, turn results, and win conditions.
- A **simple AI** (random move selection).
Optional improvements (not required for G) are noted in the roadmap and can be added later (e.g., smarter AI).
---
## Game Rules
- **Load vs Load** → Both players gain **+1 bullet**.
- **Load vs Block** → The loading player gains **+1 bullet**.
- **Block vs Block** → No change.
- **Shoot vs Block** → The shooter **loses 1 bullet**.
- **Shoot vs Shoot** → Both players **lose 1 bullet**.
- **Shoot vs Load** → **Shooter wins** the game.
- **Shotgun (needs 3+ bullets)** → **Instant win** (even if opponent shoots or blocks).
---
## How to Run Locally
1. **Clone** the repo:
```bash
git clone https://github.com//ShotgunGame.git
## Implementation Notes (OOP)
- **GameState** class to track bullets, last moves, and win state.
- **Player** abstraction for Human and Computer:
- Human: selected via UI buttons.
- Computer: random strategy (can be extended).
- **GameEngine** service:
- Validates actions (e.g., cannot Shoot with 0 bullets).
- Resolves round outcomes based on rules.
- Exposes events/results to the UI.
- **WinForms** UI:
- Clearly displays bullet counts and last actions.
- Disables invalid buttons (e.g., Shoot when bullets = 0; Shotgun when bullets < 3).
- Dialog to show winner and Play Again option.
- **Roadmap (optional):**
- Smarter AI (avoid “Block” when opponent has 0 bullets, etc.)
- Sound effects and animations
- Persistent high scores
## Screenshots / Demo
Player loads a bullet while opponent blocks
Shooting action and empty bullets warning
Shotgun move → instant win
## 📄 Project Documentation
A short technical note is included in the repo (e.g., docs/notes.md) describing:
- Class responsibilities (GameState, GameEngine, Player).
- UI flow and state updates.
- How to extend AI logic.
## 👤 Author
Sanali Sewwandi
Cloud Developer Student – CUA24S
JENSEN Yrkeshögskola, 2025