+ Reply to Thread
Page 293 of 363 FirstFirst ... 193243283291292293294295303343 ... LastLast
Results 2,921 to 2,930 of 3627

Thread: Clipboard Game

  1. #2921
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: Clipboard Game

    Code:
    trickyotool

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2922
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: Clipboard Game

    Code:
    http://forum.codecall.net/games/10084-ask-me-tcm-74.html

  4. #2923
    Jordan Guest

    Re: Clipboard Game

    Code:
    100% of the proceeds from Givoogle, less operating costs, are donated to the American Cancer Society, an institution whose goals are aligned with our mission of spreading hope to those most in need.

  5. #2924
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: Clipboard Game

    Code:
    https://mail.google.com/mail/

  6. #2925
    Jordan Guest

    Re: Clipboard Game

    Code:
    http://pandadan.files.wordpress.com/2007/04/funny_sport_photo_23.jpg

  7. #2926
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: Clipboard Game

    Code:
    http://pandadan.files.wordpress.com/2007/04/funny_sport_photo_23.jpg
    curious lol and that is going on my blog

  8. #2927
    Jordan Guest

    Re: Clipboard Game

    Code:
    A lot of     spaces   here
    Preserves Unix style   line   breaks?
    A lot of spaces here
    Preserves Unix style line breaks?

  9. #2928
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: Clipboard Game

    Code:
    http://www.northeast.railfan.net/images/tr_rdg287.jpg

  10. #2929
    Join Date
    Mar 2008
    Posts
    7,145
    Rep Power
    86

    Re: Clipboard Game

    Code:
    package challenges;
    import java.io.*;
    import java.util.*;
    
    /*
     * These are just notes about what could be going wrong.
     *
     * I do bounds checking on every input based on the idea that the specs
     * do not say that the input will be in boundso  the array.
     * This is BS. The specs say that an image will be an M x N image but the output
     * is given as an N x M image.
     *
     * The number of cols is given as M >= 1 so we cannot assume an upper bounds.
     * The number of rows is given as N <= 251, so we can assume an upper bounds on rows.
     *
     * The specs do not say the first command will be create a new image. So what do we
     * do if it not the first command?
     *
     * The specs do not state that X and Y will always be in bounds of the array.
     * The specs do not say that X and Y are in the set of reals. WTF? This is a bit extreme.
     *
     * The parameters defined as X, Y, X1, Y1, X2, Y2 are not in any defined order.
     * So X is not necessarily < Y
     * As such X1 might be > X2 and Y1 might be >  Y2. So Math.min and Math.max should fix this
     *
     * The specs do not state that the color C will be one letter. It might be 2?
     *
     * @author James
     */
    class Main {
    
        public static char[][] arcImage = new char[251][251];
        public static int M,  N;
        public static int[] DX = {1, 0, -1, 0};
        public static int[] DY = {0, 1, 0, -1};
    
        public static void main(String[] args) throws IOException {
            Scanner fin = new Scanner(new FileReader("graphical.txt"));
            //Scanner fin = new Scanner(System.in);
            String s; // the command to be executed
    
            char c; // the color to fill in
    
            while (fin.hasNext()) {
                s = fin.next();
    
                if (s.equals("I")) {
                    N = fin.nextInt();
                    M = fin.nextInt();
    
                    clear();
                } else if (s.equals("C")) {
                    clear();
                } else if (s.equals("L")) {
                    int y = fin.nextInt() - 1;
                    int x = fin.nextInt() - 1;
                    c = fin.next().charAt(0);
    
                    if (boundsCheck(x, y)) {
                        arcImage[x][y] = c;
                    }
                } else if (s.equals("V")) {
                    int x = fin.nextInt() - 1; // column
                    int y1 = fin.nextInt() - 1; // row
                    int y2 = fin.nextInt() - 1; // row
                    c = fin.next().charAt(0);
    
                    for (int y = Math.min(y1, y2); y <= Math.max(y1, y2); y++) {
                        if (boundsCheck(x, y)) {
                            arcImage[y][x] = c;
                        }
                    }
    
                } else if (s.equals("H")) {
                    /* Columns x1-x2 inclusive*/
                    int x1 = fin.nextInt() - 1;
                    int x2 = fin.nextInt() - 1;
                    int y = fin.nextInt() - 1;
                    c = fin.next().charAt(0);
                    for (int x = Math.min(x1, x2); x <= Math.max(x1, x2); x++) {
                        if (boundsCheck(y, x)) {
                            arcImage[y][x] = c;
                        }
                    }
    
                } else if (s.equals("K")) {
                    int x1 = fin.nextInt() - 1;
                    int y1 = fin.nextInt() - 1;
                    int x2 = fin.nextInt() - 1;
                    int y2 = fin.nextInt() - 1;
                    c = fin.next().charAt(0);
    
                    for (int x = Math.min(x1, x2); x <= Math.max(x1, x2); x++) {
                        for (int y = Math.min(y1, y2); y <= Math.max(y1, y2); y++) {
                            if (boundsCheck(x, y)) {
                                arcImage[x][y] = c;
                            }
                        }
                    }
                } else if (s.equals("F")) {
                    /* fill the region R with the color C, where R is defined as follows.
                    Pixel (X,Y) belongs to R. Any other pixel which is the same color as pixel (X,Y)
                    and shares a common side with any pixel in R also belongs to this region.
    
                    Solution: A recursive flood fill
                     */
                    int x = fin.nextInt() - 1;
                    int y = fin.nextInt() - 1;
                    char cReplace = arcImage[x][y];
                    c = fin.next().charAt(0);
    
                    if (boundsCheck(x, y)) {
                        fill(x, y, cReplace, c);
                    }
    
                //
                } else if (s.equals("S")) {
                    // display name and output the image
                    String sName = fin.nextLine().trim();
                    System.out.println(sName);
                    output();
                } else if (s.equals("X")) {
                    // kill program
                    break;
                }
            }
    
            fin.close();
            System.exit(0);
        }
    
        public static void clear() {
            for (int x = 0; x < M; x++) {
                for (int y = 0; y < N; y++) {
                    arcImage[x][y] = 'O'; // O
                }
            }
        }
    
        public static void output() {
            for (int x = 0; x < M; x++) {
                for (int y = 0; y < N; y++) {
                    System.out.print(arcImage[x][y]);
                }
                System.out.println();
            }
        }
    
        /**
         * Recursively replace all pixels in the region R that are cOld with the color
         * c.
         * @param x
         * @param y
         * @param cOld The color that we want to match against. If the pixel is not colored cOld
         * it is not part of the region.
         * @param c
         */
        public static void fill(int x, int y, char cOld, char c) {
            if (x < 0 || x >= M || y < 0 || y >= N) {
                return;
            }
    
            if (cOld == c) {
                return;
            }
    
            if (arcImage[x][y] != cOld) {
                return; // not part of the region
            }
    
    
    
            arcImage[x][y] = c;
    
            for (int nDir = 0; nDir < 4; nDir++) {
                fill(x + DX[nDir], y + DY[nDir], cOld, c);
            }
        }
    
        public static boolean boundsCheck(int x, int y) {
            if (x < 0 || x >= M || y < 0 || y >= N) {
                return false;
            }
            return true;
        }
    }

  11. #2930
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: Clipboard Game

    Code:
    Invoice: 342

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Intercepting Clipboard events
    By mnirahd in forum C and C++
    Replies: 1
    Last Post: 02-01-2011, 12:49 PM
  2. The Clipboard - VB.NET
    By Vswe in forum Visual Basic Tutorials
    Replies: 2
    Last Post: 11-13-2009, 08:14 AM
  3. Copy To Clipboard Help - Probably easy fix...
    By Souluna in forum JavaScript and CSS
    Replies: 1
    Last Post: 07-07-2009, 05:16 AM
  4. Clipboard
    By dirkfirst in forum C# Programming
    Replies: 3
    Last Post: 07-14-2006, 10:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts