Skip to content

Instantly share code, notes, and snippets.

New Features

  • Sorting anything lexicographically is implemented
  • A new text-editor, currently supporting:
    • bold, italic, underlined, and strikethrough text
    • coloured text
    • different fonts
    • different font-sizes
    • headers 1, 3, and 6
    • bulleted and numbered lists
  • A very basic menu-bar allowing you to save projects in different locations, and return to the project-picker
@Folling
Folling / card
Created February 11, 2018 21:29
using System.Collections;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Assets.Scripts.Cards {
[RequireComponent(typeof(RectTransform), typeof(Image))]
public class Card : MonoBehaviour,
IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler,
IBeginDragHandler, IDragHandler, IEndDragHandler {
private bool InventoryContains(Item i){
return inventory.FindIndex(item => item.id == i.id) >= 0;
}
#pragma once
#include <algorithm>
#include <functional>
#include <set>
template<typename T>
using rw = std::reference_wrapper<T>;
template<typename T>
using crw = const std::reference_wrapper<T>;
#include "Button.h"
Button::Button() {
}
Button::~Button() {
}
#pragma once
#include <string>
#include <iostream>
#include <bitset>
#include <SDL/SDL.h>
#include "Position.h"
#include "Debug.h"
static void clearPiece( const int sq, position* pos ) {
ASSERT(sqOnBoard(sq));
int piece = pos->pieces[sq];
ASSERT(pieceValid(piece));
int colour = pieceColours[piece];
HASH_PIECE(piece, sq);
int t_pieceNum = -1;
void generateAllMoves(const position* pos, moveList* list) {
ASSERT(pos->checkBoard());
list->count = 0;
int side = pos->side;
bool isWhite = side == WHITE;
// loop for all pawns
if (side == WHITE) {
for (int i = 0; i < pos->pieceNum[P]; i++) {
int sq = pos->pList[P][i];
void generateAllMoves(const position* pos, moveList* list)
{
// TODO reduce pawn move generation to not use the "if" and maybe reduce it to one addPawnMove function
ASSERT(pos->checkBoard());
list->count = 0;
int side = pos->side;
void position::parseFEN(std::string FEN)
{
ASSERT(FEN != "");
ASSERT(this != nullptr);
int rank = RANK_8;
int file = FILE_A;
int piece = 0;
int count = 0;
int sq64 = 0;