網路城邦
回本城市首頁 翠華流
市長:ABay  副市長: -Uncle-
加入本城市推薦本城市加入我的最愛訂閱最新文章
udn城市人文藝術藝術天地【翠華流】城市/討論區/
討論區不分版 字體:
看回應文章  上一個討論主題 回文章列表 下一個討論主題
拼圖遊戲
 瀏覽1,937|回應7推薦9

ABay
等級:8
留言加入好友
文章推薦人 (9)

秋武
-Uncle-
蘭 陵
春山影
紅粉豹
曳白
高月:流觴亭阿9(九)公然侮辱
三川一秀:阿九(9)違法侵入者
ABay

引用文章益智遊戲

昨天設計完25格數字方塊,

加個變化,立刻變成拼圖啦!

既然是拼圖,就有一定的解答,所以在拼出來的時候,

會跳出「GOOD JOB」的訊息~

按此下載TITANIC拼圖


回應 回應給此人 推薦文章 列印 加入我的文摘

引用
引用網址:https://city.udn.com/forum/trackback.jsp?no=59309&aid=3926282
 回應文章
市場大
    回應給: ABay(Piner) 推薦6


-Uncle-
等級:7
留言加入好友

 
文章推薦人 (6)

曳白
春山影
高月:流觴亭阿9(九)公然侮辱
秋武
-Uncle-
蘭 陵

遊戲類
回應 回應給此人 推薦文章 列印 加入我的文摘
引用網址:https://city.udn.com/forum/trackback.jsp?no=59309&aid=3927557
TITANIC拼圖程式碼
推薦9


ABay
等級:8
留言加入好友

 
文章推薦人 (9)

