Skip to content

Instantly share code, notes, and snippets.

@hplc
Last active June 19, 2019 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hplc/d9f99889cad321a9ec5aef2e4c46952f to your computer and use it in GitHub Desktop.
Save hplc/d9f99889cad321a9ec5aef2e4c46952f to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php
$terms = [
"下行物理过程有几个" => "5",
"上行物理过程有几个" => "4",
"手机开机,会马上涉及到什么物理过程" => "小区搜索过程",
"小区切换,会涉及到什么物理过程" => "小区搜索过程",
"小区切换,会涉及到什么物理过程" => "小区搜索过程",
"UE开机经历了小区搜索过程,随机接入过程后,有其他UE向其拨号,首先会发生什么过程" => "寻呼过程",
"小区搜索过程涉及到三个信道(中文表述,三个信道之间用中文逗号间隔)" => "同步信道,参考信道,广播信道",
"主要完成用户信息在网络侧的注册,是什么物理过程" => "随机接入过程",
"LTE功率控制,执行方需要对方反馈控制信息,称为" => "闭环功率控制",
"LTE功率控制,执行方不需要对方反馈控制信息,称为" => "开环功率控制",
"DRX的英文全称为" => "Discontinuous Reception",
"ARQ的英文全称为" => "Automatic Repeat-reQuest",
"FEC的英文全称为" => "Forward Error Correction",
"HARQ重传机制有三种(中文表述,三钟机制之间用中文逗号间隔)" => "停止等待,回退,选择重传",
"SAW的英文全称为" => "Stop-AND-Wait"
];
system("clear");
$name = readline("Input Your Exam Name(Like: 04-张三): ");
system("date");
$time_start = time();
$count = count($terms);
echo PHP_EOL;
echo "Hello, $name!";
echo PHP_EOL;
$line = "Init";
$i = 0;
// while ($term = current($terms)) {
// $key = key($terms);
while ($key = array_rand($terms)) {
$term = $terms[$key];
$i++;
while ($line !== $term) {
if ($line !== "Init") {
echo "Wrong! Try again!" . PHP_EOL;
}
$line = readline("$i/$count. $key: ");
}
echo "Good!";
$line = "Init";
echo PHP_EOL;
// next($terms);
unset($terms[$key]);
}
system("date");
$time_end = time();
echo PHP_EOL;
$seconds = $time_end - $time_start;
echo "$name, you finished the test in " . $seconds . " seconds!";
echo PHP_EOL;
echo "Great!!!";
echo PHP_EOL;
$content = "$name: $seconds seconds, " . date('Y-m-d H:i:s', $time_end) . "\n";
file_put_contents("./lte-exam.log", $content, FILE_APPEND | LOCK_EX);
while (true) { readline(); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment