Skip to content

Instantly share code, notes, and snippets.

View samsonchen1989's full-sized avatar

samson chen samsonchen1989

  • Shanghai, China
View GitHub Profile
@samsonchen1989
samsonchen1989 / MaxRectsBinPack.cs
Created March 13, 2020 09:51
运行时合图打包类
/*
Based on the Public Domain MaxRectsBinPack.cpp source by Jukka Jylänki
https://github.com/juj/RectangleBinPack/
Ported to C# by Sven Magnus
This version is also public domain - do whatever you want with it.
*/
using UnityEngine;
using System.Collections.Generic;
@samsonchen1989
samsonchen1989 / BoostTimer.cpp
Created July 25, 2018 09:11
Boost高精度定时器
// AsioUdpClient.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <boost/asio/high_resolution_timer.hpp>
#include <boost/asio.hpp>
@samsonchen1989
samsonchen1989 / RenameBoostLib.cpp
Created July 25, 2018 08:51
批量重命名boost生成的vc141库为vc140
// tool.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <io.h>
#include <stdlib.h>
#include <vector>
@samsonchen1989
samsonchen1989 / Prototype.cpp
Last active July 6, 2018 12:34
Prototype模式实现根据不同类型动态创建不同子类
enum RoomType
{
Classic = 1,
Tower = 2,
Chicken = 3,
};
class Room
{
public:
@samsonchen1989
samsonchen1989 / PartionTest.cpp
Created June 14, 2018 04:14
用动态规划实现对战分组,使得两组积分和的差的绝对值最小
// Reference
// http://www.cnblogs.com/AndyJee/p/4543424.html
// https://blog.csdn.net/mu399/article/details/7722810
void PartionArrayMinDiff(const vector<int>& list, vector<int>& listOutL, vector<int>& listOutR)
{
int sum = 0;
for (int num : list)
{
sum += num;
}