Skip to content

Instantly share code, notes, and snippets.

View juanplopes's full-sized avatar
🌲
Is that a Segment Tree problem?

Juan Lopes juanplopes

🌲
Is that a Segment Tree problem?
View GitHub Profile
#define MAXC 1010
#define MAXX 110
#define INF 2000000000
#include <iostream>
#include <queue>
#include <vector>
#include <cstring>
using namespace std;
int n, m, s, d, qr, c;
var foo = Expression.Parameter(typeof(Foo));
var value = Expression.Parameter(typeof(int));
var propA_set = Expression.Lambda<Action<Foo, int>>(
Expression.Assign(Expression.Property(foo, propA), value),
foo, value).Compile();
var foo = new Foo();
var bar = typeof(Foo).GetMethod("Bar");
var s = Stopwatch.StartNew();
for (int i = 0; i < 5000000; i++)
foo.Bar(i);
Console.WriteLine("Sem reflection: {0}", s.Elapsed);
s.Restart();
var foo = new Foo();
var bar = typeof(Foo).GetMethod("Bar");
var param = Expression.Parameter(typeof(int));
var bar2 = Expression.Lambda<Func<int, string>>(
Expression.Call(Expression.Constant(foo), bar, param), param).Compile();
var s = Stopwatch.StartNew();
for (int i = 0; i < 5000000; i++)
foo.Bar(i);
[Test]
public void GetMovesOneSquareForward_A2_ReturnsPromotions()
{
var bp = new BlackPawns(Bitboard.With.A2);
var m = bp.GetMovesOneSquareForward();
m.Should().Have.SameSequenceAs(
new Move("A2", "A1", MoveTypes.PawnToQueenPromotion),
new Move("A2", "A1", MoveTypes.PawnToRookPromotion),
public class SimpleHelper : System.Web.WebPages.HelperPage
{
public static new WebViewPage Page
{
get { return (WebViewPage)WebPageContext.Current.Page; }
}
public static new HtmlHelper Html
{
get { return Page.Html; }
namespace StrongChess.Model.Pieces
{
public struct Bishop : IPieceRule
{
public Bitboard GetMoveBoard(Square from)
{
return GetMoveBoard(from, 0);
}
public Bitboard GetMoveBoard(Square from, Bitboard friends)
Adagio
After Forever
Aina
Allen & Lande
Almah
Altaria
Amaran
Andre Matos
Angra
Apocalyptica
public class ParamsExtraction
{
Group group;
public ParamsExtraction(Group group)
{
this.group = group;
}
private bool TryGet<T>(int position, out T result)
{
Felipe:
quer minha opinião?
Rodrigo Vidal:
sim :D
Felipe:
na grande maioria dos casos, tanto faz
não terá diferença
em casos que um FileSystem é um problema, o DB será um problema também
e vice-cersa
vice-versa