Skip to content

farteryhr/labs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

labs

misc things, brain holes, etc.

straightforward yet shitty code.

mostly runnable on a normal pc within some minutes requiring reasonably large RAM.

more at my repl.it.

123456789.cpp

bruteforce enumeration of Crazy Sequential Representation.

based on expression tree building and memorized subproblem.

supports +-×÷, brackets, power(^), concatenation. features floating point fixing and some pruning.

Inder J. Taneja's paper

Numberphile's youtube video: the 10958 problem

needs 2gb ram for the full size problem.

bejeweled.c

count how many stable fields/boards exactly/precisely are there are in the game Bejeweled (or its ancestor, shariki)?

8×8, 7 colors, stable means no 3 gems of the same color in a row/column (regardless of no-more-moves or has-valid-move).

the answer given is 203601887802130611210536633992503090012487776690503574 which matches the number estimated by generating random fields.

based on essential pattern and some combinatorics, also Chinese remainder theory.

but still no idea for "no more moves".

needs 5gb ram on the full size problem, you have to use 64-bit compilation.

god2048.cpp

bruteforce enumeration of 3×3 simplified 2048 game tree. (giving only "2" on a random position each turn)

based on expecti-max. the result is you can always get a constant max score.

after computation, you enter a simple inspector.

but still no idea for 4×4.

needs 2×10^9 bytes ram.

cm.g4

parser of mathematic expressions in Chinese language as close to usually spoken.

the hardest part turns out to be the structure of how a single (big) number is read in chinese.

sudoku.c

yet another fast and simple sudoku solver. supports both pure naive top-down order and least-candidate-first strategy (switch via #define). by the name "pure" it is intended to form a well-defined commonly used deterministic algorithm, may be called "standard backtracking bruteforce", "straightforward DFS backtracking", etc.

with full usage of bitwise operations, balancing number of operations and data footprint, it's able to run 2.5G recursions (naive version) per minute on my laptop (i3 M350 2.27Hz, GCC 4.7.2).

try to crack them, prove whether they have no, unique or multiple solutions.

4.....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......
..............3.85..1.2.......5.7.....4...1...9.......5......73..2.1........4...9
.....5.8....6.1.43..........1.5........1.6...3.......553.....61........4.........
9..8...........5............2..1...3.1.....6....4...7.7.86.........3.1..4.....2..

see my stackoverflow quesion.

t-ex_core.as

core (means pretty much everything) code of flash version of t-ex (available at farter.cn homepage) which is almost direct translation of vb6 version.

old code, old flavor. not uglified/minified by any tool. but it's decompiled from my releases because i lost the source. since it mostly uses global variable, the code is readable.

for example, kpmr/kcmr means "Key isPressed/frameCounter of Move Right".

About

misc things

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published