Jump to content

The under 100 line challenge!

fletch to 99

Shouldn't there be a simpler way to do this rather than using a bunch of cases?

 

Something like Dictionary or HashMap maybe?

~meOw! Σ:3

Link to comment
Share on other sites

Link to post
Share on other sites

@Echo off

echo Hello World!

pause

Thats that. If you need to get in touch chances are you can find someone that knows me that can get in touch.

Link to comment
Share on other sites

Link to post
Share on other sites

This is  a MATLAB code to convert an input string to Morse code.

disp('This is a MATLAB® CODE');

disp('to display a text to Mores Code...');

x=input('Enter your TexT\n=','s');

fs=input('Sampling Frequency\n=');

N=length(x);   v=0:1/fs:1;  v1=0;  v2=1;  time=[];  MORSE_CODE=[];  SYMBOLIC=[]; d='-';  f='.';

y=1*ones(1,length(v));n=0*ones(1,length(v));

for i=1:N;

    v=[v1:1/fs:v2];

    if x(i)==('A')

        MORSE_CODE=[MORSE_CODE y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d f d d d d f f f];

    elseif x(i)==('B')

        MORSE_CODE=[MORSE_CODE y y y n y n y n y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d f d f d f f f];

    elseif x(i)==('C')

        MORSE_CODE=[MORSE_CODE y y y n y n y y y n y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d f d d d f d f f f];         

    elseif x(i)==('D')

        MORSE_CODE=[MORSE_CODE y y y n y n y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d f d f f f];

    elseif x(i)==('E')

        MORSE_CODE=[MORSE_CODE y n n n];

        SYMBOLIC=[sYMBOLIC d f f f];

    elseif x(i)==('F')

        MORSE_CODE=[MORSE_CODE y n y n y y y n y n n n];

        SYMBOLIC=[sYMBOLIC d f d f d d d f d f f f];

    elseif x(i)==('G')         

        MORSE_CODE=[MORSE_CODE y y y n y y y n y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d d d f d f f f];

    elseif x(i)==('H')

        MORSE_CODE=[MORSE_CODE y n y n y n y  n n n];

        SYMBOLIC=[sYMBOLIC d f d f d f d f f f];

    elseif x(i)==('I')

        MORSE_CODE=[MORSE_CODE y n y n n n];

        SYMBOLIC=[sYMBOLIC d f d f f f];

    elseif x(i)==('J')

        MORSE_CODE=[MORSE_CODE y n y y y n y y y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d f d d d f d d d f d d d f f f];

    elseif x(i)==('K')

        MORSE_CODE=[MORSE_CODE y y y n y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d f d d d f f f];

    elseif x(i)==('L')

        MORSE_CODE=[MORSE_CODE y n y y y n y n y n n n];

        SYMBOLIC=[sYMBOLIC d f d d d f d f d f f f];

    elseif x(i)==('M')

        MORSE_CODE=[MORSE_CODE y y y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d d d f f f];

    elseif x(i)==('N')

        MORSE_CODE=[MORSE_CODE y y y n y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d f f f];

    elseif x(i)==('O')

        MORSE_CODE=[MORSE_CODE y y y n y y y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d d d f d d d f f f];

    elseif x(i)==('P')

        MORSE_CODE=[MORSE_CODE y n y y y n y y y n y n n n];

        SYMBOLIC=[sYMBOLIC d f d d d f d d d f d f f f];

    elseif x(i)==('Q')

        MORSE_CODE=[MORSE_CODE y y y n y y y n y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d d d f d f d d d f f f];

    elseif x(i)==('R')

        MORSE_CODE=[MORSE_CODE y n y y y n y n n n];

        SYMBOLIC=[sYMBOLIC d f d d d f d f f f];

    elseif x(i)==('S')

        MORSE_CODE=[MORSE_CODE y n y n y n n n];

        SYMBOLIC=[sYMBOLIC d f d f d f f f];

    elseif x(i)==('T')

        MORSE_CODE=[MORSE_CODE y y y n n n];

        SYMBOLIC=[sYMBOLIC d d d f f f];

    elseif x(i)==('U')

        MORSE_CODE=[MORSE_CODE y n y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d f d f d d d f f f];

    elseif x(i)==('V')

        MORSE_CODE=[MORSE_CODE y n y n y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d f d f d f d d d f f f];

    elseif x(i)==('W')

        MORSE_CODE=[MORSE_CODE y n y n y y y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d f d f d d d f d d d f f f];

    elseif x(i)==('X')

        MORSE_CODE=[MORSE_CODE y y y n y n y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d f d f d d d f f f];

    elseif x(i)==('Y')

        MORSE_CODE=[MORSE_CODE y y y n y n y y y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d f d d d f d d d f f f];

    elseif x(i)==('Z')

        MORSE_CODE=[MORSE_CODE y y y n y y y n y n y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d d d f d f d f f f];

    elseif x(i)==('_')

        MORSE_CODE=[MORSE_CODE n n n n n n n];

        SYMBOLIC=[sYMBOLIC f f f f f f f];

    elseif x(i)==('1')

        MORSE_CODE=[MORSE_CODE y n y y y n y y y n y y y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d f d d d f d d d f d d d f d d d f f f];

    elseif x(i)==('2')

        MORSE_CODE=[MORSE_CODE y n y n y y y n y y y n y y y n n n];

        SYMOLIC=[sYMBOLIC d f d f d d d f d d d f d d d f f f];

    elseif x(i)==('3')

        MORSE_CODE=[MORSE_CODE y n y n y n y y y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d f d f d f d d d f d d d f f f];

    elseif x(i)==('4')

        MORSE_CODE=[MORSE_CODE y n y n y n y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d f d f d f d f d d d f f f];

    elseif x(i)==('5')

        MORSE_CODE=[MORSE_CODE y n y n y n y n y n n n];

        SYMBOLIC=[sYMBOLIC d f d f d f d f d f f f];

    elseif x(i)==('6')

        MORSE_CODE=[MORSE_CODE y y y n y n y n y n y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d f d f d f d f f f];

    elseif x(i)==('7')

        MORSE_CODE=[MORSE_CODE y y y n y y y n y n y n y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d d d f d f d f d f f f];

    elseif x(i)==('8')

        MORSE_CODE=[MORSE_CODE y y y n y y y n y y y n y n y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d d d f d d d f d f d f f f];

    elseif x(i)==('9')

        MORSE_CODE=[MORSE_CODE y y y n y y y n y y y n y y y n y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d d d f d d d f d d d f d f f f];

    elseif x(i)==('0')

        MORSE_CODE=[MORSE_CODE y y y n y y y n y y y n y y y n y y y n n n];

        SYMBOLIC=[sYMBOLIC d d d f d d d f d d d f d d d f d d d f f f];

       v1=v1+1; v2=v2+1; 

       time=[time v];

    end

end

figure(1)

whitebg(figure(1),'black');

plot(1:length(MORSE_CODE),MORSE_CODE,'w','Linewidth',1.5);

title(x);

axis([0 length(MORSE_CODE) -2 3]);

grid;

x

SYMBOLIC

 

 

and this is an exmaple of the output

 

http://postimg.org/image/wpx818utf/

 

[L I N U S _ T E C H _ T I P S]

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

i love the idea of the challenge but i think youd have to define lines a bit more and maybe say under 100 commands. also what if you include online services that feed you data or something like that ? but all together i really like the idea im definitly gonna start looking through my stuff make something up

"You know it'll clock down as soon as it hits 40°C, right?" - "Yeah ... but it doesnt hit 40°C ... ever  😄"

 

GPU: MSI GTX1080 Ti Aero @ 2 GHz (watercooled) CPU: Ryzen 5600X (watercooled) RAM: 32GB 3600Mhz Corsair LPX MB: Gigabyte B550i PSU: Corsair SF750 Case: Hyte Revolt 3

 

Link to comment
Share on other sites

Link to post
Share on other sites

i love the idea of the challenge but i think youd have to define lines a bit more and maybe say under 100 commands. also what if you include online services that feed you data or something like that ? but all together i really like the idea im definitly gonna start looking through my stuff make something up

 

I think 100 lines (of somewhat readable code) is the better way to go.

Or how would you define 100 commands?

Mini-Desktop: NCASE M1 Build Log
Mini-Server: M350 Build Log

Link to comment
Share on other sites

Link to post
Share on other sites

I think 100 lines (of somewhat readable code) is the better way to go.

Or how would you define 100 commands?

well in C# you seperate commands by ; 

so id say 100 of those and then maybe count if, switch, ... and those as 1 command even though they may take up more lines for readability

but as this may not apply to other languages like G maybe have different rules i just feel like the rules have to be a little more strictly defined

"You know it'll clock down as soon as it hits 40°C, right?" - "Yeah ... but it doesnt hit 40°C ... ever  😄"

 

GPU: MSI GTX1080 Ti Aero @ 2 GHz (watercooled) CPU: Ryzen 5600X (watercooled) RAM: 32GB 3600Mhz Corsair LPX MB: Gigabyte B550i PSU: Corsair SF750 Case: Hyte Revolt 3

 

Link to comment
Share on other sites

Link to post
Share on other sites

