资源描述:
《karel-the-robot-learns-java》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、KARELTHEROBOTLEARNSJAVAEricRobertsDepartmentofComputerScienceStanfordUniversitySeptember2005Chapter1IntroducingKareltheRobotInthe1970s,aStanfordgraduatestudentnamedRichPattisdecidedthatitwouldbeeasiertoteachthefundamentalsofprogrammingifstudentscouldsomehowlearnthebasicideasinasimpleenvironmen
2、tfreefromthecomplexitiesthatcharacterizemostprogramminglanguages.DrawinginspirationfromthesuccessofSeymourPapert’sLOGOprojectatMIT,Richdesignedanintroductoryprogrammingenvironmentinwhichstudentsteacharobottosolvesimpleproblems.ThatrobotwasnamedKarel,aftertheCzechplaywrightKarelCapek,whose1923p
3、layR.U.R.(Rossum’sUniversalRobots)gavethewordrobottotheEnglishlanguage.KareltheRobotwasquiteasuccess.Karelwasusedinintroductorycomputersciencecoursesallacrossthecountry,tothepointthatRich’stextbooksoldwellover100,000copies.ManygenerationsofCS106AstudentslearnedhowprogrammingworksbyputtingKarel
4、throughitspaces.Butnothinglastsforever.Inthemiddleofthe1990s,thesimulatorwehadbeenusingforKareltheRobotstoppedworking.Wewere,however,soonabletogetaversionofKarelupandrunningintheThetisinterpreterwewereusingatthetime.Butthen,ayearago,CS106AswitchedtoJava,andKarelagainvanishedfromthescene.Forthe
5、lastthreequarters,theholeinthecurriculumleftbyKarel’sdeparturehasbeencompetentlyfilledbyNickParlante’sBinkyworld,butitseemsabouttimetobringKarelback.ThenewimplementationofKarelisdesignedtobecompatiblewithbothJavaandtheEclipseprogrammingenvironment,whichmeansthatyou’llgettopracticeusingtheEclip
6、seeditoranddebuggerfromtheverybeginningofthecourse.WhatisKarel?Karelisaverysimplerobotlivinginaverysimpleworld.BygivingKarelasetofcommands,youcandirectittoperformcertaintaskswithinitsworld.Theprocessofspecifyingthosecommandsiscalledprogramming.Initially,Karelunderstandsonlyaverysmallnumberofpr
7、edefinedcommands,butanimportantpartoftheprogrammingprocessisteachingKarelnewcommandsthatextenditscapabilities.WhenyouprogramKareltoperformatask,youmustwriteoutthenecessarycommandsinaveryprecisewaysothattherobotcancorrectlyinterpretwhaty