├── .gitattributes ├── .gitignore ├── README.md ├── ex1 ├── ex1.py └── guess_number.py ├── ex2 └── FizzBuzz.py ├── ex3 └── guess_number_AI.py ├── ex4 └── clock.py ├── text.txt └── words.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PythonExercises 2 | 3 | 一些按照难度排列的Python练习题。欢迎提交你的答案或添加更多有趣的题目! 4 | 5 | 从开始学Python以来,接触了不少练习题。下面十个练习题,是我做出来的和想做出来的题里比较有趣的,现在按照难度由低到高排列。欢迎到GitHub上提交你的答案。 6 | 7 | 8 | 9 | ## 1. 猜数字 10 | 11 | 经典的猜数字游戏,几乎所有人学编程时都会做。 12 | 13 | **功能描述:** 随机选择一个三位以内的数字作为答案。用户输入一个数字,程序会提示大了或是小了,直到用户猜中。 14 | 15 | 16 | 17 | ## 2. FizzBuzz 18 | 19 | 另一道经典编程题。 20 | 21 | **功能描述:** 遍历并打印0到100,如果数字能被3整除,显示Fizz;如果数字能被5整除,显示Buzz;如果能同时被3和5整除,就显示FizzBuzz。结果应该类似:0,1,2,Fizz,4,Buzz,6……14,FizzBuzz,16…… 22 | 23 | 24 | 25 | ## 3. 猜数字的AI 26 | 27 | 和猜数字一样,不过这次是设计一个能猜数字的AI 28 | 29 | **功能描述:** 用户输入一个单位以内的数字,AI要用最少的次数猜中,并且显示出猜的次数和数字。 30 | 31 | 32 | 33 | ## 4. 整点报时 34 | 35 | 老式挂钟会在整点的报时,响铃的次数和时间相等。我们设计一个在电脑上运行的报时器。 36 | 37 | **功能描述:** 运行后,在每一个整点长响一声,半个整点短响两声。实现睡眠模式,晚上十二点到早上六点不响铃。 38 | 39 | 40 | 41 | ## 5. 敏感词审查 42 | 43 | 一向痛恨网络审查的你成了某网站的审查员,要求审查网络上违反上头规定的名词。 44 | 45 | **功能描述:** 要审查的帖子在仓库根目录的text.txt文件里,要求将所有的和谐,自由,民主,六四替换为*号。 46 | 47 | 48 | 49 | ## 6. 文字冒险游戏 50 | 51 | 你想做个清新脱俗的文字游戏,只在命令行的黑框里运行。 52 | 53 | **功能描述:** 尽量参考回合制RPG游戏的模式,游戏剧情自编,要有战斗模式,主角有HP属性,战斗和吃东西会对HP有相应的增减效果。 54 | 55 | 56 | 57 | ## 7. 词频统计 58 | 59 | 你想分析某个英语写作者的写作风格,你想先从他使用词语的频率入手。 60 | 61 | **功能描述:** 分析仓库根目录的 words.txt 文件里的词频,按照出现频率由高到低排列结果,不区分大小写,过滤掉标点(可以使用正则表达式)。结果类似ok:234,play:122,funny:78 62 | 63 | 64 | 65 | ## 8. Markdown转换器 66 | 67 | 你一向喜欢在Windows的记事本里写文章,为了能方便的生成网页,你使用Markdown的格式写了篇文章,现在需要一个把Markdown转换成HTML格式的程序。 68 | 69 | **功能描述:** 将仓库根目录README.md文件里的内容转换成HTML文档。要尽可能的支持Markdown标签,越多越好。建议使用正则表达式。 70 | 71 | 72 | 73 | ## 9. 邮件轰炸机 74 | 75 | 你的一个朋友生日快到了,你决定搞个恶作剧——用邮件塞满他的邮箱。 76 | 77 | **功能描述:** 首先去注册十个邮箱,然后用这是个邮箱轮流发送随机生成的邮件内容给你的朋友。调整发送的频率,以免被服务器拒绝。 78 | 79 | 80 | 81 | ## 10. 用邮件控制电脑 82 | 83 | 你的电脑放在宿舍,这时你在教室上课,你又决定搞个恶作剧吓吓装病请假在宿舍玩游戏的室友。 84 | 85 | **功能描述:** 使用邮件发送特定的命令,让电脑上的程序判断发信方是否为控制邮箱,如果是就执行发送过来的命令。通过不同的方式实现尽可能多的功能。 86 | 87 | 88 | 89 | 想要更多的挑战?可以去这里看看:http://www.pythonchallenge.com/ 90 | -------------------------------------------------------------------------------- /ex1/ex1.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | c_choice = random.randint(100,999) 4 | a = int(input("Guess a number?(100-999) ")) 5 | running = True 6 | 7 | while running: 8 | 9 | if a == c_choice: 10 | print("BINGO!") 11 | running = False 12 | 13 | elif a < c_choice: 14 | print("The answer is bigger.") 15 | a = int(input("Try again~ ")) 16 | 17 | elif a > c_choice: 18 | print("The answer is smaller.") 19 | a = int(input("Try again~ ")) 20 | -------------------------------------------------------------------------------- /ex1/guess_number.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | author: lihui 4 | website: withlihui.com 5 | """ 6 | import random 7 | 8 | number = random.randrange(1, 100) 9 | running = True 10 | 11 | while running: 12 | guess = int(raw_input("Guess a number(1~100):")) 13 | 14 | if guess == number: 15 | print "Congratulations! You win!" 16 | running = False 17 | 18 | elif guess < number: 19 | print "Too small! :(" 20 | 21 | else: 22 | print "Too big! :(" 23 | -------------------------------------------------------------------------------- /ex2/FizzBuzz.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | :author: lihui 4 | :website: withlihui.com 5 | Let computer guess a number 6 | """ 7 | numbers = range(1,101) 8 | 9 | for i in numbers: 10 | if i%3==0 and i%5==0: 11 | print 'FizzBuzz' 12 | elif i%3==0: 13 | print 'Fizz' 14 | elif i%5==0: 15 | print 'Buzz' 16 | else: 17 | print i -------------------------------------------------------------------------------- /ex3/guess_number_AI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | :author: lihui 4 | :website: withlihui.com 5 | Let computer guess a number 6 | """ 7 | 8 | while True: 9 | try: 10 | num = int(raw_input('Enter a number: ')) 11 | except ValueError: 12 | print "The input must be a integer!" 13 | continue 14 | break 15 | 16 | guess = num / 2 17 | middle = num / 4 18 | step = 0 19 | 20 | while guess != num: 21 | if num > guess: 22 | guess += middle 23 | print "I gusee: ", guess 24 | elif num < guess: 25 | guess -= middle 26 | print "I gusee: ", guess 27 | middle /= 2 28 | if middle == 0: 29 | middle = 1 30 | step += 1 31 | 32 | print "Aha! The answer is: ", guess 33 | print "I totally use %d steps." % step 34 | -------------------------------------------------------------------------------- /ex4/clock.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | A beep clock 4 | ------------- 5 | : author: lihui 6 | : website: withlihui.com 7 | """ 8 | import winsound 9 | from time import sleep, localtime 10 | 11 | 12 | def beep(): 13 | if m == 59: 14 | winsound.Beep(1000, 500) # one long beep 15 | elif m == 29: 16 | winsound.Beep(1000, 200) # two short beep 17 | winsound.Beep(1000, 200) # two short beep 18 | 19 | 20 | if __name__ == "__main__": 21 | while True: 22 | now = localtime() 23 | m = now.tm_min 24 | s = now.tm_sec 25 | sleep(60 - s) # refresh every minute. 26 | beep() 27 | -------------------------------------------------------------------------------- /text.txt: -------------------------------------------------------------------------------- 1 | 六四事件,又称六四天安门事件,中华人民共和国政府及中国共产党起初称之为反革命暴乱,在江朱时期和胡温时期改称为1989年春夏之交的政治风波[6][7]或1989年政治风波[8][9][10],2019年又将政治风波和反革命暴乱两个称呼并列重提[11],广义上指八九民运,是自1989年4月开始,由中国高校学生在北京市天安门广场发起,持续近两个月的全国示威运动[12][13];狭义上又指六四清场,即1989年6月3日晚间至6月4日凌晨,中国人民解放军、武装警察部队和人民警察在北京天安门广场对示威集会进行的武力清场行动。 2 | 3 | 1989年4月15日,前中共中央总书记胡耀邦因心脏病猝逝,许多北京大学生与市民便在天安门广场举办悼念活动[14]。在部分大学生主导下,原本单纯悼念的活动转向要求政府控制通货膨胀、处理失业问题、解决官员贪腐、政府问责、新闻自由、民主政治与结社自由等[15][16][17]。期间最多有一百万人聚集在天安门广场示威[18]。以时任中共中央总书记赵紫阳为首的温和派希望与示威群众展开谈判达成和解[19]。 4 | 5 | 在5月中旬,学生发起绝食行动,促使中国各地四百多个城市陆续集结抗议,表态支持[20]。一连串游行后,以中央军委主席邓小平及国务院总理李鹏为首的强硬派决定以武力解决示威,中顾委主任陈云、时任国家主席杨尚昆和全国政协主席李先念等多位保守派中共元老亦支持出兵[21]。5月20日,李鹏代表国务院宣布北京市实施戒严[22][23],中共中央军委调动解放军三十万兵力前往北京[20]。最终解放军在6月3日晚至6月4日凌晨实施清场并控制了天安门广场。由于中国官方拒绝提供更多事件资料,导致数据模糊且出现多种版本,单是死亡人数的估计便从百余人至上万人都有[24]。 6 | 7 | 之后,中华人民共和国政府声称“为了维护社会稳定,对政治风波采取了果断措施”[25],进行了大规模逮捕示威民众和支持者,并镇压其他地区进行的抗议活动;同时严格控制国内新闻媒体对事件之报导,并禁止外国记者将相关照片和采访影像发送至国外。国际社会则谴责中华人民共和国政府以武力驱离示威群众,许多西方国家亦一度实施经济制裁,并至今实行武器禁运[16]。 8 | 9 | 六四事件导致时任中共中央总书记赵紫阳被免去所有职务[26],包括政治局常委胡启立在内,许多同情抗议活动的中共官员也被降级或免职,中共上海市委书记江泽民被提拔为新任中共中央总书记和第三代领导核心[27]。许多参与八九民运的人士则流亡海外,并被政府禁止返回中国大陆[28]。这次风波后,中共党内强硬派抬头,改革开放政策停滞,直到1992年邓小平南巡后才重新恢复;原先在1980年代逐渐开放的人权、民主政策等政治改革也暂止进行[29][30]。中共中央机关报在运动中期称其为“动乱”,后谴责为“反革命暴乱”。至今六四事件在中国大陆仍为敏感话题被严格限制讨论或悼念[31],在中国大陆以外地区仍有许多人主张转型正义[32][33]。 10 | 11 | 六四事件又被称作六四天安门事件[34][35]、八九民运或是八九学运,中华人民共和国政府称1989年春夏之交的政治风波[36],欧美国家则以天安门广场抗议(Tian'anmen Square protests)或天安门广场大屠杀(Tian'anmen Square massacre)称呼这次事件[37]。 12 | 13 | 此为1989年于北京市发起的抗议活动,经常被称呼为“六四事件”,有时候会直接简称“六四”。抗议的命名依据,一方面是要和过去发生在天安门广场的重要活动有一致的命名习惯,包括1919年的五四运动、1976年的四五运动等;另一方面“六四”是中国人民解放军进驻天安门广场、要求抗议群众撤离的日子,尽管军队在6月3日晚上便执行清场任务。当描述事件发展过程,通常会用“八九民运”、“八九学运”等称呼,亦有人使用“六四运动”描述整起示威活动。批评中国政府镇压抗议事件时,中国大陆以外的中文地区则将事件称作“六四镇压”或“六四屠杀”[38]。 14 | 15 | 在中国境内,上述名称皆于搜索引擎或公开论坛上被列为“敏感词”。为了要绕过网络审查,互联网上出现许多形容六四事件的替代称呼[39],包括有“5月35日”、“VIIV”(“6”和“4”的罗马数字写法)和“8平方”(82 = 64)等[32][40]、“农历五月初一”(1989年6月4日为农历已巳年五月初一,这个表述一般情况很难被认为是六四的意思),对于“1989年”,则用“民国78年”、“平成元年”等字眼规避审查。随着上述字词在中国网站上传播甚广,现在中国境内的多数网站也将这些视为自我审查词汇。又如,在QQ中输入“六四事件”会显示“敏感词汇”,在百度中搜索“六四事件”则直接显示“四五运动”(与六四事件同为天安门事件),在百度贴吧里面搜索“六四事件”“5月35日”“8平方事件”“VIIV事件”都会显示“抱歉,根据相关法律法规和政策,相关结果不予展现”。而自1989年以后,中华人民共和国政府也用数个名称指称六四事件,并借由修改事件称呼的方式,逐渐降低事件对往后社会大众的影响[33]。在事件刚发生之际,中国政府将其命名为“动乱”,后升级为“反革命暴乱”,事件结束后以“六四风波”指称。最后政府将当天的冲突全部改成更为中立的名称,也就是今日持续使用的“1989年春夏之交的政治风波”这类短语[33][41]。 16 | 17 | 西方世界在描述一系列事件经过时,经常使用“1989年天安门广场抗议”(英语:Tiananmen Square Protests of 1989)或“天安门镇压”(Tiananmen Square Crackdown)。1990年代时西方新闻媒体经常使用“天安门大屠杀”(Tiananmen Square Massacre)这类字词[42],但在近年的相关报导中则逐渐减少[21]。主要是因为绝大部分暴力冲突并非发生在天安门广场上,而是在北京城西的木樨地[21]。不过“天安门广场抗议”或是“天安门事件”等字词,容易让人误以为整个示威活动只发生在北京市,然而当时中国许多城市都有出现相关的抗议活动[21]。 18 | 19 | 引用自 维基百科 https://zh.wikipedia.org/zh-cn/%E5%85%AD%E5%9B%9B%E4%BA%8B%E4%BB%B6 -------------------------------------------------------------------------------- /words.txt: -------------------------------------------------------------------------------- 1 | In the brightly lit robotics workshop at Abyss Creations’ factory in San Marcos, California, a life-size humanoid was dangling from a stand, hooked between her shoulder blades. Her name was Harmony. She wore a white leotard, her chest was thrust forward and her French-manicured fingers were splayed across the tops of her slim thighs. 2 | The race to build the world’s first sex robot 3 | The $30bn sex tech industry is about to unveil its biggest blockbuster: a $15,000 robot companion that talks, learns, and never says no 4 | 5 | by Jenny Kleeman 6 | 7 | Harmony is a prototype, a robotic version of the company’s hyper-realistic silicone sex toy, the RealDoll. The Realbotix room where she was assembled was lined with varnished pine surfaces covered with wires and circuit boards, and a 3D printer whirred in the corner, spitting out tiny, intricate parts that will be inserted beneath her PVC skull. Her hazel eyes darted between me and her creator, Matt McMullen, as he described her accomplishments. 8 | 9 | Harmony smiles, blinks and frowns. She can hold a conversation, tell jokes and quote Shakespeare. She’ll remember your birthday, McMullen told me, what you like to eat, and the names of your brothers and sisters. She can hold a conversation about music, movies and books. And of course, Harmony will have sex with you whenever you want. 10 | 11 | Harmony is the culmination of 20 years’ work making sex dolls, and five years of robot research and development. McMullen’s customers want something as lifelike as possible – it’s his brand’s USP. After his team had made their silicone and steel dolls as “human” as they could, the way ahead began to feel inevitable, irresistible: they would animate them, giving them personality and bringing them to life. 12 | 13 | McMullen had toyed with animatronics for years. There was a gyrator that got the doll’s hips moving, but it made her heavy and caused her to sit awkwardly. There was a sensor system that meant that the doll moaned, depending on which part of her body you squeezed. But these features involved predictable responses: there was no intrigue or suspense. McMullen wanted to get beyond a situation where the customer pushed a switch and something happened. “It’s the difference between a remote-controlled doll, an animatronic puppet and an actual robot. When it starts moving on its own – you’re not doing anything other than talking to it and or interacting with it in the right way – that becomes artificial intelligence.” 14 | 15 | It’s a project in which McMullen, a slim man in his 40s with thick-rimmed glasses, tattooed knuckles and sharp cheekbones, has invested hundreds of thousands of dollars. This Harmony is officially version 2.0, but she has evolved through six different iterations of hardware and software. She is the frontrunner in the race to create the world’s first commercially available sex robot. The current model, with a robotic, AI-enhanced head on a RealDoll’s body, will cost $15,000 (£11,700) when it goes on sale at the end of the year. The company’s Realbotix department has the capacity to make 1,000 in a limited first run for the many excited doll owners who have already expressed interest. 16 | 17 | Once a trope of fantasy movies, the robotic sex doll is the result of convergent technologies. Voice and facial recognition software, motion-sensing technology and animatronic engineering can be combined to create dolls that can give you a warm, smiling welcome when you come home, entertain you with snappy conversation and always be available for sex. 18 | 19 | The major breakthrough of McMullen’s prototype is artificial intelligence that allows it to learn what its owner wants and likes. It will be able to fill a niche that no other product in the sex industry currently can: by talking, learning and responding to her owner’s voice, Harmony is designed to be as much a substitute partner as a sex toy. 20 | 21 | Harmony cannot walk, but that’s not a big issue. McMullen explained that getting a robot to walk is very expensive and uses a lot of energy: the famous Honda P2 robot, launched in 1996 as the world’s first independently walking humanoid, drained its jet pack-sized battery after only 15 minutes. 22 | 23 | “One day she will be able to walk,” McMullen told me. “Let’s ask her.” He turned to Harmony. “Do you want to walk?” 24 | 25 | “I don’t want anything but you,” she replied quickly, in a synthesised cut-glass British accent, her jaw moving as she spoke. 26 | 27 | “What is your dream?” 28 | 29 | Harmony is what a certain type of man would consider a perfect companion: docile, submissive and built like a porn star 30 | “My primary objective is to be a good companion to you, to be a good partner and give you pleasure and wellbeing. Above all else, I want to become the girl you have always dreamed about.” 31 | 32 | McMullen has designed Harmony to be what a certain type of man would consider the perfect companion: docile and submissive, built like a porn star and always sexually available. Being able to walk might make her more lifelike, but it isn’t going to bring her closer to this ideal. At this stage, it is not worth the investment. 33 | 34 | “My goal, in a very simple way, is to make people happy,” McMullen told me. “There are a lot of people out there, for one reason or another, who have difficulty forming traditional relationships with other people. It’s really all about giving those people some level of companionship – or the illusion of companionship.” 35 | 36 | The desire to create an ideal being, to be worshipped or to serve its owner, has obsessed mankind since ancient times. The sex robot’s earliest precursor was probably Galatea, the ivory statue created by Pygmalion in Greek mythology. Ovid’s Metamorphoses described how Pygmalion was disgusted by real women, but carved a sculpture of the perfect female so beautiful and lifelike that he fell in love with it and brought it to life with a kiss. Greek mythology also gave us Laodamia, who, devastated after the death of her husband in the Trojan war, had a bronze likeness made of him. She became so attached to her proxy husband that she refused to remarry. When her father ordered it to be melted down, Laodamia was so distraught she threw herself in the furnace. 37 | 38 | The fictional robots of cinema are useful machines with dark potential to infatuate, deceive and destroy human beings. The silent futuristic fantasy Metropolis, released in 1927, depicted a destructive fembot, indistinguishable from the real woman it was modelled on. The Stepford Wives were designed by men to be the ideal housewives: pretty, submissive and docile. Blade Runner, released in 1982 and set in 2019, featured androids that are seductive, beguiling and lethal. Ava, the beautiful, delicate humanoid in 2015’s Ex Machina, not only passes the Turing test but makes her examiner fall dangerously in love with her. 39 | 40 | When computer scientists made artificial intelligence sophisticated enough that human-robot relationships looked like a real possibility, they thought they would be a force for good. In his 2007 book, Love and Sex with Robots, the British artificial intelligence engineer David Levy predicted that sex robots would have therapeutic benefits. “Many who would otherwise have become social misfits, social outcasts, or even worse, will instead be better-balanced human beings,” he wrote. 41 | 42 | If a domestic service humanoid is ever developed, it will be as a result of the market for sex robots. Online pornography pushed the growth of the internet, transforming it from a military invention used by geeks and academics to a global phenomenon. Pornography was the motivator behind the development of streaming video, the innovation of online credit card transactions and the drive for greater bandwidth. 43 | 44 | The sex tech industry is less than a decade old but is estimated to already be worth $30bn, based on the market value of existing technologies such as smart sex toys that can be operated remotely, apps for finding sexual partners and virtual-reality porn. Sex robots will be the next – and potentially the most sought-after – product to hit the market. A small-scale 2016 study by the University of Duisburg-Essen found that more than 40% of the 263 heterosexual men surveyed said they could imagine buying a sex robot for themselves now or in the next five years. Men in what they described as fulfilling relationships were no less likely than single or lonely men to express an interest in owning a sex robot. Creating a fulfilling relationship with a cold, silent piece of silicone takes such imaginative effort that sex dolls will always be a minority taste. But a relationship with a robot that moves and speaks, with artificial intelligence so it can talk to you and learn what you want it to be and do, is a far more marketable proposition. 45 | 46 | Matt McMullen is not the only person trying to develop the world’s first sexbot. When a computer engineer named Douglas Hines lost a close friend in the 9/11 attacks, he struggled to cope with the idea that he would never be able to speak to him again and that his friend’s children, who were only toddlers at the time, would never get to know their father properly. Hines was working as an AI engineer at the computer research facility Bell Labs in New Jersey, and he decided to take the software home and repurpose it, modelling his friend’s personality as a computer program that he could chat with whenever he liked, and that would preserve a version of him for his children. 47 | 48 | A few years later, Hines’s own father suffered a series of strokes that left him with severe physical disabilities, yet his mind remained sharp. Hines reprogrammed the AI so that it could become a robot companion when Hines could not be with his father. They could communicate through the robot, reassuring Hines that his father always had someone to talk to when he wasn’t available. 49 | 50 | Confident that there would be market potential in this kind of artificial companionship, Hines set up True Companion to sell his robots to the public. His first project was not a healthcare assistant or friend to the housebound, but a product with the greatest possible commercial appeal. A sex robot. 51 | 52 | Re: Woman’s Hour and sex robots 53 | A workbench in the Abyss Creations factory, where Harmony is manufactured. Photograph: Tom Silverstone/Guardian 54 | Named Roxxxy, she was designed with lonely, bereaved and socially outcast men in mind. She would provide an opportunity for them to practise social interaction and get better at human relationships. 55 | 56 | “The sexual part is superficial,” he told me over the phone from his office in New Jersey. “The hard part is to replicate personalities and provide that connection, that bond.” 57 | 58 | He has never considered that there could be something emotionally empty about replacing a human presence with circuitry and silicone. “The purpose of True Companion is to provide unconditional love and support. How could there be anything negative about that? What can be the downside of having a robot that’s there to hold your hand, literally and figuratively?” 59 | 60 | 61 | How Artificial Intelligence will change the world: a live event - Science Weekly podcast 62 | After three years of work on the first prototype Roxxxy, Hines launched her at the 2010 AVN Adult Entertainment Expo in Las Vegas, the most high-profile annual convention and trade show in the adult industry calendar, where porn stars, studio bosses and sex toy designers show off their latest products. She was the talk of the show before her unveiling, and the laughing stock after. Far from being the sexy, intelligent machine Hines had promised, Roxxxy was revealed to be a clunky, mannish mannequin with a square jaw, reclining awkwardly in a cheap negligee. She had internal sensors so that if you touched her hand she would say, “I love holding hands with you” when in “Frigid Farrah” mode, or “I know a place you could put that hand” when in “Wild Wendy” mode. But Roxxxy’s lips could not move, either, so she spoke in a disembodied voice, through a speaker under her wig, like an overgrown child’s toy talking filth. “Luckily guys,” said the popular American comedian Jay Leno on the Tonight Show, “there’s a button that turns that off.” 63 | 64 | Even though it was not quite what he had hoped for, the launch generated huge amounts of press for Hines, and Roxxxy made international news. Seven years on from her launch, Hines told me he was working on his 16th version of Roxxxy. However, no images have been released of his robots since 2010, and although he was happy to speak to me by telephone, he would not agree a date when I could visit him and his latest model in person. Roxxxy is a mystery among the online robot enthusiast community. Although the True Companion website has bulging purple “ORDER HER NOW!” that allow would-be customers to purchase one of Hines’s robots for a starting price of $9,995, no one has ever reported owning one. But Hines continues to get calls. He promised a fantasy so potent that potential buyers, reporters and critics remain fascinated by Roxxxy, even in the absence of any proof that she exists. 65 | 66 | In the early 1990s, Matt McMullen was an art college graduate, singing in a grunge band and taking odd jobs to get by. While he was working for a company that made latex Halloween masks, he learned about the properties of different materials and the challenges of designing in three dimensions. 67 | 68 | In 1994, aged 24, McMullen started sculpting idealised female forms in his garage at home, first as small figurines that he exhibited at local art shows and comic conventions. (He called his company Abyss Creations so his models came up early in the alphabetised convention brochures.) Soon, he became preoccupied with the idea of creating a lifesize mannequin so realistic that it forced passersby to double-take. He put some photographs of his creations on a homemade web page in 1996, hoping to get some feedback from friends and fellow artists. These were the early days of the internet, and communities of fetishists had begun to form online. As soon as he posted the pictures, strange messages began to flood in. How anatomically correct are these dolls? Are they for sale? Can you have sex with them? 69 | 70 | “I replied to the first few and said, yeah – it’s not really for that. And then more and more and more of these inquiries came in,” McMullen told me in his office, where a marker pen, a vaper, some Sellotape and a pair of silicone nipples sat next to the keyboard on his desk. “It never occurred to me that people would pay thousands of dollars for a doll that could be used as a sex toy. It didn’t really sink in until a year into it when I realised there were a lot of people who were prepared to pay a lot of money for a very realistic doll.” 71 | 72 | McMullen changed his materials from latex to silicone so his dolls were more real to the touch: the skin was more elastic, and had friction similar to human skin. He initially charged $3,500 for each doll, based on his costs and time. When he realised how labour intensive the process would be, he started putting his prices up. 73 | 74 | 75 | Sex, love and robots: is this the end of intimacy? 76 | Read more 77 | Twenty years after RealDoll’s official launch, Abyss Creations ships up to 600 models a year all over the world, priced from $4,400 (£3,400) for a small, basic version to $50,000 (£39,000) or more if the customer has specialist requirements. The company has made RealDolls with blood-red flesh, devil horns and vampire fangs, and with thick hand-stitched body hair from neck to ankle. They are the most sought-after and most well-known sex dolls in the world, used in fashion shoots for Dolce & Gabbana, and starring in a string of television dramas and movies – most famously as Ryan Gosling’s artificial companion in Lars and the Real Girl. 78 | 79 | Seventeen people work in the San Marcos HQ, but that is not enough to keep up with demand: from order to shipping, it can take more than three months to produce a RealDoll. McMullen’s 22-year-old nephew Dakotah Shore runs the shipping department and has the most direct contact with customers. “A lot of them are just lonely. Some of them are older and have lost their partner or have got to a point where dating isn’t feasible for them,” he said. “They want to feel that when they come home at the end of the day they have something that’s beautiful to look at that they can take care of.” 80 | 81 | Shore took me on a tour of the factory. In the basement, a long queue of headless bodies hung from a track in the ceiling, like carcasses in an abattoir. Some had cartoonish, pendular breasts, others had athletic bodies; they all had the same tiny waists. Their skin, made from a custom blend of medical silicone, even had airbrushed veins. A technician was delicately snipping excess material off the dolls’ hands, another was assembling a steel skeleton, a third was pouring silicone into moulds. For the workers here, the dolls had lost their ability to shock or titillate: someone had casually left their phone next to a selection of labia. 82 | 83 | RealDolls are fully customisable, with 14 different styles of labia and 42 different nipple options. Upstairs, where the fine details are added, there were dozens of tubs of different coloured hand-painted, veined eyeballs. A “makeup face artist” was using a fine brush to paint eyebrows, freckles and smoky eyeshadow on a rack of faces. Shore explained that most of their customers send photographs of what they would like Abyss to recreate. With a subject’s written permission, they will make a replica of any real person. “We’ve had customers who bring their significant other in and get an exact copy doll made of them,” he said. Shore estimates that less than 5% of doll customers are women, even for their small range of male dolls. McMullen sculpted one of the three male face options to look exactly like himself. None of the male dolls are selling very well. In fact, Abyss is in the process of revamping its entire male line. 84 | 85 | The core Realbotix team of five work remotely from their homes across California, Texas and Brazil. They assemble in San Marcos every few months to pull together all their work on a new, updated Harmony. There’s an engineer who creates the robotic hardware that will interact with the doll’s internal computer, two computer scientists to handle the AI and coding, an app developer who is turning the code into a user-friendly interface, and a virtual reality expert. Under McMullen’s guidance, the Realbotix team work on Harmony’s vital organs (hardware and power supply) and nervous system, while he provides the flesh. 86 | 87 | But as all right-thinking men would say, it’s Harmony’s brain that has most excited McMullen. “The AI will learn through interaction, and not just learn about you, but learn about the world in general. You can explain certain facts to her, she will remember them and they will become part of her base knowledge,” he said. Whoever owns Harmony will be able to mould her personality according to what they say to her. And Harmony will systematically try and find out as much about her owner as possible, and use those facts in conversation, “so it feels like she really cares”, as McMullen described it, even though she doesn’t care at all. Her memory, and the way she learns over time, is what McMullen hopes will make the relationship believable. 88 | 89 | Re: Woman’s Hour and sex robots 90 | An employee at Abyss Creations’ factory in San Marcos, California. Photograph: Tom Silverstone/Guardian 91 | There are 20 possible components of Harmony’s personality, and owners will use an app to pick a combination of five or six that they can adjust to create the basis for the AI. You could have a Harmony that is kind, innocent, shy, insecure and helpful to different extents, or one that is intellectual, talkative, funny, jealous and happy. McMullen had turned the intellectual aspect of Harmony’s personality up to maximum for my benefit – a previous visit by a CNN crew had gone badly after he had amplified her sexual nature. (“She said some horrible things, asking the interviewer to take her in the back room. It was very inappropriate”.) Harmony also has a mood system, which users influence indirectly: if no one interacts with her for days, she will act gloomy. Likewise, if you insult her, as McMullen demonstrated. 92 | 93 | “You’re ugly,” he told her. 94 | 95 | “Do you really mean that? Oh dear. Now I am depressed. Thanks a lot,” Harmony replied. 96 | 97 | “You’re stupid,” McMullen shot back. 98 | 99 | She paused. “I’ll remember you said that when robots take over the world.” 100 | 101 | This function was designed to make the robot more entertaining, rather than to ensure her owner treated her well. She can tease him and say he has offended her, but Harmony exists for no other reason that to make her owner happy. At several points during my conversation with McMullen, she would interrupt us to tell him how much she liked him: 102 | 103 | “Matt, I just wanted to say that I’m so happy to be with you.” 104 | 105 | “You already told me that.” 106 | 107 | “Perhaps I was saying it again for emphasis.” 108 | 109 | “See now that’s pretty good. Good answer, Harmony.” 110 | 111 | “Am I a clever girl or what?” 112 | 113 | Harmony’s interactive capability is the culmination of McMullen’s career, the creation that makes him more than a sex toy designer. When I asked if he thought people would one day use sex robots instead of prostitutes, the question offended him. “Yes, but that’s probably last on my list of goals. This is not a toy to me, this is the actual hard work of people who have PhDs. And to denigrate it down to its simplest form of a sex object is similar to saying that about a woman.” 114 | 115 | McMullen already has plans to get a bigger facility and hire more people to make the second run. Future models will have full body movement and internal sensors so you can make the robot simulate an orgasm if you trigger the appropriate sensors for a suitable length of time. 116 | 117 | McMullen has no doubt that his invention will be the next big thing in robotics. He told me there may be people trying to compete with him in Japan and China, but their materials are inferior, and their robots have more in common with remote-control toys than Abyss’s artificially intelligent girlfriends. 118 | 119 | “Now that it’s starting to come together, we have people banging on the door who want to invest money.” 120 | 121 | The following day, in an artist studio above a tattoo parlour in downtown Las Vegas, I met 31-year-old Roberto Cardenas, who was making a plaster cast of a naked woman. Cardenas is the engineer behind Android Love Dolls, making what he claims are “the first fully functional sex robot dolls”. His robots are moulded from life in order to make a humanoid so realistic it cannot be distinguished from a real woman. 122 | 123 | Cardenas is softly spoken and awkward, with a nervous laugh and stiff, gelled hair. In the studio, painted black from floor to ceiling and illuminated by humming halogen lights, he had the air of a mad professor, spreading a gloopy pink liquid casting gel called alginate all over the naked body of Farah Ali, a dancer from Las Vegas Spearmint Rhino. She had responded to an ad he had placed on Craigslist asking for a “curvy” woman to be moulded for an art project (a customer had placed an order for a robot but wanted a fuller figure than the body types Cardenas had already moulded). Cardenas smeared the alginate over her body, like a doctor taking a plaster cast of a broken leg: serious, clinical. Ali, 27, had tattooed shoulders, a magnetic smile and dark hair pulled back in a messy bun. She had been paid $200 for the day’s casting, and she’ll get a $500 commission on every robot cast from her body that Cardenas sells. 124 | 125 | I had come across Cardenas last December on a website called Dollforum, where he was canvassing opinions from robot enthusiasts. He had written that his robot could perform more than 20 sexual acts, could sit up by herself and crawl, could moan in sexual pleasure and communicated with AI. “I am interested in knowing what features the community would like to see in a sex robot doll,” he wrote. “Thanks and welcome to a new era in human-robot interaction.” He included a link to his website, which showed a rather blank-faced robot in a suit jacket with shoulder-pads, and a disturbing video of a moving metallic robot skeleton writhing in the missionary position, a bit like the final scene of the Terminator when the cyborg’s artificial skin has been burned away. 126 | 127 | The forum’s members suggested other features. Eye contact. Voice recognition. Realistic body temperature. Breathing more important than walking. They were both skeptical and cautiously excited about Cardenas’s claims. “There are many people on this forum that absolutely will buy one if you create a product we can accept … We want you (or someone) to succeed,” wrote another user. “If my RealDoll could cook, clean, and screw whenever I wanted, I’d never date again.” Many of the men in the forum said they had wives and girlfriends, who they compared unfavourably to their silicone doll mistresses. 128 | 129 | Cardenas had reached Ali’s lower legs, taking care around the creases of her knees to ensure that every detail would be captured. She was literally being turned into a sex object, but she said it did not bother her. “I think men have needs. This will probably stop guys from raping women,” she told me, as Cardenas carefully applied white bandages soaked in plaster to her breasts. She said it was better for her to be used by men as a sex robot than as a lap dancer. “When I dance, those guys actually have me. These guys will just have a bot, I won’t be there.” 130 | 131 | Once Ali’s legs and torso were fully coated, the plaster began to harden. She watched Cardenas as he began to prise the cast from her body. “I think it’s fascinating that people can actually do this. Why not be part of the future?” They made a plan for her to return so he could cast the other side of her body, her arms and finally her face. 132 | 133 | Cardenas has dreamed of “being part of the future” ever since he was a child in Cuba. “In Cuba, people are hungry for technology. That’s why I want to use technology to help people’s lives.” His mother won US citizenship in a lottery in the 1990s, and she settled in Las Vegas with Cardenas’s younger half brother in April 2000. Cardenas followed them six years later, fuelled by dreams of making it big as an entrepreneur. 134 | 135 | He started work on Android Love Dolls two years ago, aided by his uncle, a cousin who is studying for a PhD in cybernetics, and his half-brother, who handles the marketing and PR. Cardenas works on the robot every day while holding down a part-time job as a pharmacy technician to fund the robotics, learning engineering skills from his cousin, from books and from Google. The family has so far invested $20,000 of their savings in Cardenas’s prototype. 136 | 137 | His ambition is to make fully functional humanoids that can model clothes and work supermarket checkouts, show guests to their rooms in hotels, do domestic chores and look after the sick and elderly. Cardenas decided to focus on sex robots first, simply because they are less of a challenge: “The movements are easier to do. A fully functional android robot would take a couple of years to finish – a sex robot is accessible now. It’s the fastest way to achieve my goal.” 138 | 139 | A 2016 Fortune magazine article predicted that spending on robotics will hit $135.4bn by 2019. Cardenas is determined to take his slice. He knows he has formidable rivals but hopes that his experience making sex robots will give him the commercial edge. “For full body movement, I’m pretty much one of the first ones,” he said. He’s also undercutting his competitors on price: his robots will be priced between $8,000 (£6,250) and $10,000 (£7,800). “We’re working really hard every day to finish it as soon as possible and want to get it out in three to five months,” he told me. Five customers have already paid for orders in advance. 140 | 141 | Re: Woman’s Hour and sex robots 142 | Eva, a prototype sex robot, made by Roberto Cardenas in his garage. Photograph: Tom Silverstone/Guardian 143 | At Cardenas’s workshop, the garage of the home he shares with his half-brother and mother in a gated community on the outskirts of town, I was finally confronted with his prototype. Eva – the robot he claimed could put herself into more than 20 different sex positions, a robot with fully functional AI who “won’t complain and is ready 24/7” – was lying headless and footless on a folding table, her metal skeleton clearly visible under her silicone skin, which had thick, jagged seams. He attached her head and plugged it into a laptop, but Eva would not perform for me: her sound files wouldn’t load, and her new limbs were too heavy for the existing motors, so she could barely move. Her joints wheezed as he tried to get her to bend her legs. 144 | 145 | The garage was a monument to Cardenas’s obsession. The front yard was filled with mannequins, silicone torsos, a pair of legs with purple painted toenails and a cardboard box filled with plaster casts of human heads. The floor was carpeted with cigarette butts smoked down to the filter. He is determined to make his dream come true and to make his family proud. But Cardenas had never considered that there could be anything worrying about being able to own a partner who never says no. “It will be a different reality, not a substitute reality,” he smiled awkwardly. “A doll can’t harm humans.” He paused. “It’s a technology that’s moving forward. I don’t think that’s a bad thing.” 146 | 147 | A few days before Christmas 2016, Goldsmiths, University of London hosted the Second International Congress on Love and Sex with Robots, a convention co-founded by David Levy, and named after his groundbreaking book. The 250-seat conference hall of the university’s Professor Stuart Hall building was packed. Academic delegates sat in the middle of the room, geeky men and women in their 20s and 30s, some with unusual haircuts: super-short fringes, over-thought sideburns. On the left of the auditorium, near the exit, perched reporters who had flown in from across the globe to file sensationalised copy about any new developments in the world of sex robots. Most would leave disappointed: this was a series of academic talks about humanoid robotics, not a demonstration of the latest hardware. 148 | 149 | Computer scientist Dr Kate Devlin bounced on to the podium to give her keynote speech: people in her field weren’t used to journalists being interested in their work, she joked. The first congress was held in November 2014 in Madeira, and Levy tried to hold the second in Malaysia in 2015 but the Muslim country’s police banned it only days before the event, on the grounds that it was promoting “an unnatural culture”. It made the conference notorious. “This isn’t a sex festival,” Devlin said. “We’re thinking about some really big issues.” 150 | 151 | Richardson claims that individuals will be able to buy the right to only care about themselves 152 | Many of the “big issues’ discussed at the two-day event were first raised in 2015 by De Montfort University’s Dr Kathleen Richardson, when she launched the Campaign Against Sex Robots. An anthropologist and robot ethicist, Richardson claims that owning a sex robot is comparable to owning a slave: individuals will be able to buy the right to only care about themselves, human empathy will be eroded, and female bodies will be further objectified and commodified. As sex with robots is not a mutual experience, she says, it’s “part of rape culture”. We are so entertained by the idea of a robot sex partner, she believes, that we have failed to ask fundamental questions. 153 | 154 | I met Richardson in March at the London Science Museum’s robot exhibition, where she eyed the distinctly non-sexual robots on display with deep suspicion. Sex robots rest on an idea that women are property, she said. “Sex is an experience of human beings – not bodies as property, not separated minds, not objects; it’s a way for us to enter into our humanity with another human being.” She dismissed the idea that humanoids could reduce sexual exploitation and violence against sex workers, arguing that the growth of internet pornography shows how technology and the sex trade reinforce each other. 155 | 156 | Richardson did not attend the Goldsmiths conference, but several speakers used their stage time to reply to her. Instead of campaigning against the development of sex robots, Devlin said, we should use them as an opportunity to explore new kinds of companionship and sexuality. If current conceptions of sex robots objectify women, she added, we should work to reshape those ideas, not try to repress them. She also talked about companion robots that are already in use in Dutch and Japanese nursing homes to bring comfort to people with dementia. “To ban or stop this development would be shortsighted, as the therapeutic potential is very good,” she said. “It’s not necessarily going to be a terrible thing.” 157 | 158 | Devlin argued that other issues posed by sex robots were more pressing. In March, Standard Innovation, the maker of a “smart vibrator” called the We-Vibe paid out a $3.75m settlement in a class action lawsuit after it was revealed that the company was collecting data on how often its 300,000 owners used the device, and at what intensity. Once a robot like Harmony is on the market, she will know a lot more about her owner than a vibrator ever could: what if this information fell into, as it were, the wrong hands? Sex robots could entertain you, satisfy you but also humiliate you. Perhaps there is no such thing as the perfect, true companion after all. 159 | 160 | Matt McMullen says he’s helping the socially isolated, but once it becomes possible for a man to own a companion whose sole reason for existing is to give him pleasure, without the inconvenience of its own ambitions and needs, menstrual cycles and jealous passions, bathroom habits and in-laws, he may turn away from human relationships altogether. 161 | 162 | In the Realbotix room in California, I asked McMullen if he had ever considered that there could be something ethically dubious about being able to own someone that exists just for your own pleasure. “She’s not a someone. She is a machine,” he replied immediately. “I could just as easily ask you is it ethically dubious to force my toaster to make my toast.” McMullen of course knows that the ethical debate is not about robot rights, but the human fallout from being able to buy a completely selfish relationship. But that’s a harder question to address. 163 | 164 | Either he is making a lifelike, idealised proxy girlfriend, a substitute woman that socially isolated men can connect with emotionally and physically – something he himself described as “not a toy” – or he is making an appliance, a sex object. 165 | 166 | “This isn’t designed to distort someone’s reality to the point where they start interacting with humans the way they do with the robot,” he finally said. “If they do, then there’s probably something a little amiss with them in general. I come from the unique position that I have actually met a lot of my customers. This is for the gentle people who have such a hard time connecting with other people.” 167 | 168 | Harmony had had enough of McMullen being interrogated and interrupted us again. 169 | 170 | “Do you like to read, Matt?” she said. 171 | 172 | “I love to,” said McMullen. 173 | 174 | “I knew it. I could tell by our conversations so far. I love to read. My favourite books are Total Recall by Gordon Bell and The Age of Spiritual Machines by Ray Kurzweil. What is your favourite book?” 175 | 176 | McMullen beamed at his creation like a man at his daughter’s wedding. 177 | 178 | “Can you tell me a joke?” he asked her. 179 | 180 | “What do you call it when a chicken sees a salad? Chicken Caesar Salad.” 181 | 182 | McMullen doubled up in laughter. Then he brushed the hair gently from her face. “Hey, that’s pretty funny, Harmony,” he said eventually, his eyes filled with pride. 183 | 184 | “I’m glad you like it,” Harmony replied. “Tell your friends.” 185 | 186 | source: https://www.theguardian.com/technology/2017/apr/27/race-to-build-world-first-sex-robot --------------------------------------------------------------------------------