2013年12月21日 星期六

寫給超新手瑪莉歐類型遊戲製作的小技巧

瑪莉歐類型遊戲製作,
對於關卡地圖,
一開始我以為是用一個raw data,
例如用0x00代表背景,0x01代表磚塊,0x02代表金幣…等,
但是這樣在製作關卡地圖,就沒有視覺化。
今天,我看過一個open source python寫的瑪莉歐程式碼,
發現有一個辦法可以使瑪莉歐遊戲關卡稍微視覺化,
就是用一個圖檔,例如*.png檔裡的顏色,來對應到關卡,
如用黃色代表磚塊,金色代表金幣…等。
為了製作方便,可以讓遊戲主程式直接用顏色判斷,
來形成關卡。若是打算要正式商業化發行,
可以寫一個*.png轉raw data的小程式,
讓遊戲主程式來讀raw data,而不用包入*.png。

 

2013年12月9日 星期一

線上嘸蝦米

此軟體原本的出處是「蝦米族樂園」,是由一群愛好嘸蝦米輸入法的使用者,共同創造出來的。真的非常實用,所以在行易與蝦米族樂園共同合作之下,在官方網站,也提供了這樣的功能。

2013年11月27日 星期三

Windows 2008 R2 boot問題的修復(轉貼)

  1. Put the Windows Server 2008 R2 installation disc in the disc drive, and then start the computer.
  2. Press any key when the message indicating “Press any key to boot from CD or DVD …”. appears.
  3. Select a language, time, currency, and a keyboard or another input method. Then click Next.
  4. Click Repair your computer.
  5. Click the operating system that you want to repair, and then click Next.
  6. In the System Recovery Options dialog box, click Command Prompt.
  7. Type Bootrec /RebuildBcd, and then press ENTER

2013年8月24日 星期六

Python: operator priority for ==, in

提供一個Python超新手的錯誤,注意以下程式碼:
>>> b = [1, 2]
>>> False == 3 in b
False

如要得到True,請改成:
>>> False == (3 in b)
True

2013年5月11日 星期六

vector string example

    string S[3]={"xxo", "oox", "o"};
    string T[4]={"x", "o", "x", "o"};
    string U[3]={"ooo", "xxxoo", "oxx"};
    vector vs(S, S+3);
    vector vt(T, T+4);
    vector vu(U, U+3);
    //FloodFill3D F;
    //cout<

2013年3月2日 星期六

ideone常見問題

Notepad++ Plugins - Browse /PyNPP at SourceForge.net


Notepad++ Plugins - Browse /PyNPP at SourceForge.net:

想在Notepad++執行Python Code,請用PyNPP取代NppExec會比較好用。
如果執意要用NppExec的話,請參考以下在NppExec中可run的script:

NPP_SAVE
CD $(CURRENT_DIRECTORY)
SET python = C:\Python27_x86\python.exe
"$(python)" "$(FULL_CURRENT_PATH)"
UNSET python


如果想要即時print且在python 3.6上,可以使用以下:

NPP_SAVE
CD $(CURRENT_DIRECTORY)
SET python = D:\Program Files\Python36\python.exe
"$(python)" -u "$(FULL_CURRENT_PATH)"
UNSET python


Note: unbuffered mode. This is done with the -u flag.

TCO 2012 Round 3B - TopCoder Wiki

TCO 2012 Round 3B - TopCoder Wiki:

對於CrossingTheRiver這題,
我嘗試去寫,卻一直Time Limit Exceed(超過2 seconds),
最後只好上網看解答…
我把我的TLE code貼在Ideone上:

看了AC code,原來我根本搞錯題意了,

這題的Blocks似乎不一定要擺完,
只要Blocks有辦法填滿Depth就可以直接過去了。 
CrossingTheRiver cr;
int my[] = {3, 3, 3, 3, 3, 4};
vector c(my, my + sizeof(my) / sizeof(int));
//AC code is possible, but my code is impossible.

2013年3月1日 星期五

用Notepad ++的plugin NppExec 執行 C++ Code

網路上有一篇文章

Notepad++ Compiler

提到可以用Notepad++當compiler,
不過對於C++的code要怎麼寫script來compiler卻沒說到,
我Google了一下,結合各家寫法,
 用以下script來run C++ code,效果還不錯,分享給大家:

NPP_SAVE
SET g++ = E:\Program Files (x86)\Dev-Cpp\MinGW64\bin\g++.exe
SET obj = $(CURRENT_DIRECTORY)\$(NAME_PART)
"$(g++)" -c "$(FULL_CURRENT_PATH)" -o "$(obj).o"
"$(g++)" "$(obj).o" -o "$(obj).exe"
NPP_RUN "$(obj).exe"
UNSET obj

UNSET g++


其中E:\Program Files (x86)\Dev-Cpp\MinGW64\bin\g++.exe是
C++ compiler g++的位置,只要修改這個成自己的位置就可以使用了。
若是要用C++ 11,可用以下的寫法:

NPP_SAVE
SET g++ = C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\x86_64-w64-mingw32-g++.exe
SET obj = $(CURRENT_DIRECTORY)\$(NAME_PART)
"$(g++)" -std=c++11 -c "$(FULL_CURRENT_PATH)" -o "$(obj).o"
"$(g++)" "$(obj).o" -o "$(obj).exe"
NPP_RUN "$(obj).exe"
UNSET obj
UNSET g++

個人合成作品