Introduction to my Uno – First Year C# Project using WPF

Classic Uno Deck
Classic Uno Deck

Uno – First Year C# Project using WPF. This project was my final submission for Object Orientated programming and Principles; at the end of my first year at University. I am studying for a Meng in Computer Science and have three years left. This project was submitted five before this article. Due to the Covid19 mitigating circumstance extensions; I was unable to release the code until now. I have now released the code open source under the BSD 3-Clause License. The source code for this project can be found on GitHub

The Challenge

The Challenge, to turn this classic card game into a hot seat style game. In order to get the maximum grades, there were a number of criteria to meet and features to implement. Essentially all the features of a physical game of Uno in a hot seat game. The last ten per cent of the marks were for the implementation of a GUI in either WPF or mono game. For anyone who doesn’t know Uno, the full rules can be found here. Grading for this project in broad terms is split as follows.

  • Meeting the specification 60%
  • Object Orientated Design 30%
  • Software Development Practices 10%

Key Areas To Cover – Uno – First Year C# Project using WPF

  • Code using object-orientated principles (Abstraction, Encapsulation, Inheritance and Run-Time polymorphism
  • Implement the basic number cards.
  • Add the special cards and functionality (wild, wild draw 4, draw2, miss turn, change direction and swap hands).
  • Save and restore games
  • Scoring
  • House Rules
  • Use of version control
  • Demonstration Video (not shown here, I may add this later)

Game Showcase – Uno – First Year C# Project using WPF

Main Menu

Uno – First Year C# Project using WPF by sara payne
Uno Game Main Menu

New Game Menu

Uno – First Year C# Project using WPF by sara payne
New Game Menu

Game Play

Uno – Game play
Uno – Game play

My House Rules

House Rules 1

House rule one is very similar to the original rules. It has just one difference. You must play a card before you can pass your go to the next player. If you cannot play you must continue to pick up cards until you can play.

House Rules 2

House Rules 2 – Standard Cards

  • Players must discard before passing play to the next player. If they can’t go, they must pick up until they can go.
  • In their turn, players can play any combination of cards that follow.
  • e.g. If the Discard Pile starts with a Red card, and a player 1 has all red cards in their hand they can win without anyone else playing.

House Rules 2 – Special Cards

  • +2: can be stacked, so if a player puts down two +2 cards in a row, the next player will pick up two cards for each one played.
  • +4: can be played at any time and stacked. So playing 2 plus+4 cards will mean the next player in the direction of play at that time would pick up 8 cards.
  • Skip Go: multiple may be played in one hand, but only one will be actioned at the point the next player is called. Who skips the go will depend on the direction of play at the time.
  • Change Direction Happens Immediately, this could be combined with +2 or +4 cards to make people on either side of the player pick up cards.

House Rules 3

This version of the game includes the ability to stack certain special cards on a player by player bases to pass on consequences.

Stackable Cards – Wild +4 Card

This is the most complicated card due to the ability to challenge its use. However, only the first in the stack could play it illegally, so we only have to worry about this once.

Example assuming 3 players, with order of play 1,2,3
  • Player 1 – Player 1 plays+4 (legally)
  • Player 2 – Challenges & Looses. So usually player 2 would draw 6 cards.
  • Player 2 – Plays a +4 card. (total to pickup is now 10)
  • Player 3 – Plays a +4 card. (total to pickup is now 14)
  • Player 3 – Plays a +4 card. (total to pickup is now 18)
  • Play returns to player 1 who doesn’t have another +4 card, clicks accept and draws 18 cards (player 2 also misses 4 turns)
  • Player 1 – has 4 turns to miss, uses one of them and skips a turn.
  • Player 2 – Continues play as normal.

Stack options reset and normal play resumes with player 2.
If player2 had accepted the challenge the flow would be the same except there would be 2 fewer cards to collect because they would draw4 cards, not 6.

Stackable Cards – Draw 2 card

Example assuming 3 players, with order of play 1,2,3
  • Initially Player 1 – plays +2 card
  • Then Player 2 – plays +2 card
  • Followed by Player 3 – plays +2 card
  • Play returns to player 1, Player 1 – plays +2 card
  • Player 2 – has no plus2 card, and clicks accept, then draws 8 cards and skips 4 turns
  • Player 2 – has stacked skips and doesn’t play
  • Player3 – plays in normal fashion based on the last discard card.

Skip Go Card

Skip go works exactly as described above in the draw 2 example other than no cards are drawn.

Players with skip turns applied

If a player has a skipped turn applied, when it comes to their turn a message will pop up saying they missed their turn. The same will happen during a stack build up. The number of skips applied to the play is then reduced and play continues with the next player

Related Articles – Uno – First Year C# Project using WPF

I will be adding to this list of related articles over time.

This article has 4 comments

  1. Pingback: Another Year Of Student Life Completed Successfully. - Sara Payne's BlogSara Payne's Blog

  2. Martin Corrick Reply

    I landed here by chance, while trying to understand Deja Dup – which I have so far failed to do. But I stayed to look around because I found your voice intriguing. This site is a fragile footprint in the sand, evidently left by a person of focused intelligence and a broad set of interests, but giving the reader absolutely no clues to her current situation – or indeed her destination. Taxis and Linux software…? They form an odd combination. Hull is a fine university, but possibly the choice of students who want to know a lot about something specific, a subject that may not be covered in the average university…? I wonder how you got on?

    Regards,
    Martin Corrick

    PS: I should add that I am only a curious old chap, probably old enough to be your grandad, and I have no designs upon you – only a curiosity generated by your strong voice and elusive absence from this site. Where are you going, I wonder?

    • sarapayne Reply

      Hi Martin

      Thanks for dropping by, I guess to many it might seem like a strange move but computer science is an area I have had a life long interest in. As for where I am heading… if all goes well Italy. I plan to finish my Meng in Computer science, of which I have three years left. Once finished I look forward to emigrating to pastures new. Perhaps I will add a post about what brought me to this position soon. Indeed it’s true I have very little in the way of personal information on this blog page yet.

  3. Pingback: C# Development on Linux as well as Windows - Sara Payne's BlogSara Payne's Blog

Leave a Comment

Your email address will not be published. Required fields are marked *