{"id":17051,"date":"2020-11-24T09:15:46","date_gmt":"2020-11-24T09:15:46","guid":{"rendered":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/"},"modified":"2020-11-24T09:15:46","modified_gmt":"2020-11-24T09:15:46","slug":"stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues","status":"publish","type":"post","link":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/","title":{"rendered":"Stacks &#038; Queues( variation of the popular card game SOLITAIRE using stacks and queues)"},"content":{"rendered":"<style type=\"text\/css\"><\/style><p>Program Code : Java<br \/>\nDeck\/Stock \u2013 A pile of cards, face down, which are left over after setting up the\u00a0<a href=\"https:\/\/homeworkhandlers.com\/other\/\">other<\/a>\u00a0layout areas. These are turned over one-at-a-time into the waste. For your program this pile of cards MUST be stored in a STACK.<\/p>\n<p>Waste \u2013 The area where the cards from the deck\/stock go when they are brought into play. Only cards from the stock can be played to the waste. Only the topmost card can be moved to either the foundation or to the tableau. For your program this pile of cards MUST be stored in a STACK.<\/p>\n<p>Foundations \u2013 The aim of the\u00a0<a href=\"https:\/\/homeworkhandlers.com\/games\/\">games<\/a>\u00a0is to clear the tableau and move all the cards to the foundation. They are built up by suit from Ace(1) to King(13). Assume at the start of the game, the four ACEs are already placed on the foundation. For your program this pile of cards MUST be stored in four separate STACKs (one for each suit). Recommended you use an ARRAY of stacks for this.<\/p>\n<p>Tableaus \u2013 This consists of a number of piles where cards can be moved from one tableau to another or from tableau to a foundation. For your program this pile of cards MUST be stored in 7 STACKs and 7 QUEUEs. Each tableau (ex. T4 see picture) has both a stack and a queue. The stack holds the cards that have been turned over while the queue holds the cards that have not yet turned. At the start of the game Tableau 0 (T0 see picture) starts with a queue containing 1 card, T1 has two cards, T2 has 3 cards and so on. The game begins by DEQUEUING one card from each of these queues and placing it into the stack of the tableau. Hence, the T0 queue begins the game with 0 cards, T1 queue has 1 card and so forth while each of the tableau stacks have the one card to start with (the topmost card you can see). Recommended you use an ARRAY of 7 queues and another ARRAY of 7 stacks for this.<br \/>\nCreating a shuffled deck of 52 cards<br \/>\nYour deck of cards should be represented by a number (1-13) followed by the first letter of the suit. Example: 1H, 5S, 12C, 13D would mean ace of hearts(1H), 5 of spades(5S), queen of clubs(12C), and king of diamonds(13D). The deck also needs to be shuffled.<br \/>\nSource code for 52 card and shuffled :<br \/>\nimport java.util.ArrayList;<br \/>\nimport java.util.Collections;<\/p>\n<p>\/**<br \/>\n*<br \/>\n* @author Faruk<br \/>\n*\/<br \/>\npublic class Deck {<\/p>\n<p>public static void main(String[] args)<br \/>\n{<br \/>\nArrayList&lt;String&gt; shuffled_deck = shuffledDeck();<\/p>\n<p>System.out.println( shuffled_deck );<br \/>\n}<\/p>\n<p>private static ArrayList&lt;String&gt; shuffledDeck()<br \/>\n{<br \/>\nArrayList&lt;String&gt; deck = new ArrayList&lt;String&gt;();<\/p>\n<p>String[] suit = new String[] { \u201cH\u201d,\u201dD\u201d,\u201dC\u201d,\u201dS\u201d };<br \/>\nfor(int i=1; i&lt;=13; i++)<br \/>\nfor(int j=0; j&lt;4; j++)<br \/>\ndeck.add( i + suit[j] );<\/p>\n<p>Collections.shuffle(deck);<\/p>\n<p>return deck;<br \/>\n}<br \/>\n}<br \/>\nStacks and Queues<br \/>\nYou may use Java\u2019s ArrayDeque class and Java\u2019s Stack class or you may use your own StackBox \/ QueueBox code or any combination of these four BUT your solution must use stacks and queues as described above.<\/p>\n<p>*** Assume for all stacks you can only move and see (peek) the top card of any stack.<\/p>\n<p>Sample Program<br \/>\n( run runme.\u2013 Do not try to \u201cdecompile\u201d this program. There are safeguards in place and detection of cheating will result in disciplinary action.) = Please don\u2019t Do reverse Engineering!<br \/>\nI attach the file .<\/p>\n<p>Simple Game Rules<br \/>\nYou can only move the top card of any stack.<br \/>\nTo move a card to the foundation, the foundation must have the previous card already there. Example, you can\u2019t move 12D if 11D is not already in the foundation.<br \/>\nTo move a card onto a tableau, the card must be one less than the card currently showing on the target tableau AND the suit color must be opposite color than the card showing. Example, moving 7H on a tableau currently showing a 8S is allowed but you can\u2019t move 7H to a 8D (suit colors are both red). You can also move any card to the tableau if the tableau is empty (no cards in its stack or queue left).<\/p>\n<p>Marking &amp; Grading<br \/>\n!! IMPORTANT!! Your program must use stacks and queues as described. If you don\u2019t use (mostly) stacks and queues then maximum mark given will be 25% even if the program does work. !!<\/p>\n<p>[10 marks]: Program uses Stacks and Queues for deck, waste, tableaus, and foundations.<br \/>\n[2 marks]: Draw a card from deck stack to waste stack.<br \/>\n[2 marks]: Move all cards from waste stack back to desk stack when deck stack is empty<br \/>\n[4 marks]: Move waste card to foundations correctly assuming move is allowed.<br \/>\n[4 marks]: Move waste card to a tableau assuming move is allowed<br \/>\n[6 marks]: Moving a tableau card from one tableau to another assuming move is allowed<br \/>\n[4 marks]: Dequeing a tableau queue and placing card on the tableau stack when stack is empty.<br \/>\n[4 marks]: Moving tableau card to foundations assuming move is allowed.<br \/>\n[4 marks]: Game robustness testing ( can\u2019t\u00a0<a href=\"https:\/\/homeworkhandlers.com\/crash\/\">crash<\/a>\u00a0the program )<\/p>\n<p>Here i attatched 3 more picture with a sample output picture.<br \/>\nAssignment Due : In 25 Hours .<br \/>\nPlease update me soon ! Thanks<\/p>\n<p>No reverse coding or Don\u2019t use the solo.class(just for ref)<\/p>\n<p><center><a href=\"http:\/\/onlineclassesguru.com\/orders\/ordernow\"><img decoding=\"async\" src=\"https:\/\/encrypted-tbn0.gstatic.com\/images?q=tbn:ANd9GcTyj99p60XCLyLk1htB7-1neRt8-2QdnenNlQ&usqp=CAU\"target=\"_http:\/\/onlineclassesguru.com\/orders\/ordernow\"\/><\/center><p>","protected":false},"excerpt":{"rendered":"<p>Program Code : Java Deck\/Stock \u2013 A pile of cards, face down, which are left over after setting up the\u00a0other\u00a0layout areas. These are turned over one-at-a-time into the waste. For your program this pile of cards MUST be stored in a STACK. Waste \u2013 The area where the cards from the deck\/stock go when they&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-17051","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Stacks &amp; Queues( variation of the popular card game SOLITAIRE using stacks and queues) - onlineclassesguru<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Stacks &amp; Queues( variation of the popular card game SOLITAIRE using stacks and queues) - onlineclassesguru\" \/>\n<meta property=\"og:description\" content=\"Program Code : Java Deck\/Stock \u2013 A pile of cards, face down, which are left over after setting up the\u00a0other\u00a0layout areas. These are turned over one-at-a-time into the waste. For your program this pile of cards MUST be stored in a STACK. Waste \u2013 The area where the cards from the deck\/stock go when they...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/\" \/>\n<meta property=\"og:site_name\" content=\"onlineclassesguru\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-24T09:15:46+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin_admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/onlineclassesguru.com\/#website\",\"url\":\"https:\/\/onlineclassesguru.com\/\",\"name\":\"onlineclassesguru\",\"description\":\"Cheap Professional coursework and reaction papers help\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/onlineclassesguru.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/#webpage\",\"url\":\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/\",\"name\":\"Stacks & Queues( variation of the popular card game SOLITAIRE using stacks and queues) - onlineclassesguru\",\"isPartOf\":{\"@id\":\"https:\/\/onlineclassesguru.com\/#website\"},\"datePublished\":\"2020-11-24T09:15:46+00:00\",\"dateModified\":\"2020-11-24T09:15:46+00:00\",\"author\":{\"@id\":\"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742\"},\"breadcrumb\":{\"@id\":\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/onlineclassesguru.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Stacks &#038; Queues( variation of the popular card game SOLITAIRE using stacks and queues)\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742\",\"name\":\"admin_admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/onlineclassesguru.com\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g\",\"caption\":\"admin_admin\"},\"url\":\"https:\/\/onlineclassesguru.com\/index.php\/author\/admin_admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Stacks & Queues( variation of the popular card game SOLITAIRE using stacks and queues) - onlineclassesguru","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/","og_locale":"en_US","og_type":"article","og_title":"Stacks & Queues( variation of the popular card game SOLITAIRE using stacks and queues) - onlineclassesguru","og_description":"Program Code : Java Deck\/Stock \u2013 A pile of cards, face down, which are left over after setting up the\u00a0other\u00a0layout areas. These are turned over one-at-a-time into the waste. For your program this pile of cards MUST be stored in a STACK. Waste \u2013 The area where the cards from the deck\/stock go when they...","og_url":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/","og_site_name":"onlineclassesguru","article_published_time":"2020-11-24T09:15:46+00:00","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin_admin","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/onlineclassesguru.com\/#website","url":"https:\/\/onlineclassesguru.com\/","name":"onlineclassesguru","description":"Cheap Professional coursework and reaction papers help","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/onlineclassesguru.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/#webpage","url":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/","name":"Stacks & Queues( variation of the popular card game SOLITAIRE using stacks and queues) - onlineclassesguru","isPartOf":{"@id":"https:\/\/onlineclassesguru.com\/#website"},"datePublished":"2020-11-24T09:15:46+00:00","dateModified":"2020-11-24T09:15:46+00:00","author":{"@id":"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742"},"breadcrumb":{"@id":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/stacks-queues-variation-of-the-popular-card-game-solitaire-using-stacks-and-queues\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/onlineclassesguru.com\/"},{"@type":"ListItem","position":2,"name":"Stacks &#038; Queues( variation of the popular card game SOLITAIRE using stacks and queues)"}]},{"@type":"Person","@id":"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742","name":"admin_admin","image":{"@type":"ImageObject","@id":"https:\/\/onlineclassesguru.com\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g","caption":"admin_admin"},"url":"https:\/\/onlineclassesguru.com\/index.php\/author\/admin_admin\/"}]}},"_links":{"self":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/17051"}],"collection":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/comments?post=17051"}],"version-history":[{"count":0,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/17051\/revisions"}],"wp:attachment":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/media?parent=17051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/categories?post=17051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/tags?post=17051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}