<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: 實作Lua Closure二合一洗牌發牌機</title>
	<atom:link href="http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck</link>
	<description>遊戲開發‧遊戲程式‧遊戲設計</description>
	<lastBuildDate>Fri, 12 Mar 2010 09:50:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: 半路</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck/comment-page-1#comment-3782</link>
		<dc:creator>半路</dc:creator>
		<pubDate>Thu, 25 Feb 2010 08:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/?p=1086#comment-3782</guid>
		<description>@Derek:
你好，

我沒有學過 Python，看了一下你的程式碼，Python 似乎有內建的 shuffle 函式可用？再加上 Closure 的功能，果然將程式碼簡化不少哪～

謝謝你的資訊！ ^^</description>
		<content:encoded><![CDATA[<p>@Derek:<br />
你好，</p>
<p>我沒有學過 Python，看了一下你的程式碼，Python 似乎有內建的 shuffle 函式可用？再加上 Closure 的功能，果然將程式碼簡化不少哪～</p>
<p>謝謝你的資訊！ ^^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck/comment-page-1#comment-3724</link>
		<dc:creator>Derek</dc:creator>
		<pubDate>Fri, 12 Feb 2010 20:53:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/?p=1086#comment-3724</guid>
		<description>用python3  Closure 寫了個同樣的， 感覺python 更加簡潔

http://pastebin.com/f7ef71395</description>
		<content:encoded><![CDATA[<p>用python3  Closure 寫了個同樣的， 感覺python 更加簡潔</p>
<p><a href="http://pastebin.com/f7ef71395" rel="nofollow">http://pastebin.com/f7ef71395</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 半路</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck/comment-page-1#comment-3154</link>
		<dc:creator>半路</dc:creator>
		<pubDate>Fri, 27 Nov 2009 07:13:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/?p=1086#comment-3154</guid>
		<description>原本在文章中，最後一段程式碼裡的「發牌機加強版 」有點問題，在某種狀況下可能無法產出正確的牌，現在已經修改成正確的版本囉。

若有人要拿去用的話，記得先做完整的測試，如有發現臭蟲問題也歡迎回報！感謝！ ：D</description>
		<content:encoded><![CDATA[<p>原本在文章中，最後一段程式碼裡的「發牌機加強版 」有點問題，在某種狀況下可能無法產出正確的牌，現在已經修改成正確的版本囉。</p>
<p>若有人要拿去用的話，記得先做完整的測試，如有發現臭蟲問題也歡迎回報！感謝！ ：D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 半路</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck/comment-page-1#comment-3109</link>
		<dc:creator>半路</dc:creator>
		<pubDate>Fri, 20 Nov 2009 17:16:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/?p=1086#comment-3109</guid>
		<description>@R2D2:
os.clock() 確實無法提供 Profiler 所需的精密時間解析度哩。

在我目前有使用 Lua 的專案裡，還沒有達到需要用 Profiler 來做效能調校的程度；如果有需求的話，我應該會考慮用看看 &lt;a href=&quot;http://luaprofiler.luaforge.net/&quot; rel=&quot;nofollow&quot;&gt;LuaProfiler&lt;/a&gt; 吧。</description>
		<content:encoded><![CDATA[<p>@R2D2:<br />
os.clock() 確實無法提供 Profiler 所需的精密時間解析度哩。</p>
<p>在我目前有使用 Lua 的專案裡，還沒有達到需要用 Profiler 來做效能調校的程度；如果有需求的話，我應該會考慮用看看 <a href="http://luaprofiler.luaforge.net/" rel="nofollow">LuaProfiler</a> 吧。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: R2D2</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck/comment-page-1#comment-3094</link>
		<dc:creator>R2D2</dc:creator>
		<pubDate>Wed, 18 Nov 2009 02:02:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/?p=1086#comment-3094</guid>
		<description>撇開os.clock只能量時間不能做真正的profiling不說 解析度也太低啦</description>
		<content:encoded><![CDATA[<p>撇開os.clock只能量時間不能做真正的profiling不說 解析度也太低啦</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 半路</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck/comment-page-1#comment-3073</link>
		<dc:creator>半路</dc:creator>
		<pubDate>Fri, 13 Nov 2009 08:57:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/?p=1086#comment-3073</guid>
		<description>@Shark:
將發牌機弄成 message-based 多功能用途的物件，是個可以延伸的方向，不過也要考慮會不會使程式碼變得過於複雜難用。只要記得利用 Lua function 是 first-class value 這項特點，就可以節省許多不必要的 if-else 或其他控制結構囉。

另外，R2D2 指的應該是整合方案的 profiler 模組或第三方軟體。如果要自己用 os.clock() 慢慢做的話，當然沒問題，但是會花上很多額外的時間精力。</description>
		<content:encoded><![CDATA[<p>@Shark:<br />
將發牌機弄成 message-based 多功能用途的物件，是個可以延伸的方向，不過也要考慮會不會使程式碼變得過於複雜難用。只要記得利用 Lua function 是 first-class value 這項特點，就可以節省許多不必要的 if-else 或其他控制結構囉。</p>
<p>另外，R2D2 指的應該是整合方案的 profiler 模組或第三方軟體。如果要自己用 os.clock() 慢慢做的話，當然沒問題，但是會花上很多額外的時間精力。</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shark</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck/comment-page-1#comment-3070</link>
		<dc:creator>Shark</dc:creator>
		<pubDate>Fri, 13 Nov 2009 02:47:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/?p=1086#comment-3070</guid>
		<description>有個缺點：如果要用發牌機做不止一種工作呢？(即需要兩個以上的method)
我覺得可以改良成message based的方式

假如遊戲規則特殊，除了發牌以外還有把牌放回牌組的情況
定義一些動作ID
DECK_GETCARD=1
DECK_RETURNCARD=2

傳回來的函式物件改成如下
function(actionID, param1, param2) --要幾個參數就宣告幾個
裡面用一堆if…elseif(Lua沒有switch)根據actionID決定要做什麼事，param1和param2的意義依actionID而定

其實這很像Windows UI的WndProc運作的方式

Lua也有模擬class method的語法，像deck:getCard()這樣

函式包物件和物件包函式哪個好用？見仁見智

@R2D2:
用os.clock()</description>
		<content:encoded><![CDATA[<p>有個缺點：如果要用發牌機做不止一種工作呢？(即需要兩個以上的method)<br />
我覺得可以改良成message based的方式</p>
<p>假如遊戲規則特殊，除了發牌以外還有把牌放回牌組的情況<br />
定義一些動作ID<br />
DECK_GETCARD=1<br />
DECK_RETURNCARD=2</p>
<p>傳回來的函式物件改成如下<br />
function(actionID, param1, param2) &#8211;要幾個參數就宣告幾個<br />
裡面用一堆if…elseif(Lua沒有switch)根據actionID決定要做什麼事，param1和param2的意義依actionID而定</p>
<p>其實這很像Windows UI的WndProc運作的方式</p>
<p>Lua也有模擬class method的語法，像deck:getCard()這樣</p>
<p>函式包物件和物件包函式哪個好用？見仁見智</p>
<p>@R2D2:<br />
用os.clock()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 半路</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck/comment-page-1#comment-3023</link>
		<dc:creator>半路</dc:creator>
		<pubDate>Sun, 01 Nov 2009 02:30:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/?p=1086#comment-3023</guid>
		<description>@R2D2:
嗯，有道理。還是應該要先做過 profiling，才能確實知道哪一種實做方式的效能比較好。不過我和 Windows 平台的免費 profiler 很不熟，所以沒辦法給你推薦哩。可以參考看看 Ricky 介紹的連結！

@Ricky:
感謝你的補充！</description>
		<content:encoded><![CDATA[<p>@R2D2:<br />
嗯，有道理。還是應該要先做過 profiling，才能確實知道哪一種實做方式的效能比較好。不過我和 Windows 平台的免費 profiler 很不熟，所以沒辦法給你推薦哩。可以參考看看 Ricky 介紹的連結！</p>
<p>@Ricky:<br />
感謝你的補充！</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ricky</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck/comment-page-1#comment-3015</link>
		<dc:creator>Ricky</dc:creator>
		<pubDate>Thu, 29 Oct 2009 04:28:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/?p=1086#comment-3015</guid>
		<description>我有一些介紹

Non-invasive CPU profiler
http://sleepy.sourceforge.net/

C++ Memory profiler
http://mtlung.blogspot.com/2009/09/in-game-memory-profiler.html</description>
		<content:encoded><![CDATA[<p>我有一些介紹</p>
<p>Non-invasive CPU profiler<br />
<a href="http://sleepy.sourceforge.net/" rel="nofollow">http://sleepy.sourceforge.net/</a></p>
<p>C++ Memory profiler<br />
<a href="http://mtlung.blogspot.com/2009/09/in-game-memory-profiler.html" rel="nofollow">http://mtlung.blogspot.com/2009/09/in-game-memory-profiler.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: R2D2</title>
		<link>http://blog.monkeypotion.net/gameprog/concept/lua-closure-random-shuffle-deck/comment-page-1#comment-3010</link>
		<dc:creator>R2D2</dc:creator>
		<pubDate>Wed, 28 Oct 2009 16:34:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.monkeypotion.net/?p=1086#comment-3010</guid>
		<description>應該要profile一下看是Lua的swap assignment還是remove比較快

因為swap通常會產生unnamed temporary variable, 
而大部分的scripting language的variable creation都超慢
在loop裏面做會特別明顯~

呼叫remove時有給它index所以我猜速度是O(1), 
但是如果index只是當counter的話速度會是O(N), 
則用swap的方式會比較快很多~

題外話
可不可以推薦一些不錯的免費profiler? Windows平台用的~ 感恩~</description>
		<content:encoded><![CDATA[<p>應該要profile一下看是Lua的swap assignment還是remove比較快</p>
<p>因為swap通常會產生unnamed temporary variable,<br />
而大部分的scripting language的variable creation都超慢<br />
在loop裏面做會特別明顯~</p>
<p>呼叫remove時有給它index所以我猜速度是O(1),<br />
但是如果index只是當counter的話速度會是O(N),<br />
則用swap的方式會比較快很多~</p>
<p>題外話<br />
可不可以推薦一些不錯的免費profiler? Windows平台用的~ 感恩~</p>
]]></content:encoded>
	</item>
</channel>
</rss>
