Git Product home page Git Product logo

cs61b's Introduction

更适合**宝宝体质的CS61B自学指南

我是在跟着21年春季的课程网站学习CS61B,这里是课程的官方网站, 学习过程中发现一些问题,因此记录下来,希望能够帮助后来者。

proj0

issue: 如果你严格按照课程的要求去做proj0,你会发现当你测试tilt()函数时运行GUI窗口,你的方向键输入是无效的, 这是因为中文系统的默认语言是中文,如果你在Game.javaplayGame()方法下的String cmnd = _source.getKey()这行命令下加上一个System.out.println(cmnd), 你会发现你输入方向键打出来的内容实际上是"向上箭头"、"向下箭头"、"向左箭头"、"向右箭头",也就是说在接下来的switch(cmnd){}中的tilt()函数根本就执行不到!

solution: 打开GUISource.java,找到getKey()方法,将它开头几行的case后面字符串修改成中文如下:

    public String getKey() {
        String command = _source.readKey();
        switch (command) {
            case "向上箭头" :
                command = "Up";
                break;
            case "向右箭头" :
                command = "Right";
                break;
            case "向下箭头" :
                command = "Down";
                break;
            case "向左箭头" :
                command = "Left";
                break;
            default :
                break;
        }

cs61b's People

Contributors

sjk1949 avatar omarnabikhan avatar neil-kulkarni avatar zhu-eric avatar cclafferty5 avatar itaismith avatar borentsai avatar joshhug avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.