Paste: Euler Problems #11 in Starpial
Author: | KernelJ |
Mode: | text |
Date: | Tue, 25 Oct 2011 15:57:38 |
Plain Text |
(vert horiz diagdown diagup) concat max
[fourrows [vertproducts'] map] !vert
[fourrows [stagger vertproducts'] map] !diagdown
[fourrows [rev stagger vertproducts'] map] !diagup
[(rs (0 1 2 3)) :leave zipwith]#rs !stagger
[(0 1 2 3) [grid x leave]#x map zip] !fourrows
[grid [(0 1 2 3) [row x leave]#x map vertproducts']#row map] !horiz
[[* * *] zipwith] !vertproducts
...
((.numbers..) (...) ...) !grid
Author: | KernelJ |
Mode: | text |
Date: | Tue, 25 Oct 2011 16:04:07 |
Plain Text |
true $@running
() $@bidders
0 $@topbid
() $@topbidder
BidSocket.new @bidsocket
[
false =running
bidders :.stop map;
bidsocket.close
] Timer.new @timer
timer.start
[running]
[
(
bidsocket.acceptbidder @bidder .
bidders bidder push =bidders .
("Hello " ' bidder.name ' " welcome to the auction!" ') bidder.sendMessage ,
[running]
[
bidder topbidder = .
[
"You are the highest bidder! Waiting for new bids..." bidder.sendMessage ,
[bidder topbidder = running & .] while
bidder topbidder ~=
["You have been outbid!" bidder.sendMessage]
if
]
[
("The current bid is " ' topbid.show ' " by " ' topbidder.name '
"Please make a bid."') bidder.sendMessage ,
bidder.getBid @bid ,
bid bidder.balance,
["You do not have sufficient funds to make this bid!" bidder.sendMessage]
bid topbid <=
["Your bid was too low please try again." bidder.sendMessage]
[
"Your bid was accepted." bidder.sendMessage ,
bid =topbid bidder =topbidder ,
bidders [bidder ~=] filter [
("New bid of " ' bid.show ' " by " ' bidder.name ') b.sendMessage .
] #b map; ,
timer.reset
]
??#
]
?# ,
]
while
) [] #`
; .
]
while
bidders [
b topbidder =
[
b.balance topbid - b.=balance
("Congratulations you won the auction. " ' topbid.show '
" has been deducted from your account balance" ') b.sendMessage
]
[
("Auction won by " ' topbidder.name ' " with bid of " ' topbid.show ') b.sendMessage
]
?#
b.disconnect .
] #b map;
Author: | KernelJ |
Mode: | factor |
Date: | Tue, 25 Oct 2011 16:13:28 |
Plain Text |
true $@running
() $@bidders
0 $@topbid
() $@topbidder
BidSocket.new @bidsocket
[
false =running
bidders :.stop map;
bidsocket.close
] Timer.new @timer
timer.start
[running]
[
(
bidsocket.acceptbidder @bidder .
bidders bidder push =bidders .
("Hello " bidder.name " welcome to the auction!") concat bidder.sendMessage ,
[running]
[
bidder topbidder = .
[
"You are the highest bidder! Waiting for new bids..." bidder.sendMessage ,
[bidder topbidder = running & .] while
bidder topbidder ~=
["You have been outbid!" bidder.sendMessage]
if
]
[
("The current bid is " topbid.show " by " topbidder.name
"Please make a bid.") concat bidder.sendMessage ,
bidder.getBid @bid ,
bid bidder.balance >
["You do not have sufficient funds to make this bid!" bidder.sendMessage]
bid topbid <=
["Your bid was too low please try again." bidder.sendMessage]
[
"Your bid was accepted." bidder.sendMessage ,
bid =topbid bidder =topbidder ,
bidders [bidder ~=] filter [
("New bid of " bid.show " by " bidder.name) concat b.sendMessage .
] #b map; ,
timer.reset
]
??#
]
?# ,
]
while
) [] #`
; .
]
while
bidders [
b topbidder =
[
b.balance topbid - b.=balance
("Congratulations you won the auction. " topbid.show
" has been deducted from your account balance") concat b.sendMessage
]
[
("Auction won by " topbidder.name " with bid of " topbid.show) concat b.sendMessage
]
?#
b.disconnect .
] #b map;
New Annotation