using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
class Program
{
static int[,] grid = new int[9, 9];
static string s;
static void Init(ref int[,] grid)
{
for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
grid[i, j] = (i * 3 + i / 3 + j) % 9 + 1;
}
}
static void Draw(ref int[,] grid, out string _s)
{
for (int x = 0; x < 9; x++)
{
for (int y = 0; y < 9; y++)
{
s += grid[x, y].ToString() + "";
}
s += "n";
}
Console.WriteLine(s);
_s = s;
s = "";
}
static void ChangeTwoCell(ref int[,] grid, int ZnajdzLiczbe1, int ZnajdzLiczbe2)
{
int xParam1, yParam1, xParam2, yParam2;
xParam1 = yParam1 = xParam2 = yParam2 = 0;
for (int i = 0; i < 9; i += 3)
{
for (int k = 0; k < 9; k += 3)
{
for (int j = 0; j < 3; j++)
{
for (int z = 0; z < 3; z++)
{
if (grid[i + j, k + z] == ZnajdzLiczbe1)
{
xParam1 = i + j;
yParam1 = k + z;
}
if (grid[i + j, k + z] == ZnajdzLiczbe2)
{
xParam2 = i + j;
yParam2 = k + z;
}
}
}
grid[xParam1, yParam1] = ZnajdzLiczbe2;
grid[xParam2, yParam2] = ZnajdzLiczbe1;
}
}
}
static void Ulepszenie(ref int [,] grid, int Przesuniecia)
{
for (int powtorka = 0; powtorka < Przesuniecia; powtorka++)
{
Random losowy = new Random(Guid.NewGuid().GetHashCode());
Random losowy1 = new Random(Guid.NewGuid().GetHashCode());
ChangeTwoCell(ref grid, losowy.Next(1, 9), losowy1.Next(1, 9));
}
}
[STAThread]
static void Main(string[] args)
{
Console.BackgroundColor = ConsoleColor.Blue;
s = "";
string click1;
Init(ref grid);
Ulepszenie(ref grid, 10);
Draw(ref grid, out click1);
System.Windows.Forms.Clipboard.SetText(click1);
Console.ReadKey();
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}