Sponsored Content
Top Forums Shell Programming and Scripting Shuffling 'cards' using perl. Post 302345438 by DemonixX on Wednesday 19th of August 2009 08:52:36 AM
Old 08-19-2009
Shuffling 'cards' using perl.

I would be very grateful if someone could help me with this; using pop, shift, push, and the starting code below, I'd like a script that sufficiently "shuffles" a simulated deck of cards before printing the top five cards.
Code:
#!/usr/bin/perl

@startingdeck = ("A H","2 H","3 H","4 H","5 H","6 H","7 H","8 H",
                 "9 H","10 H","J H","Q H","K H",
                 "A D","2 D","3 D","4 D","5 D","6 D","7 D","8 D",
                 "9 D","10 D","J D","Q D","K D",
                 "A C","2 C","3 C","4 C","5 C","6 C","7 C","8 C",
                 "9 C","10 C","J C","Q C","K C",
                 "A S","2 S","3 S","4 S","5 S","6 S","7 S","8 S",
                 "9 S","10 S","J S","Q S","K S");

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sound cards

hey im having problems getting my sound to work, im running linux mandrake 8.0 and it detects the sound card but it will not play any sound if there are any ideas or slutions please let me know.-vassago (3 Replies)
Discussion started by: vassago
3 Replies

2. BSD

WLAN PCI Cards

Hi! I just wanted to know what network cards are supported in FreeBSD. I have looked at the list of supported cards but I can't find any of them in the stores. Is the list not updated, I would really preciate info about where (in EU, Sweden) I can buy them. /Peter (2 Replies)
Discussion started by: Barfly.se
2 Replies

3. Linux

sound cards

i installed Red Hat Fedora (successfully this time) and my sound card wasnt automticly found or what ever. so how do i get my sound working and stuff? how do i gonfigure the sound card? how do i get it to detect the sound card? (4 Replies)
Discussion started by: xcaliber
4 Replies

4. Solaris

x25 cards on solaris 8

Has anyone configured one of these things, I cant seem to find any documentation on sunsolve, I want to verify that it is up and running... (1 Reply)
Discussion started by: csaunders
1 Replies

5. Solaris

How to List all Network cards

Hi, I'm looking for a command to be able to list all my network cards available on my server. With the command "ifconfig - a", I can only see to configured network card(s) Any idea ? :confused: Thanks a lot for your help, Fabien (5 Replies)
Discussion started by: unclefab
5 Replies

6. High Performance Computing

veritas and nic cards

Hello I have 2 machines with 3 NIC cards. When I setup veritas, I receive this message: e1000g1 has an IP address configured on it. It could be a public NIC on ken. Are you sure you want to use e1000g1 for the first private heartbeat link? As if e1000g1 should not have an IP address.... (2 Replies)
Discussion started by: melanie_pfefer
2 Replies

7. HP-UX

HP UX 9000 NIC CARDS

Hello, I am trying to move an HP UX from one locaion to another. The new location don't have any Fiber switches. On the back of my server I see 2 RJ 45 for console management the other for networking , the server also has a fiber NIC card. When I disconnec the fiber and want to user regular... (1 Reply)
Discussion started by: ldaliosmane
1 Replies

8. High Performance Computing

Graphics cards

More and more applications which consist of computationally intensive tasks rely on the graphics card's capabilities in order to speed up the calculations. The question is how can one know whether the graphics card will have any influence for a proprietary application? (2 Replies)
Discussion started by: figaro
2 Replies

9. Fedora

Shuffling a text file

Hi, I have a text file that is a single column. How do I write code to shuffle it? Thanks! Sample input: NANP DLGAP5 BUB1 C4orf46 BID (6 Replies)
Discussion started by: evelibertine
6 Replies

10. Shell Programming and Scripting

PERL - getting last file using wild cards

Hi experts, I am new to perl. I am trying to get the last file from set of files. Using the below code; but getting error pls help Files: -rw-r--r-- 1 abc abc 12584 Mar 18 16:22 /abc/def/ghi/xyz.HOSTNAME.2016.03.18.16.21.69709-6 -rw-r--r-- 1 abc abc 12623 Mar 18 16:25... (4 Replies)
Discussion started by: sdosanjh
4 Replies
XSOL(6) 							   Games Manual 							   XSOL(6)

NAME
xsol - X Solitaire SYNOPSIS
xsol DESCRIPTION
This manual page briefly documents xsol , a simple Motif/ Lesstif version of the classic solitaire game. It was written for the Debian GNU/Linux distribution because the original program does not have a manual page. HOW TO PLAY
Solitaire is a card game. At the start you are presented with seven columns of cards. First has only one card, second one has two, third three and so on (28 in total), but only the first card in every column is shown ('opened'). Also there is the deck (24 cards at the start), and four emtpy places for suit stacks. Cards in the deck and in the columns are unsorted, and the object of Solitaire is to use all the cards in the deck to build up the four suit stacks in ascending order, beginning with the aces. You can accomplish that by dragging and dropping the red onto the black (and black onto the red) cards between the columns, and between the deck and the columns (but not the other way around). When you see a whole turned card, click on it to see it ('open' it) and to be able to move it somewhere. Deck is opened by clicking on it; once you reach the end of the deck, just click once more and you'll reopen it. If you reach a point when you can't move any more cards to the stacks, and rearranging cards in columns and the deck gets you nowhere, the game is over. Start it again. OPTIONS
You can access all options within the program, through the 'Game' menu. There you have four options: New game - start a new game, Undo - undo last move, Options - configure these options: Timed game - should we count the seconds? Keep score - should we count the score? Show number of cards in deck - should we show it? Draw one - card from the deck, Draw three - cards from the deck. About - shows information about the author. Exit - quits the game. AUTHOR
xsol was written by Brian Masney <masneyb@newwave.net>, and this manual page was written by Josip Rodin <jrodin@jagor.srce.hr>. Debian Project March 1999 XSOL(6)
All times are GMT -4. The time now is 02:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy