NodeSchool教程stream-adventure的实现

/*************BEEP BOOP*****************/
//console.log('beep boop');

/*************MEET PIPE******************/
// var fs = require("fs");

// var file = process.argv[2];

// fs.createReadStream(file).pipe(process.stdout);

/**************INPUT OUTPUT*******************/
//process.stdin.pipe(process.stdout);

/***************TRANSFORM*********************/
// var through = require("through2");
// var stream = through(function(buffer, encoding, next) {
// 	this.push(buffer.toString().toUpperCase());
// 	next();
// }, function(done) {
// 	done();
// });

// process.stdin.pipe(stream).pipe(process.stdout);

/********************LINES *************************/
// var through = require("through2");
// var split = require("split");
// var flag = true;
// var stream = through(function(buf, _, next) {
// 	var out = flag ? buf.toString().toLowerCase() : buf.toString().toUpperCase();
// 	this.push(out + "\n");
// 	flag = !flag;
// 	next();
// });
// process.stdin.pipe(split()).pipe(stream).pipe(process.stdout);

/********************CONCAT***************************/
// var cs = require("concat-stream");
// var through = require("through2");

// function reverse(str) {
// 	var r = "";
// 	for (var i = str.length - 1; i >= 0; i--) {
// 		r += str.charAt(i);
// 	}
// 	return r;
// }

// var reverseServer = cs(function(body) {
// 	var out = reverse(body.toString());
// 	process.stdout.write(out);
// });

// process.stdin.pipe(reverseServer);

/*********************http server********************/
// var http = require("http");
// var through = require("through2");

// var port = process.argv[2];

// var upperCase = through(function(buf, _, next) {
// 	this.push(buf.toString().toUpperCase());
// 	next();
// });

// http.createServer(function(req, res) {
// 	if (req.method === "POST") {
// 		req.pipe(upperCase).pipe(res);
// 	} else {
// 		req.pipe(res);
// 	}
// }).listen(port);

/*********************http client***************************/
// var request = require("request");

// var r = request.post("http://localhost:8099/");

// process.stdin.pipe(r);
// r.pipe(process.stdout);

/**********************web socket*************************/
// var ws = require("websocket-stream");
// var w = ws("ws://localhost:8099/");
// w.write("hello\n");

/**********************html stream**********************************/
// var trumpet = require("trumpet");
// var through = require("through2");
// var fs = require("fs");

// var tr = trumpet();
// var ele = tr.select(".loud").createStream();

// var th = through(function(buf, _, next) {
// 	this.push(buf.toString().toUpperCase());
// 	next();
// });

// ele.pipe(th).pipe(ele);

// process.stdin.pipe(tr).pipe(process.stdout);

/********************************duplexer*******************************/
// var duplexer2 = require("duplexer2");
// var span = require("child_process").spawn;
// module.exports = function(cmd, args) {
// 	var cp = span(cmd, args);
// 	return duplexer2(cp.stdin, cp.stdout);
// }

/***************************duplexer***************************************/
// var duplexer2 = require("duplexer2");
// var through = require('through2');
// var test = function(counter) {
// 	var countries = {};
// 	var th = through.obj(function(obj, encoding, done) {
// 		if (obj.country in countries) {
// 			countries[obj.country]++;
// 		} else {
// 			countries[obj.country] = 1;
// 		}
// 		done();
// 	}, function(d) {
// 		counter.setCounts(countries);
// 		d();
// 	});
// 	var duplex = duplexer2({
// 		objectMode: true
// 	}, th, counter);
// 	return duplex;
// };

// module.exports = test;

/************************************COMBINER*************************************/
// var combine = require("stream-combiner");
// var split = require("split");
// var through = require("through2");
// var zlib = require("zlib");
// module.exports = function() {
// 	var temp = null;
// 	return combine(split(), through.obj(function(data, _, next) {
// 		if (data.length > 0) {
// 			data = JSON.parse(data);
// 			var _type = data["type"];
// 			var _name = data["name"];
// 			if (_type == "genre") {
// 				if (temp) {
// 					this.push(JSON.stringify(temp));
// 					this.push("\n");
// 				}
// 				temp = new Object();
// 				temp.name = _name;
// 				temp.books = new Array();
// 			} else if (_type == "book") {
// 				temp.books.push(_name);
// 			}
// 		}
// 		next();
// 	}, function(end) {
// 		if (temp) {
// 			this.push(JSON.stringify(temp));
// 			this.push("\n");
// 		}
// 		end();
// 	}), zlib.createGzip());
// }

/********************************CRYPTO*****************************/
var crypto = require("crypto");
var key = process.argv[2];
var stream = crypto.createDecipher('aes256', key);


process.stdin.pipe(stream).pipe(process.stdout);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
文字冒险是一种以文字为基础的游戏体验,玩家通过阅读描述和输入指令的方式进行游戏。这种游戏常常让玩家在一个虚拟世界中扮演主角,通过与游戏中的角色互动解决问题,达到完成故事情节的目标。 在一个文字冒险游戏中,玩家将通过阅读游戏中的文字描述了解游戏世界的背景、情节以及所处的环境。根据游戏情节的发展,玩家需要利用自己的想象力和逻辑推理能力来解决游戏中的谜题和困难。玩家通过输入指令来控制主角进行行动,例如“向前走”、“拿起钥匙”等等。游戏会根据玩家输入的指令进行相应的反馈,继续推动故事情节的发展。 文字冒险游戏依赖于玩家的想象力和阅读理解能力。玩家需要根据游戏中描述的场景和物品来确定下一步行动,同时还需要运用逻辑思维来解决谜题。由于文字冒险游戏没有图像或声音的辅助,玩家必须通过想象力来构建游戏世界,这种体验带来了无限的可能性和创造力。 文字冒险游戏曾经是游戏界的热门类型,尤其在早期个人电脑的时代。随着技术的进步,图形化和声音化的游戏体验逐渐成为主流,文字冒险游戏的人气有所下降。然而,一些游戏开发者仍然推出新的文字冒险游戏,以保留这种传统游戏形式的魅力。 总的来说,文字冒险游戏是一种让玩家通过阅读和输入指令的方式与虚拟世界进行互动的游戏。这种游戏体验依赖于玩家的想象力和阅读理解能力,带来了独特的创造力和挑战。即使在图形化游戏主导的时代,文字冒险游戏仍然保留着一定的市场和受众。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值