Charts #2
@ -4,17 +4,18 @@ var express = require('express'),
|
|||||||
io = require('socket.io')(server)
|
io = require('socket.io')(server)
|
||||||
exec = require('child_process').exec
|
exec = require('child_process').exec
|
||||||
compression = require('compression')
|
compression = require('compression')
|
||||||
path = require('path');
|
path = require('path'),
|
||||||
|
router = express.Router();
|
||||||
|
|
||||||
|
|
||||||
server.listen(8088);
|
server.listen(8088);
|
||||||
app.use(express.static(__dirname + '/static'))
|
router.use(express.static(__dirname + '/static'))
|
||||||
app.use(compression())
|
router.use(compression())
|
||||||
app.use('/assets/', express.static(__dirname + '/../assets/'))
|
router.use('/assets/', express.static(__dirname + '/../assets/'))
|
||||||
|
|
||||||
|
|
||||||
var record = path.resolve(__dirname, '../record.py');
|
var record = path.resolve(__dirname, '../record.py');
|
||||||
app.get('/play', function(request, response) {
|
router.get('/play', function(request, response) {
|
||||||
var child = exec('python3 ' + record, { maxBuffer: 1024 * 5000 }, function(err, out, stderr) {
|
var child = exec('python3 ' + record, { maxBuffer: 1024 * 5000 }, function(err, out, stderr) {
|
||||||
if (err || stderr) {
|
if (err || stderr) {
|
||||||
console.log(err || stderr)
|
console.log(err || stderr)
|
||||||
@ -26,3 +27,5 @@ app.get('/play', function(request, response) {
|
|||||||
child.stdout.pipe(response);
|
child.stdout.pipe(response);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
app.use('/flappy-bird', router);
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
<title>Playing Flappy Bird using Evolution Strategies</title>
|
<title>Playing Flappy Bird using Evolution Strategies</title>
|
||||||
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
<meta name="author" content="Nebez Briefkani" />
|
|
||||||
<meta name="description" content="play floppy bird. a remake of popular game flappy bird using just html/css/js" />
|
|
||||||
<meta name="keywords" content="flappybird,flappy,bird,floppybird,floppy,html,html5,css,css3,js,javascript,jquery,github,nebez,briefkani,nebezb,open,source,opensource" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||||||
|
|
||||||
<!-- Open Graph tags -->
|
<!-- Open Graph tags -->
|
||||||
|
@ -513,7 +513,7 @@ function newGame() {
|
|||||||
|
|
||||||
$('#loading').addClass('active');
|
$('#loading').addClass('active');
|
||||||
|
|
||||||
fetch('/play').then(res => res.json()).then(function(states) {
|
fetch('play').then(res => res.json()).then(function(states) {
|
||||||
playing = true;
|
playing = true;
|
||||||
|
|
||||||
$('#loading').removeClass('active');
|
$('#loading').removeClass('active');
|
||||||
|
Loading…
Reference in New Issue
Block a user