Skip to content

Instantly share code, notes, and snippets.

View ex's full-sized avatar
💭
I may be slow to respond.

me ex

💭
I may be slow to respond.
View GitHub Profile
Path to preferences file in Mac:
[disk with macOS]/ Users/user/Library/Preferences/[game name]/
Visual C# 2008 XNA 3
Your registration key is: Z3H13BNTM3SLG1
@echo off
SET count=1
#FOR /f "tokens=*" %%G IN ('dir /B /A-D') DO (
FOR /f "tokens=*" %%G IN ('dir *.as /B') DO (
call :move_svn %%G target_dir
)
GOTO :eof
:move_svn
echo %count%: %1 %2
@ex
ex / gist:781366
Last active September 24, 2015 17:08
IMO 1960 Problem 01
public function solve():void {
txtResult.text = "";
var count:int = 1;
var k:int = 10;
while (k * 11 < 1000) {
// Calculate sum of the squares of the digits
var sumSquares:int = 0;
var n:int = k * 11;
while (n > 0) {
var digit:int = n % 10;
@ex
ex / gist:781369
Last active September 24, 2015 17:08
IMO 1962 Problem 01
public function solve():void {
txtResult.text = "";
var k:int = 1;
var k_up:int = 10; // Minimum (10^p) greater that k.
while (true) {
var n:int = (10 * k) + 6;
var m:int = (6 * k_up) + k;
// Check
if (m == 4 * n) {
txtResult.text += "ANSWER: " + n;
@ex
ex / gist:781372
Created January 15, 2011 23:31
permutation
def permutations(array)
n = array.length
return [array] if n < 2
rt = Array.new
for i in 0...n
## Create a new array from [array] where the
## [i]-th term has been ignored.
t = Array.new(array)
t.delete_at(i)
@ex
ex / gist:781376
Last active September 24, 2015 17:08
public function solve():void {
txtResult.text = "";
// Create array of permutations of students.
var p:Array = permutations(students.split(""));
// Check every possibility.
for (var k:int = 0; k <= p.length; ++k) {
var s1:int = singleCorrectPredictions(p[k], guess1.split(""))
var d1:int = doubleConsecutivePredictions(p[k], guess1.split(""))
var s2:int = singleCorrectPredictions(p[k], guess2.split(""))
var d2:int = doubleConsecutivePredictions(p[k], guess2.split(""))
@ex
ex / Mandel.c
Created May 27, 2012 01:28
DOS Borland-C++ old source code of mine
//---------------------------------------------------------------
// Mandel.c
//---------------------------------------------------------------
// Fractal de Mandelbrot - Esau R.O
//---------------------------------------------------------------
#include "mandel.h"
#include "graficos.h"
extern double gf_x1;
@ex
ex / gist:3734653
Created September 16, 2012 22:36
Project Euler 393
var count // number of final positions
var N // total cells in the board
var n // grid partition
function dfs(now, next) {
for (var k = 0; k < N; k += 1) {
// Find an ant to move.
if (now[k] > 0) {
// Try to move it to the right.
if ((k % n < n - 1) && (next[k + 1] == 0)
@ex
ex / euler393.html
Created September 23, 2012 02:15
Graphic display of problem Euler 393 with (n = 8)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Euler 393</title>
</head>
<body>
<div style="text-align: center;">
<canvas height="902" id="canvas" width="660"></canvas></div>