Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -1,39 +1,39 @@
|
|||
void local fn DrawBalls( y as long, balls as CFArrayRef, sort as BOOL )
|
||||
long col, prevCol = 0, x = 10
|
||||
CFArrayRef cols = @[fn ColorWithSRGB(.78,.06,.18,1.0),fn ColorWhite,fn ColorWithSRGB(0,.24,.65,1.0)]
|
||||
if ( sort ) then balls = fn ArraySortedArrayUsingSelector( balls, @"compare:" )
|
||||
long col, prevCol = 0, x = 10
|
||||
CFArrayRef cols = @[fn ColorWithSRGB(.78,.06,.18,1.0),fn ColorWhite,fn ColorWithSRGB(0,.24,.65,1.0)]
|
||||
if ( sort ) then balls = fn ArraySortedArrayUsingSelector( balls, @"compare:" )
|
||||
|
||||
pen -1
|
||||
for long i = 0 to len(balls) - 1
|
||||
col = intval(balls[i])
|
||||
if ( sort == YES )
|
||||
if ( col != prevCol ) then y += 30 : x = 10
|
||||
else
|
||||
if ( i > 0 && i % 15 == 0 ) then y += 30 : x = 10
|
||||
end if
|
||||
oval fill (x,y,30,30), cols[col]
|
||||
x += 30
|
||||
prevCol = col
|
||||
next
|
||||
pen -1
|
||||
for long i = 0 to len(balls) - 1
|
||||
col = intval(balls[i])
|
||||
if ( sort == YES )
|
||||
if ( col != prevCol ) then y += 30 : x = 10
|
||||
else
|
||||
if ( i > 0 && i % 15 == 0 ) then y += 30 : x = 10
|
||||
end if
|
||||
oval fill (x,y,30,30), cols[col]
|
||||
x += 30
|
||||
prevCol = col
|
||||
next
|
||||
end fn
|
||||
|
||||
void local fn DutchNationalFlagProblem
|
||||
window 1, @"Dutch national flag problem", (0,0,470,230)
|
||||
WindowSetBackgroundColor( 1, fn ColorWithSRGB(1.0,.61,0,1.0) )
|
||||
window 1, @"Dutch national flag problem", (0,0,470,230)
|
||||
WindowSetBackgroundColor( 1, fn ColorWithSRGB(1.0,.61,0,1.0) )
|
||||
|
||||
CFMutableArrayRef balls = fn MutableArrayNew
|
||||
CFMutableArrayRef balls = fn MutableArrayNew
|
||||
|
||||
text @"Menlo-Bold",, fn ColorWhite
|
||||
text @"Menlo-Bold",, fn ColorWhite
|
||||
|
||||
for long i = 0 to 29
|
||||
balls[i] = @(rnd(3)-1)
|
||||
next
|
||||
for long i = 0 to 29
|
||||
balls[i] = @(rnd(3)-1)
|
||||
next
|
||||
|
||||
print @"Unsorted:"
|
||||
fn DrawBalls( 20, balls, NO )
|
||||
print @"Unsorted:"
|
||||
fn DrawBalls( 20, balls, NO )
|
||||
|
||||
print %(3,100)@"Sorted:"
|
||||
fn DrawBalls( 120, balls, YES )
|
||||
print %(3,100)@"Sorted:"
|
||||
fn DrawBalls( 120, balls, YES )
|
||||
end fn
|
||||
|
||||
random
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue