| MoMonkey 的个人资料Monkey Coder日志列表网络 | 帮助 |
|
|
4月3日 CryptarithmA recent post to the Puzzles and Logic Problems alias at work.
The problem below is an example of a cryptarithm – a basic math problem made more difficult by obscuring each digit with a letter or other symbol.
In this problem, there are 10 unique letters. As an initial hint, S = 1. Each letter represents a unique integer ranging from 0-9, so given the hint that S = 1, no other letter is equal to ‘1’.
With some stolen code for the permutations function, my solution turned out pretty succinct in F#:
let let let validate attempt = let print = Seq.iter2 (printfn "%c = %i") "SABRELOMHV" let attempts = permutations [0..9] (Set.singleton s) 5月9日 Popfly Game CreatorAnd I thought Scratch was cool. Dang, Popfly Game Creator rocks! Be sure to watch the video... 6月28日 Binary Marble Adding MachineMatthias Wandel's "Binary Marble Adding Machine" is so cool!
I've actually thought to myself in the past that if I were stranded alone on an island I'd have to come up with some kind of mechanical computer so that I could still program 5月26日 Spaghetti CodeIf only it were as simple as:
Here is a graph of all the branches in Pacman for the Atari 2600 (find more at Ben Fry's site): 5月18日 ScratchJust heard about Scratch. What a super cool idea! So simple and fun. Some interesting innovations include the fact that you can run continuously while you change the program. Most of the syntax is enforced by the shapes of the pieces and it will allow for temporary syntax errors (such as an 'if' with nothing in it) and just keep on running. You can double click command blocks to execute them immediately. Very nice for on-the-fly tinkering. It's difficult to even create an error, but if you do (such as divide by zero) it will outline the block in red. You can have variables and can send and respond to messages sync or async (can even have multithreading bugs!) It's pretty powerful and even some of the basic limitations (e.g. no arrays) can be hacked around (e.g. storing data to the screen - as colored dots perhaps - and sampling to retrieve later). It's pretty incredible to see what people have built (e.g. a ray tracer!).
This is perfect for teaching kids! And best of all, you can share your projects and poke around with other people’s stuff. My son has made a bunch of pretty cool projects and mostly discovered things all on his own. BTW, here’s a little game I made: Now I've been thinking that it would be flippin' cool to make a functional variant of Scratch. At first I was trying to think of some domain that would be fun and would be a nice fit for a functional language. For example, some transformation problem like image processing (applying blur, emboss, etc. filters to photos) or some fractal rendering (like Fractal Flame). Now though, I've been reading about Functional Reactive Programming (Fran and Fruit in particular). That kind of thing could be applied to Scratch-style sprites. It would be very cool to see how well kids could pick up functional programming in a slick, dynamic Scratch-like environment. 4月25日 Code Monkey SongLOL! Mike Spiff Booth, a PM at Adobe, put Jonathan Coulton's song to a great WoW video!
|
|
|