Giter Club home page Giter Club logo

sp22-proj1-starter's Introduction

61C Spring 2022 Project 1: Snake

Spec: https://cs61c.org/sp22/projects/proj1/

TODO: describe what you did

Bugs I met:

  1. I used macro instead of the size info in the structure, which caused segfault when I called the function in other places. (Be careful of the constant?)
  2. I forgot to increase the numbe r of iterations.
  3. Strings are ending with \0. Printf %s prints everything until \0. When I iterated the buffer that collected the board characters, I tried to go through everything, which is unnecessary. (After assigning a larger string to a buffer, a new smaller string is saved in the same buffer with the data in the higher addresses not being overwritten.)

Things I learned:

  1. malloc: allocation from large -> small scale. free: free from small -> large scale.
  2. The usage of char**. (To save a array of a string)
  3. The way to access a member (char*) of char**. (char ** board; board[i]; // the i th member) (snake_t *snake; snake[i].tail_x = ; // access the member of snake_t struct)
  4. gdb: c - continue; info b - breakpoints info; del 1 - delete the 1st breakpoint.

sp22-proj1-starter's People

Contributors

chrononyan avatar peterw-xd 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.