Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7960415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:44:53+00:00 2026-06-04T04:44:53+00:00

I am making a program to play a game of UNO. In the UNO

  • 0

I am making a program to play a game of UNO. In the UNO deck, some cards are repeated, and therefore I cannot just make a list of integers; I have to use objects. I plan on using a LinkedList for the deck, but I am aware that shuffles on a LinkedList are horridly slow.

My question is, should I….

  1. Avoid a LinkedList entirely and just go with an ArrayList
  2. Use an ArrayList or similar, shuffle, then put the contents into the LinkedList
  3. Construct an ArrayList, then make my own shuffling routine (aka not using Random) that adds to the LinkedList as we go
  4. Shuffle the LinkedList anyway (as in, it’s not really that bad)

This is not for homework; it is to assist in having fun 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:44:54+00:00Added an answer on June 4, 2026 at 4:44 am

    You can represent cards by plain integers. If an integer represents a type of card, and Uno has multiple cards of the same type, just use the integer corresponding to that card more than once.

    Shuffling and dealing is easy.

    To start the game, set up a fixed size, dumb array of type integer (no fancy linked lists or Arraylist need apply) that can hold the entire deck (size = N). Fill this array with the integers representing the Uno deck including the duplicate integers representing duplicate cards. Set UNDEALT to N.

    To shuffle, execute the following code some modest (100?) times:

     1)  Pick a random number from 1 to UNDEALT, R.
     2)  Exchange the the first array slot with the Rth slot.
    

    To deal:

     1) Give out the card in the UNDEALT slot.
     2) Decrement UNDEALT.
    

    You can do all this with fancier data structures, too, but there just isn’t any point. Given that the total information involved is 100 data items, unless you do something outrageously dumb, it’ll be faster than people. But my motto is: if simple works, stick with simple.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a program that will play some music when it starts and that
I am making a simple program that creates game cards for a game I
Im making a program about the game Go and im trying to write some
I making a program and wanted to make an update function... So lets say
I'm making a program that allows you to play connect 4 against my program.
I'm writing a computer program to play the word game Ghost. Here's how the
I'm making a tictactoe game where you can play against another person or an
i am making a program to add a list numbers separated by a comma
I am using the cool map making program DIY map and i want to
Im making a program for class that manages a Hotel. I have a function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.