Using scroll lock LED as a CPU usage indicator. Used an extra dll because Microsoft's built-in one didn't work.

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Diagnostics;using System.Threading;using WindowsInput;namespace SLIM{    class Program    {        static void Main(string[] args)        {            int CPUMinLim = 50;            int CPUMaxLim = 75;            int CPUMinSleep = 500;            int CPUMaxSleep = 250;            int CMinLIParse;            int CMaxLIParse;            int MinSleepDurParse;            int MaxSleepDurParse;            Console.WriteLine("Options:");            Console.WriteLine();            Console.Write("CPU Low limit [DEFAULT=50]:");            string CPUMinLimitInput = Console.ReadLine();            int.TryParse(CPUMinLimitInput, out CMinLIParse);            CPUMinLim = CMinLIParse;            Console.Write("CPU High limit [DEFAULT=75]:");            string CPUMaxLimitInput = Console.ReadLine();            int.TryParse(CPUMaxLimitInput, out CMaxLIParse);            CPUMaxLim = CMaxLIParse;            Console.Write("Slow blink sleep duration (ms) [DEFAULT=500]:");            string MinSleepDur = Console.ReadLine();            int.TryParse(MinSleepDur, out MinSleepDurParse);            CPUMinSleep = MinSleepDurParse;            Console.Write("Fast blink sleep duration (ms) [DEFAULT=250]:");            string MaxSleepDur = Console.ReadLine();            int.TryParse(MaxSleepDur, out MaxSleepDurParse);            CPUMaxSleep = MaxSleepDurParse;            if (CMinLIParse == 0 | CMinLIParse > 100)            {CPUMinLim = 50;}            if (CMaxLIParse == 0 | CMaxLIParse > 100)            {CPUMaxLim = 75;}            if (MinSleepDurParse == 0)            {CPUMinSleep = 500;}            if (MaxSleepDurParse == 0)            {CPUMaxSleep = 250;}            Console.Clear();            PerformanceCounter perfCPUCount = new PerformanceCounter("Processor Information", "% Processor Time", "_Total");                      while (true)            {                float CPULoad = perfCPUCount.NextValue();                               Console.WriteLine("Current CPU load = {0}%", (int)CPULoad);                if (CPULoad > CPUMaxLim)                {                    WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                    Thread.Sleep(CPUMaxSleep);                    WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                    Thread.Sleep(CPUMaxSleep);                    WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                    Thread.Sleep(CPUMaxSleep);                    WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                    Thread.Sleep(CPUMaxSleep);                    WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                    Thread.Sleep(CPUMaxSleep);                    WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                    Thread.Sleep(CPUMaxSleep);                    WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                    Thread.Sleep(CPUMaxSleep);                    WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                }                                            else if (CPULoad > CPUMinLim)                    {                                                WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                        Thread.Sleep(CPUMinSleep);                        WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                        Thread.Sleep(CPUMinSleep);                        WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                        Thread.Sleep(CPUMinSleep);                        WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                        Thread.Sleep(CPUMinSleep);                        WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                        Thread.Sleep(CPUMinSleep);                        WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                        Thread.Sleep(CPUMinSleep);                        WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                        Thread.Sleep(CPUMinSleep);                        WindowsInput.InputSimulator.SimulateKeyPress(VirtualKeyCode.SCROLL);                    }                                    Thread.Sleep(1000);                Console.Clear();            }         }    }}

Asrock 890GX Extreme 3 - AMD Phenom II X4 955 @3.50GHz - Arctic Cooling Freezer XTREME Rev.2 - 4GB Kingston HyperX - AMD Radeon HD7850 - Kingston V300 240GB - Samsung Spinpoint F3 1TB - Chieftec APS-750 - Cooler Master HAF912 PLUS


osu! profile

Link to comment
Share on other sites

Link to post
Share on other sites

well in C# you seperate commands by ; 

so id say 100 of those and then maybe count if, switch, ... and those as 1 command even though they may take up more lines for readability

but as this may not apply to other languages like G maybe have different rules i just feel like the rules have to be a little more strictly defined

but then you would have to forbid anykind of libraries.

or the use of '&' and '|'

and so on ...

I think more loose rules are the way to go.

Just about 100 lines of readable code.

Mini-Desktop: NCASE M1 Build Log
Mini-Server: M350 Build Log

Link to comment
Share on other sites

Link to post
Share on other sites

Going to preface by saying that it's more than 100 lines :-). I implemented the Smith-Waterman algorithnm used for local sequence alignment of DNA strings to score the difference between given DNA strings and find the best match. The program takes a DNA sequence and a file of sequences to compare to the given sequence.

