{"id":464,"date":"2012-10-07T17:47:48","date_gmt":"2012-10-08T00:47:48","guid":{"rendered":"http:\/\/blogs.unsw.edu.au\/comp1400\/?p=464"},"modified":"2012-10-07T17:47:48","modified_gmt":"2012-10-08T00:47:48","slug":"lab-wk-12-uno-game","status":"publish","type":"post","link":"https:\/\/blogs.unsw.edu.au\/comp1400\/blog\/2012\/10\/lab-wk-12-uno-game\/","title":{"rendered":"Lab Wk 12 &#8211; Uno Game"},"content":{"rendered":"<p>Download the <a href=\"http:\/\/www.cse.unsw.edu.au\/~cs1400\/lectures\/Uno.zip\">Uno Game<\/a> BlueJ project shown in the lecture.<\/p>\n<p><strong>Constructors<\/strong><\/p>\n<p>Use the debugger to watch how cards are constructed:<\/p>\n<ol>\n<li>Set a breakpoint in the WildDrawCard constructor (line 17).<\/li>\n<li>Create a new WildDrawCard by calling the constructor..<\/li>\n<li>Use the &#8216;step into&#8217; button to step through the code. Observe how the <code>super()<\/code> call works.<\/li>\n<li>Repeat this process for the other kinds of cards.<\/li>\n<\/ol>\n<p>Set up a game:<\/p>\n<ol>\n<li>Call <code>Game.makeStandardDeck()<\/code> to create a deck (ArrayList) of cards.<\/li>\n<li>Press the <strong>Get<\/strong> button to save this deck in a variable.<\/li>\n<li>Call the <code>Game<\/code> constructor, providing this deck as a parameter.<\/li>\n<li>Call the <code>deal()<\/code> method on the game you created to deal the cards.<\/li>\n<\/ol>\n<p><strong>Inheriting methods<\/strong><\/p>\n<ol>\n<li>Create a selection of cards from the different card classes.<\/li>\n<li>Right-click on each card to observe the methods it implements and the methods it inherits.<\/li>\n<li>Where is the <code>canPlay()<\/code> method implemented on each card type?<\/li>\n<li>Where is the <code>play()<\/code> method implemented on each card type?<\/li>\n<li>Set a breakpoint in <code>WildDrawCard.play()<\/code> (line 26).<\/li>\n<li>Create a WildDrawCard and call its play() method. Use the debugger to step through the code.<\/li>\n<li>Observe the order the code is executed.<\/li>\n<\/ol>\n<p><strong>Add a new card type<\/strong><\/p>\n<ol>\n<li>Change the rule for the NumberCard so it can only be played on another NumberCard of value one more or one less that itself. (i.e. a 5 can be only played on a 4 or 6). Numbers should wrap around, so a 0 can be played on a 9 and vice-versa.<\/li>\n<li>Create a Transfer card class which transfers 2 random cards from the player to the previous player.<\/li>\n<li>Add a new Reverse-Draw card class which reverses the direction of play <em>then<\/em> causes the next player to draw. Does it have any code in common with other cards? What class would it be best to inherit from?<\/li>\n<li>Create your own card types.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Download the Uno Game BlueJ project shown in the lecture. Constructors Use the debugger to watch how cards are constructed: Set a breakpoint in the WildDrawCard constructor (line 17). Create a new WildDrawCard by calling the constructor.. Use the &#8216;step into&#8217; button to step through the code. Observe how the super() call works. Repeat this [&hellip;]<\/p>\n","protected":false},"author":80,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-464","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/users\/80"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/comments?post=464"}],"version-history":[{"count":2,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/464\/revisions"}],"predecessor-version":[{"id":466,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/464\/revisions\/466"}],"wp:attachment":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/media?parent=464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/categories?post=464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/tags?post=464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}