Skip to content
Snippets Groups Projects
Commit c99eb576 authored by Martin Kuiper's avatar Martin Kuiper
Browse files

Final submission commit for course evaluation.

parent 5a7902c8
No related branches found
No related tags found
No related merge requests found
Components Components
Players: Players:
{ {
...@@ -20,14 +20,13 @@ Cards: ...@@ -20,14 +20,13 @@ Cards:
i = 2 i = 2
while i <= 14 { while i <= 14 {
MainDeck.add(newCard(suit:"diamonds", value: i, name:cardNames[i]+" of diamonds", image: i+"D.png")) MainDeck.add(newCard(suit:"diamonds", value: i, name:cardNames[i]+" of diamonds", image: i+"D.png"))
MainDeck.add(newCard(suit:"clubs", value: i, name:cardNames[i]+" of clubs", image: i+"C.png")) MainDeck.add(newCard(suit:"clubs", value: i, name:cardNames[i]+" of clubs", image: i+"C.png"))
MainDeck.add(newCard(suit:"hearts", value: i, name:cardNames[i]+" of hearts", image: i+"H.png")) MainDeck.add(newCard(suit:"hearts", value: i, name:cardNames[i]+" of hearts", image: i+"H.png"))
MainDeck.add(newCard(suit:"spades", value: i, name:cardNames[i]+" of spades", image: i+"S.png")) MainDeck.add(newCard(suit:"spades", value: i, name:cardNames[i]+" of spades", image: i+"S.png"))
i = i + 1 i = i + 1
} }
} }
Rules Rules
GameStart { GameStart {
...@@ -63,4 +62,4 @@ Game { ...@@ -63,4 +62,4 @@ Game {
foreach player in players { foreach player in players {
turn(player) turn(player)
} }
} }
\ No newline at end of file
# Our implementation of the cardgame Uno, written in the Deckmaster language.
#
Components Components
Decks: Decks:
...@@ -10,27 +12,27 @@ Cards: ...@@ -10,27 +12,27 @@ Cards:
{ {
i = 1 i = 1
while i < 10 { while i < 10 {
drawPile.add(newCard(color:"Red", value: i, special: "none", image: "red"+i+".png")) repeat 2 drawPile.add(newCard(color:"Red", value: i, special: "none", image: "red"+i+".png")) repeat 2
drawPile.add(newCard(color:"Green", value: i, special: "none", image: "green"+i+".png")) repeat 2 drawPile.add(newCard(color:"Green", value: i, special: "none", image: "green"+i+".png")) repeat 2
drawPile.add(newCard(color:"Blue", value: i, special: "none", image: "blue"+i+".png")) repeat 2 drawPile.add(newCard(color:"Blue", value: i, special: "none", image: "blue"+i+".png")) repeat 2
drawPile.add(newCard(color:"Yellow", value: i, special: "none", image: "yellow"+i+".png")) repeat 2 drawPile.add(newCard(color:"Yellow", value: i, special: "none", image: "yellow"+i+".png")) repeat 2
i = i + 1 i = i + 1
} }
drawPile.add(newCard(color: "Red", value: 0, special: "Reverse", image: "redreverse.png")) repeat 2 drawPile.add(newCard(color: "Red", value: 0, special: "Reverse", image: "redreverse.png")) repeat 2
drawPile.add(newCard(color: "Green", value: 0, special: "Reverse", image: "greenreverse.png")) repeat 2 drawPile.add(newCard(color: "Green", value: 0, special: "Reverse", image: "greenreverse.png")) repeat 2
drawPile.add(newCard(color: "Blue", value: 0, special: "Reverse", image: "bluereverse.png")) repeat 2 drawPile.add(newCard(color: "Blue", value: 0, special: "Reverse", image: "bluereverse.png")) repeat 2
drawPile.add(newCard(color: "Yellow", value: 0, special: "Reverse", image: "yellowreverse.png")) repeat 2 drawPile.add(newCard(color: "Yellow", value: 0, special: "Reverse", image: "yellowreverse.png")) repeat 2
drawPile.add(newCard(color: "Red", value: 0, special: "Draw +2", image: "reddraw.png")) repeat 2 drawPile.add(newCard(color: "Red", value: 0, special: "Draw +2", image: "reddraw.png")) repeat 2
drawPile.add(newCard(color: "Green", value: 0, special: "Draw +2", image: "greendraw.png")) repeat 2 drawPile.add(newCard(color: "Green", value: 0, special: "Draw +2", image: "greendraw.png")) repeat 2
drawPile.add(newCard(color: "Blue", value: 0, special: "Draw +2", image: "bluedraw.png")) repeat 2 drawPile.add(newCard(color: "Blue", value: 0, special: "Draw +2", image: "bluedraw.png")) repeat 2
drawPile.add(newCard(color: "Yellow", value: 0, special: "Draw +2", image: "yellowdraw.png")) repeat 2 drawPile.add(newCard(color: "Yellow", value: 0, special: "Draw +2", image: "yellowdraw.png")) repeat 2
drawPile.add(newCard(color: "Red", value: 0, special: "Skip", image: "redskip.png")) repeat 2 drawPile.add(newCard(color: "Red", value: 0, special: "Skip", image: "redskip.png")) repeat 2
drawPile.add(newCard(color: "Green", value: 0, special: "Skip", image: "greenskip.png")) repeat 2 drawPile.add(newCard(color: "Green", value: 0, special: "Skip", image: "greenskip.png")) repeat 2
drawPile.add(newCard(color: "Blue", value: 0, special: "Skip", image: "blueskip.png")) repeat 2 drawPile.add(newCard(color: "Blue", value: 0, special: "Skip", image: "blueskip.png")) repeat 2
drawPile.add(newCard(color: "Yellow", value: 0, special: "Skip", image: "yellowskip.png")) repeat 2 drawPile.add(newCard(color: "Yellow", value: 0, special: "Skip", image: "yellowskip.png")) repeat 2
drawPile.add(newCard(color: "Wild" , value: 0, special: "Color Change", image: "wild.png")) repeat 4 drawPile.add(newCard(color: "Wild" , value: 0, special: "Color Change", image: "wild.png")) repeat 4
drawPile.add(newCard(color: "Wild", value: 0, special: "Draw +4", image: "wilddraw.png")) repeat 4 drawPile.add(newCard(color: "Wild", value: 0, special: "Draw +4", image: "wilddraw.png")) repeat 4
foreach card in drawPile { foreach card in drawPile {
card.set("imageBack", "unocardback.png") card.set("imageBack", "unocardback.png")
...@@ -107,7 +109,7 @@ Turn { ...@@ -107,7 +109,7 @@ Turn {
if card.get("value") >= topCard.get("value") if card.get("value") >= topCard.get("value")
|| card.get("value") == 0 { || card.get("value") == 0 {
card_str = "Play " + cardInfo(card) card_str = "Play " + cardInfo(card)
addChoice card_str { addChoice "Play " + cardInfo(card) {
if card.get("special") == "Reverse" { if card.get("special") == "Reverse" {
reverseTurnOrder() reverseTurnOrder()
print() print()
...@@ -143,10 +145,12 @@ Turn { ...@@ -143,10 +145,12 @@ Turn {
} }
} }
} }
#this resets the color of wild cards when another card is played
if topCard.get("special") == "Draw +4" if topCard.get("special") == "Draw +4"
|| topCard.get("special") == "Color Change" { || topCard.get("special") == "Color Change" {
topCard.set("color", "Wild") topCard.set("color", "Wild")
} }
player.play(card, playPile) player.play(card, playPile)
playersPassed = 0 playersPassed = 0
} }
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment