[python] Sudoku

之前寫了一個專門解數讀的,無聊就寫一個可以產生簡單數讀的東西,跟之前差不多,只是可以用generate來產生新的盤面!

  Code

sudoku

[python] Scoping

Python now follow LEGB rule

LEGB Rule:

L. Local. (Names assigned in any way within a fuctnion (def or lambda), and not declared global in that function.

E. Enclosing function locals. (Name in the local scope of any and all enclosing functions (def or lambda), form inner to outer.

G. Global (module). Names assigned at the top-level of a module file, or declared global in a def within the file.

B. Built-in (Python). Names preassigned in the built-in names module : open,range,SyntaxError,…

And it’s the same when meeting Modules.

Ex: the example will print ‘A’ instead of  ‘main’

main.py
------------------------------------

import A
owner = 'main'
a = A.show()
A.py
-----------------------------------------

owner='A'
def show()
    print owner

[vim] python code auto complete

auto complete plugin
indent
It’s quite nice when I write python code :p

[Python] Sudoku Solver

之前在玩Sudoku, 剛好這兩天有空閒,就用python來寫一寫,順便玩了一下wxPython來做GUI,只要輸入盤面就可以顯示解答,也用了一下官方的IDE–IDLE,還是沒有vim順手XD,不過堪用就是~ 回到台灣後好久沒寫程式了,難得玩一下,很久沒用python了,都快忘光光了= =””, 不過寫這種暴搜似乎還是用C比較合我的口味~
Code
以下是screen shot: