Social Icons

Wednesday, 12 March 2014

Sudoku1.1

For free download click on download game                       Download Game

Sudoku, originally called Number Place, is a logic-based, combinatorial number-placement puzzle. The objective is to fill a 2×2 3×3 4×4... 9×9 and so on grid with digits so that each column, each row of the grid contains all of the digits either 2,3..or 9 according to the size of grid.The puzzle setter provides a partially completed grid, which for a well-posed puzzle has a unique solution.

This is Sudoku 1.1 you can really like it by playing this game.So play and enjoy the game soon you will play better then this version game the next version Sudoku1.2.


Note:- Here i introduce Sudoku of 4x4 so you have to fill the grid by number 1,2,3,4 only hence i locked the entire key board only backspace,tab and number key 1,2,3,4 will work.Other this will not work.
hence, you have to fill the grid so that the no number will repeat either in a same column and row.
you can set the difficulty levels according to your choice. here timer is also include so the you can check that how fast you can solve it.
After fill all blanks you can check that you are rite or wrong by clicking on Finish button.

now keep playing the game and enjoy.   


Download the game interface click on Download                       Download






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 sudoku
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public void reset()
        {

            textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text =
            textBox5.Text = textBox6.Text = textBox7.Text = textBox8.Text =
            textBox9.Text = textBox10.Text = textBox11.Text = textBox12.Text =
            textBox13.Text = textBox14.Text = textBox15.Text = textBox16.Text =
            textBox17.Text = "";

            textBox1.BackColor = textBox2.BackColor = textBox3.BackColor = textBox4.BackColor =
            textBox5.BackColor = textBox6.BackColor = textBox7.BackColor = textBox8.BackColor =
            textBox9.BackColor = textBox10.BackColor = textBox11.BackColor = textBox12.BackColor =
            textBox13.BackColor = textBox14.BackColor = textBox15.BackColor = textBox16.BackColor = Color.White;


            label5.Hide();
            label5.Text = "";
            label6.Hide();
            label1.Hide();
            i = 90;
            label3.Show();
            comboBox1.Show();
            button1.Show();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox17.Text == "")
                MessageBox.Show("Player Name Cannot be blank");
            else if(comboBox1.SelectedIndex < 0)
            {
                MessageBox.Show("Select dificulty level");
            }
            else
            {
                textBox1.ReadOnly = textBox2.ReadOnly = textBox3.ReadOnly = textBox4.ReadOnly =
                textBox5.ReadOnly = textBox6.ReadOnly = textBox7.ReadOnly = textBox8.ReadOnly =
                textBox9.ReadOnly = textBox10.ReadOnly = textBox11.ReadOnly = textBox12.ReadOnly =
                textBox13.ReadOnly = textBox14.ReadOnly = textBox15.ReadOnly = textBox16.ReadOnly = false;

                timer1.Enabled = true;
                timer1.Interval = 1000;
                label5.Show();
                label6.Show();
               
                if (comboBox1.SelectedIndex == 0)
                {
                    textBox1.Text = "4";
                    textBox1.ReadOnly = true;
                    textBox4.Text = "2";
                    textBox4.ReadOnly = true;
                    textBox6.Text = "3";
                    textBox6.ReadOnly = true;
                    textBox9.Text = "1";
                    textBox9.ReadOnly = true;
                    textBox16.Text = "1";
                    textBox16.ReadOnly = true;
                }
                else if (comboBox1.SelectedIndex == 1)
                {
                    textBox2.Text = "1";
                    textBox2.ReadOnly = true;                   
                    textBox4.Text = "2";
                    textBox4.ReadOnly = true;
                    textBox10.Text = "2";
                    textBox10.ReadOnly = true;
                    textBox13.Text = "3";
                    textBox13.ReadOnly = true;

                }
                else if (comboBox1.SelectedIndex == 2)
                {
                    textBox6.Text = "3";
                    textBox6.ReadOnly = true;                   
                    textBox12.Text = "3";
                    textBox12.ReadOnly = true;
                    textBox14.Text = "4";
                    textBox14.ReadOnly = true;
                }
                label3.Hide();
                comboBox1.Hide();
                button1.Hide();
            }
          
           
        }

        private void button3_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("\t  Are you Sure...", "Quit", MessageBoxButtons.YesNo);
            if (dialogResult == DialogResult.Yes)
            {
                this.Close();
            }
            else if (dialogResult == DialogResult.No)
            {

            }
           
        }

        private void button2_Click(object sender, EventArgs e)
        {
            reset();
        }

        private void button4_Click(object sender, EventArgs e)
        {

            textBox1.BackColor = textBox2.BackColor = textBox3.BackColor = textBox4.BackColor =
            textBox5.BackColor = textBox6.BackColor = textBox7.BackColor = textBox8.BackColor =
            textBox9.BackColor = textBox10.BackColor = textBox11.BackColor = textBox12.BackColor =
            textBox13.BackColor = textBox14.BackColor = textBox15.BackColor = textBox16.BackColor = Color.White;
            label1.Hide();

            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" ||
                textBox5.Text == "" || textBox6.Text == "" || textBox7.Text == "" || textBox8.Text == "" ||
                textBox9.Text == "" || textBox10.Text == "" || textBox11.Text == "" || textBox12.Text == "" ||
                textBox13.Text == "" || textBox14.Text == "" || textBox15.Text == "" || textBox16.Text == "")
            {
                MessageBox.Show("First fill all the blanks");
            }
            if (((Convert.ToInt32(textBox1.Text)) == 4) && ((Convert.ToInt32(textBox2.Text)) == 1) && ((Convert.ToInt32(textBox3.Text)) == 3) && ((Convert.ToInt32(textBox4.Text)) == 2) &&
                ((Convert.ToInt32(textBox5.Text)) == 2) && ((Convert.ToInt32(textBox6.Text)) == 3) && ((Convert.ToInt32(textBox7.Text)) == 1) && ((Convert.ToInt32(textBox8.Text)) == 4) &&
                ((Convert.ToInt32(textBox9.Text)) == 1) && ((Convert.ToInt32(textBox10.Text)) == 2) && ((Convert.ToInt32(textBox11.Text)) == 4) && ((Convert.ToInt32(textBox12.Text)) == 3) &&
                ((Convert.ToInt32(textBox13.Text)) == 3) && ((Convert.ToInt32(textBox14.Text)) == 4) && ((Convert.ToInt32(textBox15.Text)) == 2) && ((Convert.ToInt32(textBox16.Text)) == 1))
            {
                label1.Text = "Good... its a correct";
                label1.Show();               
                timer1.Stop();
                textBox1.BackColor = textBox2.BackColor = textBox3.BackColor = textBox4.BackColor =
                textBox5.BackColor = textBox6.BackColor = textBox7.BackColor = textBox8.BackColor =
                textBox9.BackColor = textBox10.BackColor = textBox11.BackColor = textBox12.BackColor =
                textBox13.BackColor = textBox14.BackColor = textBox15.BackColor = textBox16.BackColor = Color.Green;
            }
            else
            {

                label1.Text = "wrong attempt";
                label1.Show();
                timer1.Start();


                if ((Convert.ToInt32(textBox1.Text)) != 4)
                    textBox1.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox2.Text)) != 1)
                    textBox2.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox3.Text)) != 3)
                    textBox3.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox4.Text)) != 2)
                    textBox4.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox5.Text)) != 2)
                    textBox5.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox6.Text)) != 3)
                    textBox6.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox7.Text)) != 1)
                    textBox7.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox8.Text)) != 4)
                    textBox8.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox9.Text)) != 1)
                    textBox9.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox10.Text)) != 2)
                    textBox10.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox11.Text)) != 4)
                    textBox11.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox12.Text)) != 3)
                    textBox12.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox13.Text)) != 3)
                    textBox13.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox14.Text)) != 4)
                    textBox14.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox15.Text)) != 2)
                    textBox15.BackColor = Color.Red;
                if ((Convert.ToInt32(textBox16.Text)) != 1)
                    textBox16.BackColor = Color.Red;
               
            }
        }

      

        int i = 90;
        private void timer1_Tick(object sender, EventArgs e)
        {
            --i;
                label5.Text = i.ToString();
                if (i == 0)
                {
                    timer1.Stop();
                    MessageBox.Show("Times up... You Lose");
                    reset();
                }
           
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!(e.KeyChar >= 49 && e.KeyChar <= 52) && (e.KeyChar!=8) && (e.KeyChar!=11))
                e.Handled = true;
        }


    }
}

click here for free download Sudoku game - Download


                                                             Output

                

1 comment: