Before everything stars, I need to download go from its website. When I finish the installing, I can check where is my work directory by typing: go env GOPATH eg. Hello World Programs start running in package main. This program is using the packages with import paths "fmt" and "math/rand". package main import ( "fmt" …
Some notes on Git
Basic: Create a repository: git init Add files to repository to be committed: git add filename1 filename2 ( add files to stage) Make files committed git commit -m "xxx" (commit files to branch) Check the result git status Version Control: Compare the difference git diff filename Show history git log or git log –pretty=oneline Back …
Unity 2D – Laser Defender (4)
Continued Damage dealer Create a new script file in our script folder. Add code below into the new script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class DamageDealer : MonoBehaviour { [SerializeField] int damage = 100; public int GetDamage() { return damage; } public void Hit() { Destroy(gameObject); } } And then add this script …
Unity 2D – Laser Defender (3)
Continued Shoot First drag the laser into my assets folder, and then drag it into the hierarchy. Then create a prefab folder and then drag all things in the hierarchy into it except EventSystem. Now create the laser variable in our script file, add the laser sprite to player’s laser prefab, and then delete the …
Unity 2D – Laser Defender (2)
Continued Movement & Time Create a new script for player, and open it (Also create a new folder for it). The next step is to make my ship move. In visual studio which open script for me, add code as below: player.cs: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Player : MonoBehaviour { // …
Unity 2D – Laser Defender (1)
It is a special period for everyone. However I believe it could also be a chance for myself cause I have my own time now and I could seek some interesting projects. I take this note for tracking my learning process of unity engine. And the main content in this note I refer to one …
Lambda Calculus – Studying Note
The Lambda Calculus has only one features: Function More precisely, only thing you can do is: Define a function Call a function Describing a Programming Language Syntax: what do programs look like? Semantics: what do programs mean? Syntax: What Programs Look Like Some Examples: For above examples, they are: function(x) {return x} function(x) {return function(y) …
How should we upload files to our own branch in GitHub?
When we are working on a group project with our teammates, usually we need to complete our own part of task and upload to GitHub, but what exactly should we do? 1 . Use "git clone" to clone the files. 2. Use "git status" We can see now we are in origin/master branch. 3. Create …
Continue reading “How should we upload files to our own branch in GitHub?”
Set multiple ssh-keys for different GitHub accounts on my Mac
Today when I tried to push update files to my GitHub repository it fails. I guess the reason of that may be that the GitHub account which I tried to push to is different from the GitHub account I was used to use on my Mac. But the new account will be used for two …
Continue reading “Set multiple ssh-keys for different GitHub accounts on my Mac”
ISA and Pipelining
ISA Instruction set architecture A well-defined hardware/software interface The “contract” between software and hardware An ISA includes a specification of the set of opcodes (machine language), and the native commands implemented by a particular processor. Single-cycle and Pipelining 5 stages of pipelining