import java.io.*;import java.lang.Math;class Alignment{	public static final int GAP_SCORE = -3;		public static int[][] similar = null;	public static int[][] align = null;	public static int slen_1, slen_2;	public static int bestVal, best_x, best_y;	public static int f_score;	public static String f1, f2;	public static void makeSimilarityMatrix()	{		similar = new int[ 4 ][ 4 ];				similar[ 0 ][ 0 ] = 10 ;		similar[ 1 ][ 0 ] = -1 ;		similar[ 2 ][ 0 ] = -3 ;		similar[ 3 ][ 0 ] = -4 ;		similar[ 0 ][ 1 ] = -1 ;		similar[ 1 ][ 1 ] = 7 ;		similar[ 2 ][ 1 ] = -5 ;		similar[ 3 ][ 1 ] = -3 ;		similar[ 0 ][ 2 ] = -3 ;		similar[ 1 ][ 2 ] = -5 ;		similar[ 2 ][ 2 ] = 9 ;		similar[ 3 ][ 2 ] = 0 ;		similar[ 0 ][ 3 ] = -4 ;		similar[ 1 ][ 3 ] = -3 ;		similar[ 2 ][ 3 ] = 0 ;		similar[ 3 ][ 3 ] = 8 ;	}		public static void printMatrix( int[][] matrix, String seq1, String seq2, int max_x, int max_y, boolean align )	{		if(align)		{				for(int x = 0; x < slen_1; x++)				System.out.print( "\t" + seq1.charAt(x) );					System.out.println(" ");		}			for(int y = (align ? 1 : 0); y < max_y; y++)		{			System.out.print( seq2.charAt(y - (align ? 1 : 0) )  + "\t");							for(int x = (align ? 1 : 0); x < max_x; x++)			{				System.out.print( matrix[x][y] + "\t" );			}			System.out.println("");		}	}		public static void calculateMatrix( String seq1, String seq2 )	{		int choices[] = new int[3];				align = new int[ slen_1 + 1 ][ slen_2 + 1 ];				for(int x = 0; x < slen_1; x++)			align[x][0] = GAP_SCORE * x;				for(int y = 0; y < slen_2; y++)			align[0][y] = GAP_SCORE * y;				for(int x = 1; x <= slen_1; x++)			for(int y = 1; y <= slen_2; y++)			{				choices[0] = align[ x - 1 ][ y - 1 ] + similar[ getVal( seq1, x-1) ][ getVal( seq2, y-1) ];				choices[1] = align[x - 1][y] + GAP_SCORE;				choices[2] = align[x][y - 1] + GAP_SCORE;				align[x][y] = getMax( choices );				if ( align[x][y] > bestVal )				{					bestVal = align[x][y]; // Don't forget the GAP_SCORE padding					best_x = x;					best_y = y;				}			}	}		public static int getMax( int[] in ) // Get max or return 0;	{		return Math.max( Math.max( in[0], in[1]), Math.max( in[2], 0 ) );	}		public static int getVal(String seq, int index)	{		switch (seq.charAt(index))		{				case 'A': return 0;				case 'G': return 1;				case 'C': return 2;				case 'T': return 3;		}		return -1;	}	public static void showPath(String s1, String s2, boolean recordBest)	{		String new_s1 = "", new_s2 = "";		int i = slen_1, j = slen_2;		int score = 0, score_diag = 0, score_up = 0, score_left = 0;				while( i > 0 && j > 0 )		{			score = align[i][j];			score_diag = align[i - 1][j - 1];			score_up = align[i][j - 1];			score_left = align[i - 1][j];			if(score == 0) // Dead End				break;						if( score == score_diag + similar[ getVal( s1, i-1) ][ getVal( s2, j-1) ] ) // Going Diag			{				new_s1 = s1.charAt(i-1) + new_s1;				new_s2 = s2.charAt(j-1) + new_s2;				i--;				j--;			}						else if( score == score_left + GAP_SCORE ) // Going Left			{				new_s1 = s1.charAt(i-1) + new_s1;				new_s2 = "-" + new_s2;				i--;			}			else if( score == score_up + GAP_SCORE ) // Going Up			{				new_s1 = "-" + new_s1;				new_s2 = s2.charAt(j-1) + new_s2;				j--;			}			}		if(recordBest)		{			f1 = new_s1;			f2 = new_s2;		}		System.out.println( new_s1 );		System.out.println( new_s2 );	}		public static void main(String[] args) throws IOException	{		f1 = "";		f2 = "";		f_score = 0;		if( args.length < 2 )		{			System.out.println( "Usage: java Alignment <sequence> <filename>" );			return;		}		BufferedReader linereader;		try		{			linereader = new BufferedReader(new FileReader(args[1]));		}		catch(FileNotFoundException e)		{			System.out.println("Error, file [" + args[1] + "] was not found!");			return;		}		String seq1 = "";		String seq2 = args[0]; // Input sequence		slen_2 = seq2.length();				// Fill and Print Similarity Matrix		makeSimilarityMatrix ( );				System.out.println("\nSimilarity Matrix : ");		printMatrix( similar, "    ", "    ", 4, 4, false);		while( (seq1 = linereader.readLine()) != null)		{			// Initialize Values			slen_1 = seq1.length();			bestVal = 0;			best_x = 0;			best_y = 0;					// Fill and print Alignment Matrix			System.out.println("\nAlignment Matrix : ");			calculateMatrix( seq1, seq2 );			printMatrix( align, seq1, seq2, slen_1 + 1, slen_2 + 1 , true);			// Record Best Score			if( bestVal > f_score )			{				f_score = bestVal;				System.out.println("\nScore: " + bestVal + " [" + best_x +"][" + best_y + "]\n");				showPath( seq1, seq2, true);			}			else			{				System.out.println("\nScore: " + bestVal + " [" + best_x +"][" + best_y + "]\n");				showPath( seq1, seq2, false);			}		}				System.out.println("=====================================");		System.out.println("Best Score: " + f_score);		System.out.println(" " + f1 + "\n " + f2);	}}
Link to comment
Share on other sites

Link to post
Share on other sites

 

Using scroll lock LED as a CPU usage indicator. Used an extra dll because Microsoft's built-in one didn't work.

-snip-

 

Can you maybe upload the complete program? I actually want to see this thing working, but i'm a noob when it comes to programming and i have no idea how that extra dll stuff works :P

If you want my attention, quote meh! D: or just stick an @samcool55 in your post :3

Spying on everyone to fight against terrorism is like shooting a mosquito with a cannon

Link to comment
Share on other sites

Link to post
Share on other sites

Can you maybe upload the complete program? I actually want to see this thing working, but i'm a noob when it comes to programming and i have no idea how that extra dll stuff works :P

Uploaded it to GDrive - https://drive.google.com/file/d/0B9Ckovtr_Ex3U3VpX2tBVGdyeTA/view?usp=sharing

Asrock 890GX Extreme 3 - AMD Phenom II X4 955 @3.50GHz - Arctic Cooling Freezer XTREME Rev.2 - 4GB Kingston HyperX - AMD Radeon HD7850 - Kingston V300 240GB - Samsung Spinpoint F3 1TB - Chieftec APS-750 - Cooler Master HAF912 PLUS


osu! profile

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks man! Works like a dream, really like it ^^

If you want my attention, quote meh! D: or just stick an @samcool55 in your post :3

Spying on everyone to fight against terrorism is like shooting a mosquito with a cannon

Link to comment
Share on other sites

Link to post
Share on other sites

Here's a Rubik's cube solver. It solves it by using the method I use when solving a cube blindfolded so it's by no means efficient (it's so inefficient I usually screw up trying to go through the solution.) 

algorithms = {'T' : "R U R' U' R' F R2 U' R' U' R U R' F'", 'Y' : "R U' R' U' R U R' F' R U R' U' R' F R", 'Jb': "R U R' F' R U R' U' R' F R2 U' R' U'",'Ja': "F U' R' F R2 U' R' U' R U R' F' R U R' F'",'parity' : "Ja T Ja"}setupAlgs = {'z':'z','B':"R D' Y D R'", 'C':"F Y F'", 'D':"F R' Y R F'", 'F':"F2 Y F2", 'G':"D2 R Y R' D2", 'H':"D2 Y D2", 'I':"F' D Y D' F", 'J':"F2 D Y D' F2", 'K':"F D Y D' F'", 'L':"D Y D'", 'M':"R' Y R", 'N':"R2 Y R2",'O':"R Y R'", 'P':"Y", 'Q':"R' F Y F' R", 'S':"D' R Y R' D", 'T':"D' Y D", 'U':"F' Y F", 'V':"F' R' Y R F", 'W':"R2 F Y F' R2", 'X':"D F' Y F D'",'a':"Ja", 'c':"Jb", 'd':"T", 'e':"L' U B' U' T U B U' L", 'f':"U' F U T U' F' U", 'g':"D M' Jb M D'", 'h':"U B' U' T U B U'", 'i':"M' Ja M", 'j':"U2 R U2 T U2 R' U2", 'k':"M' Jb M", 'l':"L' T L", 'n':"U B U' T U B' U'", 'o':"D' M' Jb M D", 'p':"U' F' U T U' F U", 'q':"M Jb M'", 'r':"L T L'", 's':"M Ja M'", 't':"U2 R' U2 T U2 R U2", 'u':"M2 Ja M2", 'v':"D2 L2 T L2 D2", 'w':"M2 Jb M2", 'x':"L2 T L2"}def getCornerPos(colors, centers):	top = centers['cu'] in colors	left = centers['cl'] in colors	front = centers['cf'] in colors	return 3 if top and front and left else 0 if left and top else 2 if front and top else 1 if top else 4 if front and left else 7 if left else 5 if front else 6def getEdgePos(colors, centers):	top = centers['cu'] in colors	left = centers['cl'] in colors	front = centers['cf'] in colors	right = centers['cr'] in colors	down = centers['cd'] in colors	return 3 if top and left else 1 if top and right else 2 if top and front else 0 if top else 11 if down and left else 9 if down and right else 8 if down and front else 10 if down else 7 if left and front else 4 if left else 6 if front else 5def getCornerStickerLetter(colors, cornerPos, centers):	top = centers['cu'] in colors	left = centers['cl'] in colors	front = centers['cf'] in colors	right = centers['cr'] in colors	down = centers['cd'] in colors	return 'A' if cornerPos == 0 and top else 'E' if cornerPos == 0 and left else 'R' if cornerPos == 0 else 'B' if cornerPos == 1 and top else 'N' if cornerPos == 1 and right else 'Q' if cornerPos == 1 else 'C' if cornerPos == 2 and top else 'J' if cornerPos == 2 and front else 'M' if cornerPos == 2 else 'D' if cornerPos == 3 and top else 'F' if cornerPos == 3 and left else 'I' if cornerPos == 3 else 'U' if cornerPos == 4 and down else 'G' if cornerPos == 4 and left else 'L' if cornerPos == 4 else 'V' if cornerPos == 5 and down else 'K' if cornerPos == 5 and front else 'P' if cornerPos == 5 else 'W' if cornerPos == 6 and down else 'O' if cornerPos == 6 and right else 'T' if cornerPos == 6 else 'X' if down else 'H' if left else 'S'def getEdgeStickerLetter(colors, edgePos, centers):	top = centers['cu'] in colors	left = centers['cl'] in colors	front = centers['cf'] in colors	right = centers['cr'] in colors	down = centers['cd'] in colors	return 'a' if edgePos == 0 and top else 'q' if edgePos == 0 else 'b' if edgePos == 1 and top else 'm' if edgePos == 1 else 'c' if edgePos == 2 and top else 'i' if edgePos == 2 else 'd' if edgePos == 3 and top else 'e' if edgePos == 3 else 'h' if edgePos == 4 and left else 'r' if edgePos == 4 else 'n' if edgePos == 5 and right else 't' if edgePos == 5 else 'p' if edgePos == 6 and right else 'j' if edgePos == 6 else 'l' if edgePos == 7 and front else 'f' if edgePos == 7 else 'u' if edgePos == 8 and down else 'k' if edgePos == 8 else 'v' if edgePos == 9 and down else 'o' if edgePos == 9 else 'w' if edgePos == 10 and down else 's' if edgePos == 10 else 'x' if down else 'g'def getCornerPosFromLetter(letter): return "AERBQNCMJDIFUGLVKPWOTXSH".index(letter) // 3def getEdgePosFromLetter(letter): return "aqbmcidehrntpjflukvowsxg".index(letter) // 2def getCornerColors(cornerPos, corners): return [(corners['A'],corners['E'],corners['R']),(corners['B'],corners['Q'],corners['N']),(corners['C'],corners['M'],corners['J']),(corners['D'],corners['I'],corners['F']),(corners['U'],corners['G'],corners['L']),(corners['V'],corners['K'],corners['P']),(corners['W'],corners['O'],corners['T']),(corners['X'],corners['S'],corners['H'])][cornerPos]def getEdgeColors(edgePos, edges): return [(edges['a'],edges['q']),(edges['b'],edges['m']),(edges['c'],edges['i']),(edges['d'],edges['e']),(edges['h'],edges['r']),(edges['n'],edges['t']),(edges['p'],edges['j']),(edges['f'],edges['l']),(edges['u'],edges['k']),(edges['v'],edges['o']),(edges['w'],edges['s']),(edges['x'],edges['g'])][edgePos]def getCornerRotation(colors, centers): return 0 if colors[0] == centers['cu'] or colors[0] == centers['cd'] else 1 if colors[1] == centers['cu'] or colors[1] == centers['cd'] else 2def getEdgeRotation(colors, centers):	if colors[0] == centers['cu'] or colors[0] == centers['cl'] or colors[0] == centers['cr'] or colors[0] == centers['cd']: return 0	else: return 1def solve(cube):	solution = []	cornerStates = [3] * 8	edgeStates = [2] * 12	for i in range(0,8):		colors = getCornerColors(i,cube)		pos = getCornerPos(colors, cube)		if pos == i: cornerStates[i] = getCornerRotation(colors, cube)	for i in range(0,12):		colors = getEdgeColors(i,cube)		pos = getEdgePos(colors, cube)		if pos == i: edgeStates[i] = getEdgeRotation(colors, cube)	currentLetter = ''	while any(cornerStates):		if not currentLetter:			if cornerStates[0] != 0: currentLetter = 'A'			else:				for i in range(1,8):					if cornerStates[i]:						colors = getCornerColors(i,cube)						letter = ['A','B','C','D','U','V','W','X'][i]						newColors = getCornerColors(i, cube)						newPos = getCornerPos(colors, cube)						currentLetter = getCornerStickerLetter(cube[letter],newPos,cube)						solution.append(letter)						break		if currentLetter != 'A': solution.append(currentLetter)		pos = getCornerPosFromLetter(currentLetter)		cornerStates[pos] = 0		colors = getCornerColors(pos, cube)		rotation = cornerStates[pos]		newPos = getCornerPos(colors, cube)		if cornerStates[newPos]: currentLetter = getCornerStickerLetter(cube[currentLetter], newPos, cube)		else: currentLetter = ''	if len(solution) % 2 == 1: solution.append('z')	currentLetter = ''	while any(edgeStates):		if not currentLetter:			if edgeStates[1] != 0: currentLetter = 'b'			else:				for i in [0] + list(range(2,12)):					if edgeStates[i]:						colors = getEdgeColors(i,cube)						letter = ['a','b','c','d','h','n','p','f','u','v','w','x'][i]						newColors = getEdgeColors(i, cube)						newPos = getEdgePos(colors, cube)						currentLetter = getEdgeStickerLetter(cube[letter],newPos,cube)						solution.append(letter)						break		if currentLetter != 'b': solution.append(currentLetter)		pos = getEdgePosFromLetter(currentLetter)		edgeStates[pos] = 0		colors = getEdgeColors(pos, cube)		rotation = edgeStates[pos]		newPos = getEdgePos(colors, cube)		if edgeStates[newPos]: currentLetter = getEdgeStickerLetter(cube[currentLetter], newPos, cube)		else: currentLetter = ''	return ''.join(solution)memo = solve(dict(zip(['A','a','B','d','cu','b','D','c','C','E','e','F','h','cl','f','H','g','G','I','i','J','l','cf','j','L','k','K','M','m','N','p','cr','n','P','o','O','Q','q','R','t','cb','r','T','s','S','U','u','V','x','cd','v','X','w','W',],list(input()))))print('Memo: {}'.format(memo))simple = '\r\n'.join([setupAlgs[x] for x in list(memo)])print('Simple solution:\r\n{}'.format(simple))print('Expanded solution:\r\n{}'.format(simple.replace('z',algorithms['parity']).replace('Ja',algorithms['Ja']).replace('Jb',algorithms['Jb']).replace('Y',algorithms['Y']).replace('T',algorithms['T'])))

I did "cheat" a bit to get it down to 99 lines so here's a more readable version

algorithms = {'T' : "R U R' U' R' F R2 U' R' U' R U R' F'", 'Y' : "R U' R' U' R U R' F' R U R' U' R' F R", 'Jb': "R U R' F' R U R' U' R' F R2 U' R' U'",'Ja': "F U' R' F R2 U' R' U' R U R' F' R U R' F'",'parity' : "Ja T Ja"}cornerAlgs = {'B':"R D' Y D R'", 'C':"F Y F'", 'D':"F R' Y R F'", 'F':"F2 Y F2", 'G':"D2 R Y R' D2", 'H':"D2 Y D2", 'I':"F' D Y D' F", 'J':"F2 D Y D' F2", 'K':"F D Y D' F'", 'L':"D Y D'", 'M':"R' Y R", 'N':"R2 Y R2",'O':"R Y R'", 'P':"Y", 'Q':"R' F Y F' R", 'S':"D' R Y R' D", 'T':"D' Y D", 'U':"F' Y F", 'V':"F' R' Y R F", 'W':"R2 F Y F' R2", 'X':"D F' Y F D'"}edgeAlgs = {'z':"z",'a':"Ja", 'c':"Jb", 'd':"T", 'e':"L' U B' U' T U B U' L", 'f':"U' F U T U' F' U", 'g':"D M' Jb M D'", 'h':"U B' U' T U B U'", 'i':"M' Ja M", 'j':"U2 R U2 T U2 R' U2", 'k':"M' Jb M", 'l':"L' T L", 'n':"U B U' T U B' U'", 'o':"D' M' Jb M D", 'p':"U' F' U T U' F U", 'q':"M Jb M'", 'r':"L T L'", 's':"M Ja M'", 't':"U2 R' U2 T U2 R U2", 'u':"M2 Ja M2", 'v':"D2 L2 T L2 D2", 'w':"M2 Jb M2", 'x':"L2 T L2"}algs = dict(cornerAlgs, **edgeAlgs)def getCornerPos(colors, centers):	top = centers['cu'] in colors	left = centers['cl'] in colors	front = centers['cf'] in colors	if top:		if left:			if front: return 3			else: return 0		else:			if front: return 2			else: return 1	else:		if left:			if front: return 4			else: return 7		else:			if front: return 5			else: return 6def getEdgePos(colors, centers):	top = centers['cu'] in colors	left = centers['cl'] in colors	front = centers['cf'] in colors	right = centers['cr'] in colors	down = centers['cd'] in colors	if top:		if left: return 3		elif right: return 1		elif front: return 2		else: return 0	elif down:		if left: return 11		elif right: return 9		elif front: return 8		else: return 10	else:		if left and front: return 7		elif left: return 4		elif front: return 6		else: return 5def getCornerStickerLetter(color, cornerPos, centers):	if cornerPos == 0:		if color == centers['cu']: return 'A'		elif color == centers['cl']: return 'E'		else: return 'R'	elif cornerPos == 1:		if color == centers['cu']: return 'B'		elif color == centers['cr']: return 'N'		else: return 'Q'	elif cornerPos == 2:		if color == centers['cu']: return 'C'		elif color == centers['cf']: return 'J'		else: return 'M'	elif cornerPos == 3:		if color == centers['cu']: return 'D'		elif color == centers['cl']: return 'F'		else: return 'I'	elif cornerPos == 4:		if color == centers['cd']: return 'U'		elif color == centers['cl']: return 'G'		else: return 'L'	elif cornerPos == 5:		if color == centers['cd']: return 'V'		elif color == centers['cf']: return 'K'		else: return 'P'	elif cornerPos == 6:		if color == centers['cd']: return 'W'		elif color == centers['cr']: return 'O'		else: return 'T'	else:		if color == centers['cd']: return 'X'		elif color == centers['cl']: return 'H'		else: return 'S' def getEdgeStickerLetter(color, edgePos, centers):	if edgePos == 0:		if color == centers['cu']: return 'a'		else: return 'q'	elif edgePos == 1:		if color == centers['cu']: return 'b'		else: return 'm'	elif edgePos == 2:		if color == centers['cu']: return 'c'		else: return 'i'	elif edgePos == 3:		if color == centers['cu']: return 'd'		else: return 'e'	elif edgePos == 4:		if color == centers['cl']: return 'h'		else: return 'r'	elif edgePos == 5:		if color == centers['cr']: return 'n'		else: return 't'	elif edgePos == 6:		if color == centers['cr']: return 'p'		else: return 'j'	elif edgePos == 7:		if color == centers['cf']: return 'l'		else: return 'f'	elif edgePos == 8:		if color == centers['cd']: return 'u'		else: return 'k'	elif edgePos == 9:		if color == centers['cd']: return 'v'		else: return 'o'	elif edgePos == 10:		if color == centers['cd']: return 'w'		else: return 's'	else:		if color == centers['cd']: return 'x'		else: return 'g'def getCornerPosFromLetter(letter):	if letter in "AER": return 0	elif letter in "BQN": return 1	elif letter in "CMJ": return 2	elif letter in "DIF": return 3	elif letter in "UGL": return 4	elif letter in "VKP": return 5	elif letter in "WOT": return 6	else: return 7def getEdgePosFromLetter(letter):	return "aqbmcidehrntpjflukvowsxg".index(letter) // 2def getCornerColors(cornerPos, corners):	return [(corners['A'],corners['E'],corners['R']),(corners['B'],corners['Q'],corners['N']),(corners['C'],corners['M'],corners['J']),(corners['D'],corners['I'],corners['F']),(corners['U'],corners['G'],corners['L']),(corners['V'],corners['K'],corners['P']),(corners['W'],corners['O'],corners['T']),(corners['X'],corners['S'],corners['H'])][cornerPos]def getEdgeColors(edgePos, edges):	return [(edges['a'],edges['q']),(edges['b'],edges['m']),(edges['c'],edges['i']),(edges['d'],edges['e']),(edges['h'],edges['r']),(edges['n'],edges['t']),(edges['p'],edges['j']),(edges['f'],edges['l']),(edges['u'],edges['k']),(edges['v'],edges['o']),(edges['w'],edges['s']),(edges['x'],edges['g'])][edgePos]def getCornerRotation(colors, centers):	if colors[0] == centers['cu'] or colors[0] == centers['cd']: return 0	elif colors[1] == centers['cu'] or colors[1] == centers['cd']: return 1	else: return 2def getEdgeRotation(colors, centers):	if colors[0] == centers['cu'] or colors[0] == centers['cl'] or colors[0] == centers['cr'] or colors[0] == centers['cd']: return 0	else: return 1def solve(cube):	solution = []	corners = dict()	edges = dict()	centers = dict()	for key, value in cube.items():		if len(key) == 2:			centers[key] = value		elif key < 'a':			corners[key] = value		else:			edges[key] = value	cornerStates = [3] * 8	edgeStates = [2] * 12	for i in range(0,8):		colors = getCornerColors(i,corners)		pos = getCornerPos(colors, centers)		if pos == i:			cornerStates[i] = getCornerRotation(colors, centers)	for i in range(0,12):		colors = getEdgeColors(i,edges)		pos = getEdgePos(colors, centers)		if pos == i:			edgeStates[i] = getEdgeRotation(colors, centers)	currentLetter = ''	while any(cornerStates):		if not currentLetter:			if cornerStates[0] != 0:				currentLetter = 'A'			else:				for i in range(1,8):					if cornerStates[i]:						colors = getCornerColors(i,corners)						letter = ['A','B','C','D','U','V','W','X'][i]						newColors = getCornerColors(i, corners)						newPos = getCornerPos(colors, centers)						currentLetter = getCornerStickerLetter(corners[letter],newPos,centers)						solution.append(letter)						break		if currentLetter != 'A':		    solution.append(currentLetter)		pos = getCornerPosFromLetter(currentLetter)		cornerStates[pos] = 0		colors = getCornerColors(pos, corners)		rotation = cornerStates[pos]		newPos = getCornerPos(colors, centers)		if cornerStates[newPos]:		    currentLetter = getCornerStickerLetter(corners[currentLetter], newPos, centers)		else:		    currentLetter = ''	if len(solution) % 2 == 1:		solution.append('z')	currentLetter = ''	while any(edgeStates):		if not currentLetter:			if edgeStates[1] != 0:				currentLetter = 'b'			else:				for i in [0] + list(range(2,12)):					if edgeStates[i]:						colors = getEdgeColors(i,edges)						letter = ['a','b','c','d','h','n','p','f','u','v','w','x'][i]						newColors = getEdgeColors(i, edges)						newPos = getEdgePos(colors, centers)						currentLetter = getEdgeStickerLetter(edges[letter],newPos,centers)						solution.append(letter)						break		if currentLetter != 'b':			solution.append(currentLetter)		pos = getEdgePosFromLetter(currentLetter)		edgeStates[pos] = 0		colors = getEdgeColors(pos, edges)		rotation = edgeStates[pos]		newPos = getEdgePos(colors, centers)		if edgeStates[newPos]:			currentLetter = getEdgeStickerLetter(edges[currentLetter], newPos, centers)		else:			currentLetter = ''	return ''.join(solution)if __name__ == '__main__':	keys = ['A','a','B','d','cu','b','D','c','C','E','e','F','h','cl','f','H','g','G','I','i','J','l','cf','j','L','k','K','M','m','N','p','cr','n','P','o','O','Q','q','R','t','cb','r','T','s','S','U','u','V','x','cd','v','X','w','W',]	cube = dict(zip(keys,list(input())))	memo = solve(cube)	print('Memo: {}'.format(memo))	simple = '\r\n'.join([algs[x] for x in list(memo)])	print('Simple solution:\r\n{}'.format(simple))	print('Expanded solution:\r\n{}'.format(simple.replace('z',algorithms['parity']).replace('Ja',algorithms['Ja']).replace('Jb',algorithms['Jb']).replace('Y',algorithms['Y']).replace('T',algorithms['T']))) 


 
There's most likely typos in some of the algorithms, I only tested it so much.

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

24469052.jpg

 this was my first thought on your chalange too :P

Link to comment
Share on other sites

Link to post
Share on other sites

It's not exactly "useful", but then again it depends on what you mean with useful :) this is a python 3 program that uses the pygame library to solve a knight's tour for a board of any size (anything above 4x3 included is solvable, stay below 70x70 though or it will take a LONG time ^^ I found 40x40 is a good compromise between speed and spectacle), then draws each move and the number of that move. It also prints the value of the move ib the console. I'm still a n00b so don't kill me :)

import pygameclass Chessboard:    def __init__(self, screen, side1, side2):           #draws a chessboard        self._screen = screen        self._side1 = side1        self._side2 = side2        self._squares = []        self._maxindex = 0        for i in range(side1):            for a in range(side2):                if (a * i) % 2 == 0 and (i % 2 != 0 or a % 2 != 0):                    pygame.draw.rect(self._screen, (255, 255, 255), (30 * i, 30 * a, 30, 30))                else:                    pygame.draw.rect(self._screen, (0, 0, 0), (30 * i, 30 * a, 30, 30))                self._squares.append([i , a])                self._maxindex += 1    def return_bottomright(self):                       #returns the coordinates of the bottom right square (useful to position the knight there)        return self._squares[self._maxindex - 1]    def squares(self):                                  #returns the list of coordinates of the squares on the chessboard        return self._squaresclass Knight:    def __init__(self, screen, board):                          #positions the knight on the bottom right square of the chessboard        self._board = board        self._screen = screen        self._xposition = self._board.return_bottomright()[0] * 30 + 5        self._yposition = self._board.return_bottomright()[1] * 30 + 5        self._screen.blit(pygame.image.load('horse.bmp'), (self._xposition, self._yposition))        pygame.display.flip()    def tellposition(self):                             #returns the starting position of the horse        return ([self._board.return_bottomright()[0], self._board.return_bottomright()[1]])def warnsdorff(board, x, y):                            #warnsdorff's heuristic method    viablesquares = []          #squares where the knight can go    viablenext = []             # count of viable next moves from a candidate destination    viablesqrindex = []         #    avmoves = 0                 # available moves from the viable square analized    minmoves = 8    allsquares = board.squares()    del allsquares[len(allsquares) - 1]    route = []    usedsquares = []    while len(allsquares) != 0:        for square in allsquares:            if ((square[0] - 1 == x and square[1] - 2 == y)                or (square[0] + 1 == x and square[1] - 2 == y)                or (square[0] - 2 == x and square[1] - 1 == y)                or (square[0] + 2 == x and square[1] - 1 == y)                or (square[0] - 1 == x and square[1] + 2 == y)                or (square[0] + 1 == x and square[1] + 2 == y)                or (square[0] - 2 == x and square[1] + 1 == y)                or (square[0] + 2 == x and square[1] + 1 == y)):                viablesquares.append(square)                viablesqrindex.append(allsquares.index(square))        for vsquare in viablesquares:            for square in allsquares:                if ((square[0] - 1, square[1] - 2) == (vsquare[0], vsquare[1])                    or (square[0] + 1, square[1] - 2) == (vsquare[0], vsquare[1])                    or (square[0] - 2, square[1] - 1) == (vsquare[0], vsquare[1])                    or (square[0] + 2, square[1] - 1) == (vsquare[0], vsquare[1])                    or (square[0] - 1, square[1] + 2) == (vsquare[0], vsquare[1])                    or (square[0] + 1, square[1] + 2) == (vsquare[0], vsquare[1])                    or (square[0] - 2, square[1] + 1) == (vsquare[0], vsquare[1])                    or (square[0] + 2, square[1] + 1) == (vsquare[0], vsquare[1])):                    avmoves += 1            viablenext.append(avmoves)            if avmoves < minmoves:                minmoves = avmoves            avmoves = 0        if viablesquares == []:            if len(allsquares)!= 0:                print('There is no full solution')            break        else:            for i in range(len(viablesquares)):                if viablenext[i] == minmoves:                    route.append(viablesquares[i])                    x = viablesquares[i][0]                    y = viablesquares[i][1]                    usedsquares.append(allsquares[viablesqrindex[i]])                    del allsquares[viablesqrindex[i]]                    break        if minmoves == 0:            break        viablesqrindex = []        viablesquares = []        viablenext = []        minmoves = 8    return route            class main:    xsquares = int(input('How many squares horizontally? '))    ysquares = int(input('How many squares vertically? '))    pygame.init()    num = pygame.font.Font(None, 16)    number = ''    screen = pygame.display.set_mode((xsquares * 30, ysquares * 30))    clock = pygame.time.Clock()    chessboard = Chessboard(screen, xsquares, ysquares)    knight = Knight(screen, chessboard)    route = warnsdorff(chessboard, knight.tellposition()[0], knight.tellposition()[1])    for step in route:        print(step)        screen.blit(pygame.image.load('horse.bmp'), (step[0] * 30 + 5, step[1] * 30 + 5))        number = num.render(str(route.index(step) + 1), 1, (0, 0, 255))        screen.blit(number, (step[0] * 30 + 1, step[1] * 30 + 1))        clock.tick(60)        pygame.display.flip()

It's a little bit longer that 100 (I think) because the if statements are very long and for the sake of readability Iused multiple lines for them ^^ I hope it's ok. To make it work you need to place this image in the folder where the .py file is and call it horse.bmp:

 

horse.bmp

 

This is the list of moves for a 70x70 board:

 

70x70.txt

 

p.s. I think I should get extra points because python is indent sensitive ^^

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

Pretty short, but also quiet handy program. I didn't have the idea myself and hope that no one else has posted something similar so far, but at least I wrote it myself ;)

 

//Program that tells you the ASCII-code of specific keys on your keyboard
//
 
#include <stdio.h>
#include <conio.h>
#include <Windows.h>
 
void main()  {
  for ( ; ; ){
      if (kbhit()){
        system("cls");
        printf("%d", getch());
      }
   }
}

I once had one of these, now I've got this.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

Here is a Sudoku solutions generator I made (finished sudoku board) in VB.Net and Java.
 

VB.Net:

    Module SudokuGen        Private Rnd As New Random        Private Board(8, 8) As Cell        Private Blks(,,) As Byte = _            {{{0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {1, 2}, {2, 0}, {2, 1}, {2, 2}}, _             {{0, 3}, {0, 4}, {0, 5}, {1, 3}, {1, 4}, {1, 5}, {2, 3}, {2, 4}, {2, 5}}, _             {{0, 6}, {0, 7}, {0, 8}, {1, 6}, {1, 7}, {1, 8}, {2, 6}, {2, 7}, {2, 8}}, _             {{3, 0}, {3, 1}, {3, 2}, {4, 0}, {4, 1}, {4, 2}, {5, 0}, {5, 1}, {5, 2}}, _             {{3, 3}, {3, 4}, {3, 5}, {4, 3}, {4, 4}, {4, 5}, {5, 3}, {5, 4}, {5, 5}}, _             {{3, 6}, {3, 7}, {3, 8}, {4, 6}, {4, 7}, {4, 8}, {5, 6}, {5, 7}, {5, 8}}, _             {{6, 0}, {6, 1}, {6, 2}, {7, 0}, {7, 1}, {7, 2}, {8, 0}, {8, 1}, {8, 2}}, _             {{6, 3}, {6, 4}, {6, 5}, {7, 3}, {7, 4}, {7, 5}, {8, 3}, {8, 4}, {8, 5}}, _             {{6, 6}, {6, 7}, {6, 8}, {7, 6}, {7, 7}, {7, 8}, {8, 6}, {8, 7}, {8, 8}}}        Public Sub Main()            While True                For x = 0 To 8                    For y = 0 To 8                        Board(x, y) = New Cell                    Next                Next                Dim ValidBlks As List(Of Byte) = New Byte() {0, 1, 2, 3, 4, 5, 6, 7, 8}.ToList                Dim Retry As Boolean = False                Do Until ValidBlks.Count = 0                    Dim ValidCells As List(Of Byte) = New Byte() {0, 1, 2, 3, 4, 5, 6, 7, 8}.ToList                    Dim B As Byte = ValidBlks(Rnd.Next(ValidBlks.Count))                    ValidBlks.Remove(B)                    Do Until ValidCells.Count = 0                        Dim C As Byte = ValidCells(Rnd.Next(ValidCells.Count))                        Dim X As Byte = Blks(B, C, 0), Y As Byte = Blks(B, C, 1), N As Byte = 0                        If Board(X, Y).Process(N) Then                            Retry = True                            Exit Do                        Else                            ValidCells.Remove(C)                            For i = 0 To 8                                Board(X, i).ValidNbrs.Remove(N) : Board(i, Y).ValidNbrs.Remove(N)                                Board(Blks(B, i, 0), Blks(B, i, 1)).ValidNbrs.Remove(N)                            Next                        End If                    Loop                    If Retry Then Exit Do                Loop                If Not Retry Then Exit While            End While            Console.Write(vbCrLf)            For X = 0 To 2                Console.Write("  ")                For Y = 0 To 2 : Console.Write(Board(X, Y).Value & " ") : Next                Console.Write(" ")                For Y = 3 To 5 : Console.Write(Board(X, Y).Value & " ") : Next                Console.Write(" ")                For Y = 6 To 8 : Console.Write(Board(X, Y).Value & " ") : Next                Console.Write(vbCrLf)            Next            Console.Write(vbCrLf)            For X = 3 To 5                Console.Write("  ")                For Y = 0 To 2 : Console.Write(Board(X, Y).Value & " ") : Next                Console.Write(" ")                For Y = 3 To 5 : Console.Write(Board(X, Y).Value & " ") : Next                Console.Write(" ")                For Y = 6 To 8 : Console.Write(Board(X, Y).Value & " ") : Next                Console.Write(vbCrLf)            Next            Console.Write(vbCrLf)            For X = 6 To 8                Console.Write("  ")                For Y = 0 To 2 : Console.Write(Board(X, Y).Value & " ") : Next                Console.Write(" ")                For Y = 3 To 5 : Console.Write(Board(X, Y).Value & " ") : Next                Console.Write(" ")                For Y = 6 To 8 : Console.Write(Board(X, Y).Value & " ") : Next                Console.Write(vbCrLf)            Next        End Sub        Public Class Cell            Public Value As Byte = 0            Public ValidNbrs As List(Of Byte) = New Byte() {1, 2, 3, 4, 5, 6, 7, 8, 9}.ToList            Public Function Process(ByRef SelectedNbr As Byte) As Boolean                If ValidNbrs.Count = 0 Then Return True                Value = ValidNbrs(Rnd.Next(ValidNbrs.Count))                SelectedNbr = Value                Return False            End Function        End Class    End Module

Java:

    package com.company;    import java.util.ArrayList;    import java.util.List;    import java.util.Random;    public class Main {        private static Random Rnd = new Random();        private static Cell[][] Board = new Cell[9][9];        private static int[][][] Blks = new int[][][]                {{{0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {1, 2}, {2, 0}, {2, 1}, {2, 2}},                {{0, 3}, {0, 4}, {0, 5}, {1, 3}, {1, 4}, {1, 5}, {2, 3}, {2, 4}, {2, 5}},                {{0, 6}, {0, 7}, {0, 8}, {1, 6}, {1, 7}, {1, 8}, {2, 6}, {2, 7}, {2, 8}},                {{3, 0}, {3, 1}, {3, 2}, {4, 0}, {4, 1}, {4, 2}, {5, 0}, {5, 1}, {5, 2}},                {{3, 3}, {3, 4}, {3, 5}, {4, 3}, {4, 4}, {4, 5}, {5, 3}, {5, 4}, {5, 5}},                {{3, 6}, {3, 7}, {3, 8}, {4, 6}, {4, 7}, {4, 8}, {5, 6}, {5, 7}, {5, 8}},                {{6, 0}, {6, 1}, {6, 2}, {7, 0}, {7, 1}, {7, 2}, {8, 0}, {8, 1}, {8, 2}},                {{6, 3}, {6, 4}, {6, 5}, {7, 3}, {7, 4}, {7, 5}, {8, 3}, {8, 4}, {8, 5}},                {{6, 6}, {6, 7}, {6, 8}, {7, 6}, {7, 7}, {7, 8}, {8, 6}, {8, 7}, {8, 8}}};        public static void main(String[] args) {            while (true) {                for (int x = 0; x < 9; x++) {                    for (int y = 0; y < 9; y++) {                        Board[x][y] = new Cell();                    }                }                List<Integer> ValidBlks = new ArrayList<Integer>();                for (int i =0; i < 9; i++) { ValidBlks.add(i); }                Boolean Retry = false;                do {                    List<Integer> ValidCells = new ArrayList<Integer>();                    for (int i =0; i < 9; i++) { ValidCells.add(i); }                    Integer B = ValidBlks.get(Rnd.nextInt(ValidBlks.size()));                    ValidBlks.remove(B);                    do {                        Integer C = ValidCells.get(Rnd.nextInt(ValidCells.size()));                        int X = Blks[B][C][0]; int Y = Blks[B][C][1];                        Integer R[] = Board[X][Y].Process(Rnd);                        if (R[0] == 1) {                            Retry = true;                            break;                        } else {                            ValidCells.remove(C);                            for (int i = 0; i < 9; i++) {                                Board[X][i].ValidNbrs.remove(R[1]); Board[i][Y].ValidNbrs.remove(R[1]);                                Board[Blks[B][i][0]][Blks[B][i][1]].ValidNbrs.remove(R[1]);                            }                        }                    } while (!(ValidCells.size() == 0));                    if (Retry) break;                } while (!(ValidBlks.size() == 0));                if (!(Retry)) break;            }            System.out.print("\r\n");            for (int x = 0; x < 3; x++) {                System.out.print(" ");                for (int y = 0; y < 3; y++) { System.out.print(Board[x][y].Value + " "); }                System.out.print(" ");                for (int y = 3; y < 6; y++) { System.out.print(Board[x][y].Value + " "); }                System.out.print(" ");                for (int y = 6; y < 9; y++) { System.out.print(Board[x][y].Value + " "); }                System.out.print("\r\n");            }            System.out.print("\r\n");            for (int x = 3; x < 6; x++) {                System.out.print(" ");                for (int y = 0; y < 3; y++) { System.out.print(Board[x][y].Value + " "); }                System.out.print(" ");                for (int y = 3; y < 6; y++) { System.out.print(Board[x][y].Value + " "); }                System.out.print(" ");                for (int y = 6; y < 9; y++) { System.out.print(Board[x][y].Value + " "); }                System.out.print("\r\n");            }            System.out.print("\r\n");            for (int x = 6; x < 9; x++) {                System.out.print(" ");                for (int y = 0; y < 3; y++) { System.out.print(Board[x][y].Value + " "); }                System.out.print(" ");                for (int y = 3; y < 6; y++) { System.out.print(Board[x][y].Value + " "); }                System.out.print(" ");                for (int y = 6; y < 9; y++) { System.out.print(Board[x][y].Value + " "); }                System.out.print("\r\n");            }        }    }    public class Cell {        public int Value = 0;        public List<Integer> ValidNbrs = new ArrayList<Integer>();        public Cell() { for (int i = 1; i < 10; i++) ValidNbrs.add(i); }        public Integer[] Process(Random Rnd) {            Integer[] R = new Integer[2];            if (ValidNbrs.size() == 0) {                R[0] = 1;                return R;            }            Value = ValidNbrs.get(Rnd.nextInt(ValidNbrs.size()));            R[0] = 0; R[1] = Value;            return R;        }    }
Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

Heres a legitimately Useful Script.
 

@[member=Echo] offtitle Long Division:clearinputset "numb1="set "numb2="set "accuracy=":topclsecho                        [---------------------------------]echo                        [ Welcome to Batch Long Division  ]echo                        [ Made by Kingofpants             ]echo                        [ --------------------------------]echo.set /p numb1=Enter the Numerator: set /p numb2=Enter the Denominator: set /p accuracy=Decimal Places: if not defined numb1 goto errorif not defined numb2 goto errorif not defined accuracy goto errorif %numb2% EQU 0 goto errorif %accuracy% LEQ 0 goto errorif %accuracy% GTR 8100 goto error:define varsset "currentrem=0"set "currentdec=0"set "answer=0"set "workinga=0"set "workingb=0":calcpart1set /a "workinga=%numb1%/%numb2%"set /a "currentrem=%numb1% %% %numb2%"set "answer=%workinga%.":calcpart2if %accuracy% EQU 0 goto outputset /a "workingb=%currentrem%*10"set /a "workinga=%workingb%/%numb2%"set /a "currentrem=%workingb% %% %numb2%"set /a "accuracy-=1"set "answer=%answer%%workinga%"if %currentrem% EQU 0 goto outputgoto calcpart2:outputclsecho.echo                                      [------]echo                                      [ DONE ]echo                                      [------]echo.echo The Answer isecho %answer%echo.echo The Last Remainder isecho %currentrem%echo.pause >nulgoto top:errorclsecho.echo                              [--------------------]echo                              [ SOMETHING IS WRONG ]echo                              [--------------------]pause >nul goto top

It basically does long division and you can divide a number with upto 8100 Decimal places of accuracy.

The actual limit is 8176, you can remove the line that says if %accuracy% GRT 8100 goto error if you want those last digits , but it doesn't work very well at max.

 

To Make this usable- Simply Copy Pasta the script into a .txt file, save it and change the file extension to .bat

> Heres a preview

7XLYKSO.gif

A riddle wrapped in an enigma , shot to the moon and made in China

Link to comment
Share on other sites

Link to post
Share on other sites

{print("Hello World");}

I win.

NCASE M1 i5-9600k  GTX 1080 FE Z370N-WIFI SF600 NH-U9S LPX 32GB 960EVO

I'm a self-identifying Corsair Nvidia Fanboy; Get over it.

Link to comment
Share on other sites

Link to post
Share on other sites

<script type="text/javascript">$('.besked').hide();$(function() {	var bound = $(".editable").bind("dblclick", function(event) {		event.stopPropagation();		var currentEle = $(this);		var value = $(this).text();		edit(currentEle, value);	});});function edit(currentEle, value) {	$(currentEle).html('<textarea class="tedit" note="' + $(currentEle).attr('note') + '">' + value + '</textarea>');	$(".tedit").focus();	$(".tedit").blur(function() {		var vaerdi = $(this).val().trim();		var field = $(this).attr('note');		$(this).parent('.editable').html($(this).val().trim());		$(this).remove();		$.ajax({			url: '../php/code_update1.php',			data: {				'vaerdi': vaerdi,				'field': field			},			type: 'POST',			success: function(data) {				$('.besked').slideDown("slow");				$('.besked').delay(5000);				$('.besked').slideUp("slow");			},			error: function(xhr, status, errorThrown) {				alert('Der opstod desværre et problem.');				console.log('Error: ' + errorThrown);				console.log('Status: ' + status);				console.dir(xhr);			},			complete: function(xhr, status) {			}		});	});	$(".tedit").keyup(function(event) {		if (event.keyCode == 13) {			currentEle.parent('.editable').html($(this).val().trim());		}	});}$(document).click(function() {	if ($(".tedit").length) {		var value1234 = $(".tedit").val().trim();		//$(".editable").removeClass();		//$(".tedit").parent().html(value1234);	}});</script>

This is a script where you can Double click on you admin page on any text with the class .editable and edit it directly on your page so there is no confusion about where the text you just been editing has ended up as I had some people who were a little confused about where the text would aper and how it would look so with that script there wouldn't be any problems.

 

Not the most useful script but i found a lot of places where I could use it.

 

Edit: PS. .Besked is danish and means .message its a confirm message for when you completet what you wanted to edit

CPU: Intel Core i7-3770S 3.1GHz Quad-Core CPU Cooler: Corsair H90 Motherboard: ASRock Z77 Extreme4 Ram: Kingston Fury Black 16GB SSD: Intel 730 Series 240GB SATA: Toshiba 2TB 3.5" 7200RPM GPU: Asus GeForce GTX 970 CASE: NZXT H440 (Green/Black) PSU: EVGA 850W 80+ Gold Monitor: BenQ XL2411Z 144Hz 24.0" x2 Keyboard: Razer DeathStalker Mouse: Razer Naga Headphones: Razer Kraken.

Link to comment
Share on other sites

Link to post
Share on other sites

Hi Guys , I made a new batch file , and this time its a real Treat :D , Its my Parabla Drawer.
The inputs it takes are in standard Vertex form and special inputs are explained in the Program itself.

@[member='Echo'] off:toptitle Parablaset "intotxt=0"set "letters="set "yoffset=-10"set "xoffset=-40"set "defa=26"REM y=(a*((x+h)*(x+h)))/b+c:getinputsclsecho y=a*(x+h)~2/b+cecho.echo What to set for (a)? Default to 1set /p inpa=:if not defined inpa set "inpa=1"clsecho y=a*(x+h)~2/b+cecho.echo What to set for (b)? Default to 1set /p inpb=:if not defined inpb set "inpb=1"clsecho y=a*(x+h)~2/b+cecho.echo What to set for (h)? Default to 0set /p inph=:if not defined inph set "inph=0"clsecho y=a*(x+h)~2/b+cecho.echo What to set for (c)? Default to 0set /p inpc=:if not defined inpc set "inpc=0"clsecho OffSets DEFAULT= (-40,-10)echo Offset is the co-ordinate of the bottom left cornerset /p "xoffset=X:"set /p "yoffset=Y:"if not defined xoffset set "xoffset=-40"if not defined yoffset set "yoffset=-10"clsecho Accuracy is the total number of attempts this makes to make the line continuous.echo This is needed if the area of the parabla you wish to view is steep.echo Set this to 20 for a good in between for computation time and shape.set /p accuracy=:if not defined accuracy set "accuracy=20"if %accuracy% LSS 0 set "accuracy=0"clsecho Vertical Lines is the total number of vertical lines calculated.echo Horizontal Lines is the total number of horizontal lines calculated.echo More than 78 Horizontal Lines will echo the output to Parablaoutput.txtecho Default is 26 for Veritcal, 78 for Horizontalset /p defa=Veritcal:set /p horizontal=Horizontal:if not defined horizontal set "horizontal=78"if %horizontal% LEQ 0 set "horizontal=1"if not defined defa set "defa=26"if %defa% LEQ 0 set "defa=1"title Computing- %defa% Lines Remainingcls:drawinglinesset /a "downup=%inpa%*%inpb%"set "upordown=EQU"if %downup% GTR 0 set "upordown=LSS"if %downup% LSS 0 set "upordown=GTR"if %downup% EQU 0 set "accuracy=0":letterset "letter="set "foundy=0"set /a "workingy=%yoffset%+%defa%"set /a "workingx=%xoffset%"set /a "recurselimit=%workingy%"set /a "xtogoto=%workingx%+%horizontal%":letterrecurseset /a "sum=(%inpa%*(%workingx%+%inph%)*(%workingx%+%inph%))/%inpb%+%inpc%"if NOT %workingy% EQU %sum% set "dig=."set /a "truey=%yoffset%+%defa%"if %truey% EQU 0 set "dig=-"if %workingx% EQU 0 set "dig=/"if %workingy% EQU %sum% set "dig=0" && set "foundy=1"set /a "workingx+=1"set "letter=%letter%%dig%"if %workingx% GTR %xtogoto% goto completelettergoto letterrecurse:completeletterif %workingy% %upordown% %inpc% set "foundy=1"if %accuracy% EQU 0 set "foundy=1"if %foundy% LSS 1 goto fixif %horizontal% GTR 78 echo %letter% - Line %defa% >> "%cd%\Parablaoutput.txt"if %horizontal% LEQ 78 echo %letter%title Computing- %defa% Lines Remainingif %defa% LEQ 0 goto doneset /a "defa-=1"goto letter:fixset "workingx=%xoffset%"set "letter="set "checking=0"set "foundy=1":recursecheckset /a "checker=(%inpa%*(%checking%)*(%checking%))/%inpb%+%inpc%"if %workingy% %upordown% %checker% set /a "workingy=%checker%" && goto letterrecurseif %checking% GTR %accuracy% set "workingx=%xoffset%" && goto letterrecurseset /a "checking+=1"goto recursecheck:doneecho DONE!pause >nulclsgoto top

 
How to make this work > Copy all the code, Paste it all into a .txt file , Change the extension of the txt file to .bat and run it.
Remember - Any Horizontal value larger than 78 (the length of the cmd box) is automatically outputed to a .txt file.

cwy4rJZ.gif

 

BTW - The limits of the Cartesian plane at upto ~8000 digits Horizontally and ~(32 bit integer) Downwards. I don't Recommend to high a value for those graphs as graphing will take a long time ,

also don't set you accuracy too high if your graph lacks points due to how this works, but I figure for most graphs an accuracy of 200 would be more than enough.

 

Also heres a quick explanation to what the values do if you haven't taken Quadratics in yet.

y=a(x+h)^2+k is the Standard/Vertex form of a quadratic equation.

This graph uses y=a(x+h)^2/b+c as the equation

Changing c moves the Vertex (The maximum/minimum point on the graph) Up and down

Changing h move the Vertex  left and right inversely to the the graph , ex making h=5 makes the vertex move to -5

changing a/b makes the graph Wider or Thinner or Upside down. a/b is a fraction form since YOU MUST ENTER WHOLE DIGITS AS BATCH DOES NOT ALLOW DECIMAL PLACES if you make a/b a Small number the graph gets wider , if a/b=0 then the graph becomes a flat line, if a/b is a big number then the graph get really skinny, if a/b is a negative number then the graph flips upside down.

 

I dare you to render a graph with these Inputs

a= -1

b= 20

h= 8

c= 3970

 

Xoffset= -4000

yoffset= -4000

 

Accuracy= 400

 

Vertical lines= 8000

Horizontal Lines= 8000

 

(I am rendering this graph , But I redid the equation for a better Graph , Do a= -170 , b= 9000000 and h= 800, c= 3970 , Xoffset -4000 , yoffset -4000 Accuracy=2000 , 8000 Vert 8000 Horizontal )

 

Warning - This will take a long time. But send me the .txt file you create :D

.............................................................................................000000000000000............................................................................................. - Line 200 ...........................................................................................00......./.......00........................................................................................... - Line 199 ........................................................................................000........./.........000........................................................................................ - Line 198 ......................................................................................00............/............00...................................................................................... - Line 197 .....................................................................................0............../..............0..................................................................................... - Line 196 ...................................................................................00.............../...............00................................................................................... - Line 195 ..................................................................................0................./.................0.................................................................................. - Line 194 .................................................................................0................../..................0................................................................................. - Line 193 ...............................................................................00.................../...................00............................................................................... - Line 192 ..............................................................................0...................../.....................0.............................................................................. - Line 191 .............................................................................0....................../......................0............................................................................. - Line 190 ............................................................................0......................./.......................0............................................................................ - Line 189 ...........................................................................0......................../........................0........................................................................... - Line 188 ..........................................................................0........................./.........................0.......................................................................... - Line 187 .........................................................................0........................../..........................0......................................................................... - Line 186 ........................................................................0.........................../...........................0........................................................................ - Line 185 .......................................................................0............................/............................0....................................................................... - Line 184 ......................................................................0............................./.............................0...................................................................... - Line 183 ......................................................................0............................./.............................0...................................................................... - Line 182 .....................................................................0............................../..............................0..................................................................... - Line 181 ....................................................................0.............................../...............................0.................................................................... - Line 180 ...................................................................0................................/................................0................................................................... - Line 179 ..................................................................0................................./.................................0.................................................................. - Line 178 ..................................................................0................................./.................................0.................................................................. - Line 177 .................................................................0................................../..................................0................................................................. - Line 176 ................................................................0.................................../...................................0................................................................ - Line 175 ...............................................................0..................................../....................................0............................................................... - Line 174 ...............................................................0..................................../....................................0............................................................... - Line 173 ..............................................................0...................................../.....................................0.............................................................. - Line 172 .............................................................0....................................../......................................0............................................................. - Line 171 .............................................................0....................................../......................................0............................................................. - Line 170 ............................................................0......................................./.......................................0............................................................ - Line 169 ............................................................0......................................./.......................................0............................................................ - Line 168 ...........................................................0......................................../........................................0........................................................... - Line 167 ..........................................................0........................................./.........................................0.......................................................... - Line 166 ..........................................................0........................................./.........................................0.......................................................... - Line 165 .........................................................0........................................../..........................................0......................................................... - Line 164 ........................................................0.........................................../...........................................0........................................................ - Line 163 ........................................................0.........................................../...........................................0........................................................ - Line 162 .......................................................0............................................/............................................0....................................................... - Line 161 .......................................................0............................................/............................................0....................................................... - Line 160 ......................................................0............................................./.............................................0...................................................... - Line 159 ......................................................0............................................./.............................................0...................................................... - Line 158 .....................................................0............................................../..............................................0..................................................... - Line 157 .....................................................0............................................../..............................................0..................................................... - Line 156 ....................................................0.............................................../...............................................0.................................................... - Line 155 ....................................................0.............................................../...............................................0.................................................... - Line 154 ...................................................0................................................/................................................0................................................... - Line 153 ...................................................0................................................/................................................0................................................... - Line 152 ..................................................0................................................./.................................................0.................................................. - Line 151 ..................................................0................................................./.................................................0.................................................. - Line 150 .................................................0................................................../..................................................0................................................. - Line 149 .................................................0................................................../..................................................0................................................. - Line 148 ................................................0.................................................../...................................................0................................................ - Line 147 ................................................0.................................................../...................................................0................................................ - Line 146 ...............................................0..................................................../....................................................0............................................... - Line 145 ...............................................0..................................................../....................................................0............................................... - Line 144 ..............................................0...................................................../.....................................................0.............................................. - Line 143 ..............................................0...................................................../.....................................................0.............................................. - Line 142 .............................................0....................................................../......................................................0............................................. - Line 141 .............................................0....................................................../......................................................0............................................. - Line 140 ............................................0......................................................./.......................................................0............................................ - Line 139 ............................................0......................................................./.......................................................0............................................ - Line 138 ...........................................0......................................................../........................................................0........................................... - Line 137 ...........................................0......................................................../........................................................0........................................... - Line 136 ..........................................0........................................................./.........................................................0.......................................... - Line 135 ..........................................0........................................................./.........................................................0.......................................... - Line 134 ..........................................0........................................................./.........................................................0.......................................... - Line 133 .........................................0........................................................../..........................................................0......................................... - Line 132 .........................................0........................................................../..........................................................0......................................... - Line 131 ........................................0.........................................................../...........................................................0........................................ - Line 130 ........................................0.........................................................../...........................................................0........................................ - Line 129 ........................................0.........................................................../...........................................................0........................................ - Line 128 .......................................0............................................................/............................................................0....................................... - Line 127 .......................................0............................................................/............................................................0....................................... - Line 126 ......................................0............................................................./.............................................................0...................................... - Line 125 ......................................0............................................................./.............................................................0...................................... - Line 124 .....................................0............................................................../..............................................................0..................................... - Line 123 .....................................0............................................................../..............................................................0..................................... - Line 122 .....................................0............................................................../..............................................................0..................................... - Line 121 ....................................0.............................................................../...............................................................0.................................... - Line 120 ....................................0.............................................................../...............................................................0.................................... - Line 119 ...................................0................................................................/................................................................0................................... - Line 118 ...................................0................................................................/................................................................0................................... - Line 117 ...................................0................................................................/................................................................0................................... - Line 116 ..................................0................................................................./.................................................................0.................................. - Line 115 ..................................0................................................................./.................................................................0.................................. - Line 114 ..................................0................................................................./.................................................................0.................................. - Line 113 .................................0................................................................../..................................................................0................................. - Line 112 .................................0................................................................../..................................................................0................................. - Line 111 ................................0.................................................................../...................................................................0................................ - Line 110 ................................0.................................................................../...................................................................0................................ - Line 109 ................................0.................................................................../...................................................................0................................ - Line 108 ...............................0..................................................................../....................................................................0............................... - Line 107 ...............................0..................................................................../....................................................................0............................... - Line 106 ...............................0..................................................................../....................................................................0............................... - Line 105 ..............................0...................................................................../.....................................................................0.............................. - Line 104 ..............................0...................................................................../.....................................................................0.............................. - Line 103 ..............................0...................................................................../.....................................................................0.............................. - Line 102 .............................0....................................................................../......................................................................0............................. - Line 101 -----------------------------0----------------------------------------------------------------------/----------------------------------------------------------------------0----------------------------- - Line 100 ............................0......................................................................./.......................................................................0............................ - Line 99 ............................0......................................................................./.......................................................................0............................ - Line 98 ............................0......................................................................./.......................................................................0............................ - Line 97 ...........................0......................................................................../........................................................................0........................... - Line 96 ...........................0......................................................................../........................................................................0........................... - Line 95 ...........................0......................................................................../........................................................................0........................... - Line 94 ..........................0........................................................................./.........................................................................0.......................... - Line 93 ..........................0........................................................................./.........................................................................0.......................... - Line 92 ..........................0........................................................................./.........................................................................0.......................... - Line 91 .........................0........................................................................../..........................................................................0......................... - Line 90 .........................0........................................................................../..........................................................................0......................... - Line 89 .........................0........................................................................../..........................................................................0......................... - Line 88 ........................0.........................................................................../...........................................................................0........................ - Line 87 ........................0.........................................................................../...........................................................................0........................ - Line 86 ........................0.........................................................................../...........................................................................0........................ - Line 85 .......................0............................................................................/............................................................................0....................... - Line 84 .......................0............................................................................/............................................................................0....................... - Line 83 .......................0............................................................................/............................................................................0....................... - Line 82 ......................0............................................................................./.............................................................................0...................... - Line 81 ......................0............................................................................./.............................................................................0...................... - Line 80 ......................0............................................................................./.............................................................................0...................... - Line 79 .....................0............................................................................../..............................................................................0..................... - Line 78 .....................0............................................................................../..............................................................................0..................... - Line 77 .....................0............................................................................../..............................................................................0..................... - Line 76 ....................0.............................................................................../...............................................................................0.................... - Line 75 ....................0.............................................................................../...............................................................................0.................... - Line 74 ....................0.............................................................................../...............................................................................0.................... - Line 73 ....................0.............................................................................../...............................................................................0.................... - Line 72 ...................0................................................................................/................................................................................0................... - Line 71 ...................0................................................................................/................................................................................0................... - Line 70 ...................0................................................................................/................................................................................0................... - Line 69 ..................0................................................................................./.................................................................................0.................. - Line 68 ..................0................................................................................./.................................................................................0.................. - Line 67 ..................0................................................................................./.................................................................................0.................. - Line 66 .................0................................................................................../..................................................................................0................. - Line 65 .................0................................................................................../..................................................................................0................. - Line 64 .................0................................................................................../..................................................................................0................. - Line 63 ................0.................................................................................../...................................................................................0................ - Line 62 ................0.................................................................................../...................................................................................0................ - Line 61 ................0.................................................................................../...................................................................................0................ - Line 60 ................0.................................................................................../...................................................................................0................ - Line 59 ...............0..................................................................................../....................................................................................0............... - Line 58 ...............0..................................................................................../....................................................................................0............... - Line 57 ...............0..................................................................................../....................................................................................0............... - Line 56 ..............0...................................................................................../.....................................................................................0.............. - Line 55 ..............0...................................................................................../.....................................................................................0.............. - Line 54 ..............0...................................................................................../.....................................................................................0.............. - Line 53 .............0....................................................................................../......................................................................................0............. - Line 52 .............0....................................................................................../......................................................................................0............. - Line 51 .............0....................................................................................../......................................................................................0............. - Line 50 .............0....................................................................................../......................................................................................0............. - Line 49 ............0......................................................................................./.......................................................................................0............ - Line 48 ............0......................................................................................./.......................................................................................0............ - Line 47 ............0......................................................................................./.......................................................................................0............ - Line 46 ...........0......................................................................................../........................................................................................0........... - Line 45 ...........0......................................................................................../........................................................................................0........... - Line 44 ...........0......................................................................................../........................................................................................0........... - Line 43 ...........0......................................................................................../........................................................................................0........... - Line 42 ..........0........................................................................................./.........................................................................................0.......... - Line 41 ..........0........................................................................................./.........................................................................................0.......... - Line 40 ..........0........................................................................................./.........................................................................................0.......... - Line 39 ..........0........................................................................................./.........................................................................................0.......... - Line 38 .........0........................................................................................../..........................................................................................0......... - Line 37 .........0........................................................................................../..........................................................................................0......... - Line 36 .........0........................................................................................../..........................................................................................0......... - Line 35 ........0.........................................................................................../...........................................................................................0........ - Line 34 ........0.........................................................................................../...........................................................................................0........ - Line 33 ........0.........................................................................................../...........................................................................................0........ - Line 32 ........0.........................................................................................../...........................................................................................0........ - Line 31 .......0............................................................................................/............................................................................................0....... - Line 30 .......0............................................................................................/............................................................................................0....... - Line 29 .......0............................................................................................/............................................................................................0....... - Line 28 ......0............................................................................................./.............................................................................................0...... - Line 27 ......0............................................................................................./.............................................................................................0...... - Line 26 ......0............................................................................................./.............................................................................................0...... - Line 25 ......0............................................................................................./.............................................................................................0...... - Line 24 .....0............................................................................................../..............................................................................................0..... - Line 23 .....0............................................................................................../..............................................................................................0..... - Line 22 .....0............................................................................................../..............................................................................................0..... - Line 21 .....0............................................................................................../..............................................................................................0..... - Line 20 ....0.............................................................................................../...............................................................................................0.... - Line 19 ....0.............................................................................................../...............................................................................................0.... - Line 18 ....0.............................................................................................../...............................................................................................0.... - Line 17 ....0.............................................................................................../...............................................................................................0.... - Line 16 ...0................................................................................................/................................................................................................0... - Line 15 ...0................................................................................................/................................................................................................0... - Line 14 ...0................................................................................................/................................................................................................0... - Line 13 ...0................................................................................................/................................................................................................0... - Line 12 ..0................................................................................................./.................................................................................................0.. - Line 11 ..0................................................................................................./.................................................................................................0.. - Line 10 ..0................................................................................................./.................................................................................................0.. - Line 9 ..0................................................................................................./.................................................................................................0.. - Line 8 .0................................................................................................../..................................................................................................0. - Line 7 .0................................................................................................../..................................................................................................0. - Line 6 .0................................................................................................../..................................................................................................0. - Line 5 .0................................................................................................../..................................................................................................0. - Line 4 0.................................................................................................../...................................................................................................0 - Line 3 0.................................................................................................../...................................................................................................0 - Line 2 0.................................................................................................../...................................................................................................0 - Line 1 0.................................................................................................../...................................................................................................0 - Line 0  

A riddle wrapped in an enigma , shot to the moon and made in China

Link to comment
Share on other sites

Link to post
Share on other sites

@Kingofpants yup that crashed a script, make a pastebin link instead.

 

Cool I noticed your from ottawa too :D

There are 10 types of people in this world, those who can read binary and those who can't.

There are 10 types of people in this world, those who can read hexadecimal and F the rest.

~Fletch

Link to comment
Share on other sites

Link to post
Share on other sites

A stupid one, but one I use fairly often. Done in C#. It suspends the computer (extremely useful when you want to suspend a computer you are connecting through RDP, as the menu will only show Disconnect

 

    class Program    {        [DllImport("Powrprof.dll", CharSet = CharSet.Auto, ExactSpelling = true)]        public static extern bool SetSuspendState(bool hiberate, bool forceCritical, bool disableWakeEvent);        static void Main(string[] args)        {            SetSuspendState(false, true, true);        }    }
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×