Skip to content

Instantly share code, notes, and snippets.

View lasagnaphil's full-sized avatar

Phil Chang lasagnaphil

View GitHub Profile
using System;
namespace CSharpStudy1
{
static class LinearAlgebra
{
public static int[,] Multiply(int[,] mat1, int[,] mat2)
{
if (mat1.GetLength (1) != mat2.GetLength (0)) {
Console.WriteLine ("Error: trying to calculate two matrices with incompatible size");
execute pathogen#infect()
" Colors
syntax enable
set background=dark
" colorscheme base16-default
" Spaces & Tabs
set shiftwidth=4
set tabstop=4

Computer :

  • A programmable electronic device that can store, retrieve, and process data
  • A "black box" that will accept input and produce output
    • the output depends on the current program in the block box

The Von Neumann Model : Such computers have input and output devices, a main memory (RAM), and a CPU (The central processing unit)

Stored-program idea : Main memory contains both the program and the data with which the program is working

Questions and Answers

  • Namespace :
    • To group entities under a name (Classes, Objects, Functions)
    • To divide the global scope in sub-scopes
      • Each one with its own name
    • Syntax:

namespace identifier

#include <iostream>
using namespace std;
class A
{
public:
A(int = 1);
A(const A&);
void print();
@lasagnaphil
lasagnaphil / SoundManager.cs
Created June 9, 2016 10:31
SoundManager class from Unity (basic sound management)
using UnityEngine;
using System.Collections.Generic;
[System.Serializable]
public class SoundData
{
public SoundManager.Sounds soundEnum;
public AudioClip audioClip;
[Range(0.0f, 1.0f)]
public float volume = 1.0f;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
public class Grid<T>
{
@lasagnaphil
lasagnaphil / GameData.cs
Created August 20, 2016 18:11
Testing out Unity's serialization system
using System;
using UnityEngine;
using System.Collections.Generic;
public class GameData : MonoBehaviour
{
//
// Serialization rule for fields
//
@lasagnaphil
lasagnaphil / Hanoi.java
Created April 12, 2017 12:30
Hanoi skeleton (java)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Hanoi hanoi = new Hanoi();
hanoi.run();
}
}
class Hanoi
@lasagnaphil
lasagnaphil / Hanoi.java
Created April 24, 2017 09:12
Hanoi full code (java)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Hanoi hanoi = new Hanoi();
hanoi.run();
}
}