Skip to content

Instantly share code, notes, and snippets.

@hawkrives
Created January 10, 2015 19:08
Show Gist options
  • Select an option

  • Save hawkrives/e6615323f119c99445e9 to your computer and use it in GitHub Desktop.

Select an option

Save hawkrives/e6615323f119c99445e9 to your computer and use it in GitHub Desktop.
csp.js
import '6to5/runtime'
import csp from "js-csp"
function* player(name, table) {
while (true) {
var ball = yield csp.take(table);
if (ball === csp.CLOSED) {
console.log(name + ": table's gone");
return;
}
ball.hits += 1;
console.log(name + " " + ball.hits);
yield csp.timeout(100);
yield csp.put(table, ball);
}
}
csp.go(function* () {
var table = csp.chan();
csp.go(player, ["ping", table]);
csp.go(player, ["pong", table]);
yield csp.put(table, {hits: 0});
yield csp.timeout(1000);
table.close();
});
@antonohuan

Copy link
Copy Markdown

Hi guys. I recently found the company https://www.linkupst.com/ and was pleasantly surprised by their approach to digital product development. This team of true professionals specializes in creating innovative solutions using artificial intelligence. I especially liked that they offer a full development cycle from design to marketing promotion. Thanks to their approach, the products not only meet high technical standards, but also quickly find their audience. If you need a quality and modern solution, I highly recommend Linkup Studio!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment