27
4
Background
Person of Interest is a crime drama on CBS, and my favorite TV show, as of late.
The show is about a man named Harold Finch, a billionaire programmer, and his partner John Reese, a special forces veteran and ex-CIA operative. This programmer created a sentient AI called "The Machine" that predicts violent crimes before they happen. It tracks every person on Earth at all times by monitoring and analyzing all surveillance cameras and electronic communications across the globe.
Harold built The Machine for the United States government to detect terrorist activity before-the-fact. It divides the crimes that it predicts into lists based on whether or not they are relevant to national security. The relevant cases are handled by the government, while the "irrelevant" list is programmed to be deleted daily.
Harold made a small backdoor for himself in hopes to deal with the "irrelevant" list, himself. This backdoor causes The Machine to call the payphone nearest Harold (once every day or so) and read a Social Security number to him. This SSN belongs to someone whose life is in danger as part of a premeditated crime, or of someone who is planning such a crime.
The Challenge
Write a program that takes no input, and outputs 30 random phone numbers & SSNs (see below).
Output
There are two lines of text that will be printed every "day".
Crime predicted: 555-55-5555
Calling: 1-555-555-5555
followed by a newline
This process should repeat for one "month" (30 "days").
Phone Numbers
Every phone number must have the following elements:
Must have the United States country code (the first digit).
Must have a random area code (first set of three digits).
The first three digits of the phone number itself should be
555
, followed then by 4 random digits.
Here is an annotated example:
1-814-555-3857
| | | |
| | | |
| | | +----------> random four digits
| | |
| | +--------------> the set 555
| |
| +------------------> area code
|
+---------------------> country code
Social Security Numbers
Every SSN must be 9 random digits in the following format.
342-98-1613
Example
Crime predicted: 234-72-8311
Calling: 1-633-555-0188
Crime predicted: 135-77-0910
Calling: 1-202-555-4719
Crime predicted: 722-90-6653
Calling: 1-466-555-1069
...
Continuing for 27 more cycles.
Scoreboard
For your score to appear on the board, it should be in this format:
# Language, Bytes
Strikethroughs shouldn't cause a problem.
function getURL(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function getAnswers(){$.ajax({url:getURL(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),useData(answers)}})}function getOwnerName(e){return e.owner.display_name}function useData(e){var s=[];e.forEach(function(e){var a=e.body.replace(/<s>.*<\/s>/,"").replace(/<strike>.*<\/strike>/,"");console.log(a),VALID_HEAD.test(a)&&s.push({user:getOwnerName(e),language:a.match(VALID_HEAD)[1],score:+a.match(VALID_HEAD)[2],link:e.share_link})}),s.sort(function(e,s){var a=e.score,r=s.score;return a-r}),s.forEach(function(e,s){var a=$("#score-template").html();a=a.replace("{{RANK}}",s+1+"").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SCORE}}",e.score),a=$(a),$("#scores").append(a)})}var QUESTION_ID=58199,ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",answers=[],answer_ids,answers_hash,answer_page=1;getAnswers();var VALID_HEAD=/<h\d>([^\n,]*)[, ]*(\d+).*<\/h\d>/;
body{text-align:left!important}table thead{font-weight:700}table td{padding:10px 0 0 30px}#scores-cont{padding:10px;width:600px}#scores tr td:first-of-type{padding-left:0}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"><div id="scores-cont"><h2>Scores</h2><table class="score-table"><thead> <tr><td></td><td>User</td><td>Language</td><td>Score</td></tr></thead> <tbody id="scores"></tbody></table></div><table style="display: none"> <tbody id="score-template"><tr><td>{{RANK}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SCORE}}</td></tr></tbody></table>
How the task is written now, the time delay is obsolete for the output or algorithm to be valid. If anything, it disqualifies a lot of languages... – mınxomaτ – 2015-09-18T05:26:10.717
3Also, what are the valid values for US country codes / area codes? – mınxomaτ – 2015-09-18T05:28:01.500
2I've removed the time restriction. In regards to your second question, the US country code is explicitly a
1
. As for area codes, any three digits will do, for the purposes of this challenge. @minxomat – Zach Gates – 2015-09-18T05:29:42.173The Output section confuses me little. I've interpreted it as *There are three lines of text [...] 1. [...] 2. [...] followed by a blank line.* Is that correct? – Dennis – 2015-09-18T05:47:35.300
Perhaps you should define "random" more carefully
– Luis Mendo – 2015-09-18T12:21:05.9331
@LuisMendo there is a consensus on meta about what random means if not fully defined
– FryAmTheEggman – 2015-09-18T12:52:20.3735Of course, generating the numbers in the format they're actually transmitted by The Machine in the show would be even more complicated... ;) – Mason Wheeler – 2015-09-18T14:40:30.017
"In fact, only 555-0100 through 555-0199 are now specifically reserved for fictional use; the other numbers have been reserved for actual assignment" – DTI-Matt – 2015-09-18T16:00:23.347
1Who ya gonna call? @DTI-Matt – Zach Gates – 2015-09-18T16:15:10.360