曳白
高月:流觴亭阿9(九)公然侮辱
秋武
蘭 陵
-Uncle-
鳳彩翎:阿9公然侮辱
春山影
紅粉豹
ABay

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        Image[] image = new Image[25];
        Panel[] panel = new Panel[25];
        Random rd = new Random();
        Point[] LegalMove = new Point[]
        {
            new Point(0,1), new Point(0,5),
            new Point(1,0), new Point(1,2), new Point(1,6),
            new Point(2,1), new Point(2,3), new Point(2,7),
            new Point(3,2), new Point(3,4), new Point(3,8),
            new Point(4,3), new Point(4,9),
            new Point(5,0), new Point(5,6), new Point(5,10),
            new Point(6,1), new Point(6,5), new Point(6,7), new Point(6,11),
            new Point(7,2), new Point(7,6), new Point(7,8), new Point(7,12),
            new Point(8,3), new Point(8,7), new Point(8,9), new Point(8,13),
            new Point(9,4), new Point(9,8), new Point(9,14),
            new Point(10,5), new Point(10,11), new Point(10,15),
            new Point(11,6), new Point(11,10), new Point(11,12), new Point(11,16),
            new Point(12,7), new Point(12,11), new Point(12,13), new Point(12,17),
            new Point(13,8), new Point(13,12), new Point(13,14), new Point(13,18),
            new Point(14,9), new Point(14,13), new Point(14,19),
            new Point(15,10), new Point(15,16), new Point(15,20),
            new Point(16,11), new Point(16,15), new Point(16,17), new Point(16,21),
            new Point(17,12), new Point(17,16), new Point(17,18), new Point(17,22),
            new Point(18,13), new Point(18,17), new Point(18,19), new Point(18,23),
            new Point(19,14), new Point(19,18), new Point(19,24),
            new Point(20,15), new Point(20,21),
            new Point(21,16), new Point(21,20), new Point(21,22),
            new Point(22,17), new Point(22,21), new Point(22,23),
            new Point(23,18), new Point(23,22), new Point(23,24),
            new Point(24,19), new Point(24,23)
        };
        int Count = 0;
       
        public Form1()
        {
            InitializeComponent();
            image[0] = null;
            image[1] = new Bitmap(Properties.Resources.T01);
            image[2] = new Bitmap(Properties.Resources.T02);
            image[3] = new Bitmap(Properties.Resources.T03);
            image[4] = new Bitmap(Properties.Resources.T04);
            image[5] = new Bitmap(Properties.Resources.T05);
            image[6] = new Bitmap(Properties.Resources.T06);
            image[7] = new Bitmap(Properties.Resources.T07);
            image[8] = new Bitmap(Properties.Resources.T08);
            image[9] = new Bitmap(Properties.Resources.T09);
            image[10] = new Bitmap(Properties.Resources.T10);
            image[11] = new Bitmap(Properties.Resources.T11);
            image[12] = new Bitmap(Properties.Resources.T12);
            image[13] = new Bitmap(Properties.Resources.T13);
            image[14] = new Bitmap(Properties.Resources.T14);
            image[15] = new Bitmap(Properties.Resources.T15);
            image[16] = new Bitmap(Properties.Resources.T16);
            image[17] = new Bitmap(Properties.Resources.T17);
            image[18] = new Bitmap(Properties.Resources.T18);
            image[19] = new Bitmap(Properties.Resources.T19);
            image[20] = new Bitmap(Properties.Resources.T20);
            image[21] = new Bitmap(Properties.Resources.T21);
            image[22] = new Bitmap(Properties.Resources.T22);
            image[23] = new Bitmap(Properties.Resources.T23);
            image[24] = new Bitmap(Properties.Resources.T24);
           
            panel[0] = panel0;
            panel[1] = panel1;
            panel[2] = panel2;
            panel[3] = panel3;
            panel[4] = panel4;
            panel[5] = panel5;
            panel[6] = panel6;
            panel[7] = panel7;
            panel[8] = panel8;
            panel[9] = panel9;
            panel[10] = panel10;
            panel[11] = panel11;
            panel[12] = panel12;
            panel[13] = panel13;
            panel[14] = panel14;
            panel[15] = panel15;
            panel[16] = panel16;
            panel[17] = panel17;
            panel[18] = panel18;
            panel[19] = panel19;
            panel[20] = panel20;
            panel[21] = panel21;
            panel[22] = panel22;
            panel[23] = panel23;
            panel[24] = panel24;

            button1_click(this, null);
        }
        private void button1_click(object sender, EventArgs e)
        {
            for (int i = 0; i <= 24; i++)
                panel[i].Tag = i;
            int k1, k2, t;
            for (int i = 0; i <= 20; i++)
            {
                k1 = rd.Next(25);
                k2 = rd.Next(25);
                t = (int)panel[k1].Tag;
                panel[k1].Tag = panel[k2].Tag;
                panel[k2].Tag = t;
            }

            for (int i = 0; i <= 24; i++)
                panel[i].BackgroundImage = image[(int)panel[i].Tag];
            Count = 0;
            label1.Text = Count.ToString();
            for (int i = 0; i <= 24; i++)
                panel[i].Enabled = true;
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void panel0_Click(object sender, EventArgs e)
        {
            Panel x = (Panel)sender;
            int SelectedPanelNo = 0;
            for (int i = 0; i <= 24; i++)
            {
                if (panel[i] == x)
                {
                    SelectedPanelNo = i;
                    break;
                }
            }
            int EmptyPanelNo = 0;
            for (int i = 0; i <= 24; i++)
            {
                if ((int)panel[i].Tag == 0)
                {
                    EmptyPanelNo = i;
                    break;
                }
            }

            int k;
            for(int i= 0; i<80; i++)
            {
                if(LegalMove[i].X == SelectedPanelNo && LegalMove[i].Y == EmptyPanelNo)
                {
                    Count++;
                    label1.Text = Count.ToString();
                    k = (int)panel[SelectedPanelNo].Tag;
                    panel[SelectedPanelNo].Tag = panel[EmptyPanelNo].Tag;
                    panel[EmptyPanelNo].Tag = k;
                    panel[SelectedPanelNo].BackgroundImage = image[(int)panel[SelectedPanelNo].Tag];
                    panel[EmptyPanelNo].BackgroundImage = image[(int)panel[EmptyPanelNo].Tag];
                    break;
                }
            }
            if ((int)panel[0].Tag == 1 && (int)panel[1].Tag == 2 && (int)panel[2].Tag == 3 && (int)panel[3].Tag == 4 && (int)panel[4].Tag == 5 &&
                (int)panel[5].Tag == 6 && (int)panel[6].Tag == 7 && (int)panel[7].Tag == 8 && (int)panel[8].Tag == 9 && (int)panel[9].Tag == 10 &&
                (int)panel[10].Tag == 11 && (int)panel[11].Tag == 12 && (int)panel[12].Tag == 13 && (int)panel[13].Tag == 14 && (int)panel[14].Tag == 15 &&
                (int)panel[15].Tag == 16 && (int)panel[16].Tag == 17 && (int)panel[17].Tag == 18 && (int)panel[18].Tag == 19 && (int)panel[19].Tag == 20 &&
                (int)panel[20].Tag == 21 && (int)panel[21].Tag == 22 && (int)panel[22].Tag == 23 && (int)panel[23].Tag == 24)
            {
                for (int i = 0; i <= 24; i++)
                    panel[i].Enabled = false;
                MessageBox.Show("GOOD JOB");
            }
        }
    }
}

回應 回應給此人 推薦文章 列印 加入我的文摘
引用網址:https://city.udn.com/forum/trackback.jsp?no=59309&aid=3926540
市長我要程式碼(3贏)
    回應給: ABay(Piner) 推薦8


高月:流觴亭阿9(九)公然侮辱
等級:7
留言加入好友

 
文章推薦人 (8)

秋武
蘭 陵
-Uncle-
鳳彩翎:阿9公然侮辱
春山影
紅粉豹
曳白
高月:流觴亭阿9(九)公然侮辱

回應 回應給此人 推薦文章 列印 加入我的文摘
引用網址:https://city.udn.com/forum/trackback.jsp?no=59309&aid=3926420
雙贏
    回應給: ABay(Piner) 推薦7


osami
等級:
留言加入好友

 
文章推薦人 (7)

秋武
蘭 陵
-Uncle-
鳳彩翎:阿9公然侮辱
春山影
紅粉豹
高月:流觴亭阿9(九)公然侮辱

象棋麻將XD
回應 回應給此人 推薦文章 列印 加入我的文摘
引用網址:https://city.udn.com/forum/trackback.jsp?no=59309&aid=3926399
象棋
    回應給: 千葉修身(osami) 推薦9


三川一秀:阿九(9)違法侵入者
等級:7
留言加入好友

 
文章推薦人 (9)

秋武
蘭 陵
-Uncle-
鳳彩翎:阿9公然侮辱
春山影
紅粉豹
曳白
高月:流觴亭阿9(九)公然侮辱
三川一秀:阿九(9)違法侵入者

象棋比較有用
回應 回應給此人 推薦文章 列印 加入我的文摘
引用網址:https://city.udn.com/forum/trackback.jsp?no=59309&aid=3926393
國粹
    回應給: 三川一秀(kazuhide) 推薦9


osami
等級:
留言加入好友

 
文章推薦人 (9)

秋武
蘭 陵
-Uncle-
鳳彩翎:阿9公然侮辱
春山影
紅粉豹
曳白
高月:流觴亭阿9(九)公然侮辱
三川一秀:阿九(9)違法侵入者

回應 回應給此人 推薦文章 列印 加入我的文摘
引用網址:https://city.udn.com/forum/trackback.jsp?no=59309&aid=3926389
可以用相片做嗎?
    回應給: ABay(Piner) 推薦9


三川一秀:阿九(9)違法侵入者
等級:7
留言加入好友

 
文章推薦人 (9)

秋武
蘭 陵
-Uncle-
鳳彩翎:阿9公然侮辱
春山影
紅粉豹
曳白
高月:流觴亭阿9(九)公然侮辱
三川一秀:阿九(9)違法侵入者

引用文章請教
回應 回應給此人 推薦文章 列印 加入我的文摘
引用網址:https://city.udn.com/forum/trackback.jsp?no=59309&aid=3926367