<?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"
	>
<channel>
	<title>Comments on: 簡單有兩種…</title>
	<atom:link href="http://www.jeffhung.net/blog/articles/jeffhung/1068/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeffhung.net/blog/articles/jeffhung/1068/</link>
	<description>(My smile insists of having nose. :-)</description>
	<pubDate>Wed, 20 Aug 2008 18:02:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1-alpha</generator>
		<item>
		<title>By: jeffhung</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1068/#comment-92235</link>
		<dc:creator>jeffhung</dc:creator>
		<pubDate>Fri, 25 Apr 2008 09:58:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/1068/#comment-92235</guid>
		<description>&lt;p&gt;Peggy,&lt;/p&gt;
&lt;p&gt;很抱歉，這看起來一點也不簡單耶。:-p&lt;/p&gt;
&lt;p&gt;Jeff Hung&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Peggy,</p>
<p>很抱歉，這看起來一點也不簡單耶。:-p</p>
<p>Jeff Hung</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peggy</title>
		<link>http://www.jeffhung.net/blog/articles/jeffhung/1068/#comment-87881</link>
		<dc:creator>Peggy</dc:creator>
		<pubDate>Tue, 26 Feb 2008 20:37:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.jeffhung.net/blog/articles/jeffhung/1068/#comment-87881</guid>
		<description>你好
我是一個在美國讀書的大學生
最近在學processing
因為以前都沒有接觸過
第一次學真的覺得很難
有一個作業我也不太會做
而我在yahoo搜尋到你的網站
不知道你願不願意替我解答一個問題
如不方面也沒關係 謝謝
我利用processing寫了一個如下
int yNext = 0;        // y coordinate of next bar to draw
int currHeight;       // height of current bar drawn
int counter = 0;      // number of bars on screen (reset each time screen filled)
int magic = 0;        // index of the "magic" bar
int magicRange;       // when determining value of magic: 0 &#60;= magic &#60;= magicRange
int completedCounter; // number of times the screen has been filled
                      // (reset every time counterValues is filled)
int[] counterValues = new int[10];  // number of bars drawn for 10 filled screens
                                    // (average these values to get magicRange)


void setup() {
  size(200, 500);
  frameRate(15);
  
  // precalculations: do the same work as draw() without drawing
  // to find a valid value of counter (use as temp. magicRange)
  while (yNext = height) {
    yNext = 0;
    magic = randomInt (0, magicRange);


    // store counter in next available space in counterValues    
    counterValues[completedCounter] = counter;
    completedCounter++;
    
    // when counterValues is full, average values and use as new magicRange
    if (completedCounter == counterValues.length) {
      completedCounter = 0;
      magicRange = 0;
      for(int i=0; i&#60;counterValues.length; i++)
        magicRange += counterValues[i];
      magicRange /= counterValues.length;  
    }


    println ("magic: " + magic + "  counter: " + counter + "  magicRange: " + magicRange);
    counter = 0;
    
  }
}


// return a random integer in range minval &#60;= x &#60;= maxVal
int randomInt(int minVal, int maxVal) {
  return int(random(minVal, maxVal+1)); 
}


當我們按play的時候會出現很多顏色bar會有其中一個特別不一樣
我們的作業內容是要我們寫出一個程式讓那個不一樣的顏色變成其他顏色的對比色
就像是所有的bar如果都是綠色類的就要把那個特別的變成橘色類
藍色了話就要和黃色
不知道你能不能幫我解決這個問題
如果可以真的非常感謝!!!!</description>
		<content:encoded><![CDATA[<p>你好<br />
我是一個在美國讀書的大學生<br />
最近在學processing<br />
因為以前都沒有接觸過<br />
第一次學真的覺得很難<br />
有一個作業我也不太會做<br />
而我在yahoo搜尋到你的網站<br />
不知道你願不願意替我解答一個問題<br />
如不方面也沒關係 謝謝<br />
我利用processing寫了一個如下<br />
int yNext = 0;        // y coordinate of next bar to draw<br />
int currHeight;       // height of current bar drawn<br />
int counter = 0;      // number of bars on screen (reset each time screen filled)<br />
int magic = 0;        // index of the "magic" bar<br />
int magicRange;       // when determining value of magic: 0 &lt;= magic &lt;= magicRange<br />
int completedCounter; // number of times the screen has been filled<br />
                      // (reset every time counterValues is filled)<br />
int[] counterValues = new int[10];  // number of bars drawn for 10 filled screens<br />
                                    // (average these values to get magicRange)</p>
<p>void setup() {<br />
  size(200, 500);<br />
  frameRate(15);</p>
<p>  // precalculations: do the same work as draw() without drawing<br />
  // to find a valid value of counter (use as temp. magicRange)<br />
  while (yNext = height) {<br />
    yNext = 0;<br />
    magic = randomInt (0, magicRange);</p>
<p>    // store counter in next available space in counterValues<br />
    counterValues[completedCounter] = counter;<br />
    completedCounter++;</p>
<p>    // when counterValues is full, average values and use as new magicRange<br />
    if (completedCounter == counterValues.length) {<br />
      completedCounter = 0;<br />
      magicRange = 0;<br />
      for(int i=0; i&lt;counterValues.length; i++)<br />
        magicRange += counterValues[i];<br />
      magicRange /= counterValues.length;<br />
    }</p>
<p>    println ("magic: " + magic + "  counter: " + counter + "  magicRange: " + magicRange);<br />
    counter = 0;</p>
<p>  }<br />
}</p>
<p>// return a random integer in range minval &lt;= x &lt;= maxVal<br />
int randomInt(int minVal, int maxVal) {<br />
  return int(random(minVal, maxVal+1));<br />
}</p>
<p>當我們按play的時候會出現很多顏色bar會有其中一個特別不一樣<br />
我們的作業內容是要我們寫出一個程式讓那個不一樣的顏色變成其他顏色的對比色<br />
就像是所有的bar如果都是綠色類的就要把那個特別的變成橘色類<br />
藍色了話就要和黃色<br />
不知道你能不能幫我解決這個問題<br />
如果可以真的非常感謝!!!!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
