User Portlet
Featured Contributor
Sander Huisman
University of Twente
LOCATION: Enschede, Netherlands
WEBSITE: http://shuisman.com
INTERESTS IN JOBS & NETWORKING:
ABOUT ME:
Welcome to my profile at the Wolfram Community
You'll see me drop by the forums frequently, to broaden my knowledge and to help out others. I'm using Mathematica since 2003 (V5), and have mainly used it to do all my analysis and all my programming tasks. I have a variety of interests: math, photography, photo-editing, mountain biking, vector-based drawing, traveling, anything GPS, math puzzles, data-mining, and many others...
Please enjoy a game of '2048' that I made where you can change the grid size: (code below)
Code:
SetOptions[InputNotebook[],NotebookEventActions->{ "LeftArrowKeyDown":>(stat=Coalesce[stat];AddNew[]), "RightArrowKeyDown":>(stat=Reverse/@Coalesce[Reverse/@stat];AddNew[]), "UpArrowKeyDown":>(stat=Coalesce[stat\[Transpose]]\[Transpose];AddNew[]), "DownArrowKeyDown":>(stat=(Reverse/@(Coalesce[Reverse/@(stat\[Transpose])]))\[Transpose];AddNew[]) } ]; n=4; bgcolor=GrayLevel[0.84]; colorfunc=Blend[{{0,Gray},{1/2,Red},{1,Blend[{Yellow,Orange}]}},#]&; ClearAll[AddNew,PrintStat,Coalesce,SubCoalesce,AddRandomNumber] AddNew[]:=(stat=AddRandomNumber[stat]) PrintStat[stat_]:=Module[{gr1,gr2,gr3,dr=0.2,cols,nstat=stat,positions}, gr1={bgcolor,Rectangle[-dr{1,1},n+dr{1,1},RoundingRadius->dr]}; cols=Map[If[#==0,0,Log2[#]]&,nstat,{2}]; cols=Map[If[#==0,Lighter@bgcolor,colorfunc[#/Max[cols]]]&,cols,{2}]; positions=Table[{i,n-j+1},{j,n},{i,n}]; gr2=MapThread[{#2,Rectangle[#3-{1,1}(1-dr/3),#3-{1,1}dr/3,RoundingRadius->dr/2]}&,{stat,cols,positions},2]; gr3=MapThread[If[#1>0,Style[Text[#1,#2-0.5{1,1}],20,White],{}]&,{stat,positions},2]; Graphics[{gr1,gr2,gr3},PlotRange->{{-0.5,n+0.5},{-0.5,n+0.5}},ImageSize->500] ] Coalesce[stat_]:=SubCoalesce/@stat SubCoalesce[statlist_]:=Module[{st=statlist,n=Length[statlist],pairs}, st=Split[DeleteCases[st,0]]; st=Partition[#,2,2,1,{}]&/@st; st=Map[If[Length[#]==2,Total[#],#]&,st,{2}]; Join[Flatten[st],ConstantArray[0,n-Length[Flatten[st]]]] ] AddRandomNumber[stat_,n_:2]:=With[{pos=Position[stat,0,{2}]},If[Length[pos]>0,ReplacePart[stat,RandomChoice[pos]->n],stat]] stat=Nest[AddRandomNumber[#,RandomChoice[{2,4}]]&,ConstantArray[0,{n,n}],4]; Dynamic[PrintStat@stat]
And to stop the keyboard input:
SetOptions[InputNotebook[], NotebookEventActions -> {} ];
STAFF PICKS:
- Elastic bouncing in circular bowl
- [GiF] Turning in circles in a hexagon…
- Sonify: NASA Webb Telescope Pillars of Creation & Cellular Automata Rule 30
- [GiF] - Spawning regular polygons
- [GiF] Hilbert chasers: two lines following rotated curves
- [GiF] Chasing trefoil: varying a space-curve over time
- [ART] An infinite amount of wolves: chaos game with an exclusion region
- Approaching drums: simulating drops being ejected from drums
- Circular sunset/sunrise calendar
- [Gif] Genuary 2022: Abstract vegetation
- [GiF] Genuary 2022: VHS
- [GiF] Genuary 2022: Color gradients gone wrong - xkcd's painbow
- [GiF] Genuary 2022: 800x80 - distribution of points with Lloyd's algorithm
- [GiF] Genuary 2022: Architecture - Courtyard with 4 houses
- [GiF] Genuary 2022: Sol LeWitt Wall Drawing
- [GiF] Genuary 2022: trade styles with a friend
- Genuary 2022: Destroy a square - iteratively breaking up a quadrilateral
- Genuary 2022 Fidenza: stream plot with digits regions
- [Gif] Genuary 2022 Space: traveling tubes forming the digits
- [GiF] Genuary 2022 Dithering: randomizing and discretizing the digits
- [GiF] Bouncing rays in a grid of cylinders: 20-trillionth degree difference
- Peaceful chess queen armies
- Estimation of energy yield of 2020 Beirut port explosion
- [GIF] Moving bars illusion
- Factorio - Visualizing construction material dependencies
- [Numberphile] - Amazing Graphs III
- [Numberphile] - Amazing Graphs II
- [Numberphile] - How to make a binary prime logo
- Phase unwrapping
- Analysis of the Wolfram Community
- [Numberphile] - The Square-Sum Problem
- [Reddit-DiBB0118] Bubble chart for 4D data
- [ViZ] Formula One (F1) race: positions change over time
- Improvement on the magic number 0x5f3759df
- BinListsBy - Binning data with associate data
- Solving Suguru (Tectonic) puzzles
- [Numberphile] - Abelian Sandpiles - Done in the Wolfram Language
- [Numberphile] - Frog Jumping - Solving the puzzle
- [Numberphile] - The Illumination Problem
- The Chaos Game - part II
- The Chaos Game - infinitygon and Markov-chains - part III
- The Chaos Game - Sierpinski triangles and beyond - part I
- Merry Christmas!
- Exploration of polyhedron resistor networks
- Seam carving (liquid or content aware rescaling) in Wolfram Language
- A short exploration of the featured contributors
- [GIF] Waves of hexagonal columns
- Solving Hidato, Beehive, and Numbrix puzzles
- [GIF] Circle - Gecko - triangular tiling transformation inspired by Escher
- Roads to Lyon - done in the Wolfram Language
- Walking strandbeest dynamics
- [GIF] Jumping cube completion
- [GiF] Transit of Mercury 2016
- [GiF] Creating an Inception like intro logo animation
- [GIF] Walking cube
- How to Lego-fy your plots and 3D models...
- [GIF] Creating an animated Dragon curve fractal
- How to make 360 degree videos
- Solving the UK Intelligence Agency's Christmas Puzzle
- Solving a KenKen puzzle using logic
- GPS Mountainbike analysis