text:
package org.x.job.scheduler.core.conf;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Controller {
    @RequestMapping("/aaaa")
    public A cc() {
        return new A();
    }

    class A {
        private String name = "\"asds";

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package net.runelite.client.plugins.puzzlesolver.solver;

import java.util.List;
import net.runelite.client.plugins.puzzlesolver.solver.pathfinding.Pathfinder;

public class PuzzleSolver implements Runnable
{
	public static final int DIMENSION = 5;

	private Pathfinder pathfinder;
	private PuzzleState startState;

	private List<PuzzleState> solution;
	private int position;
	private boolean failed = false;

	public PuzzleSolver(Pathfinder pathfinder, PuzzleState startState)
	{
		this.pathfinder = pathfinder;
		this.startState = startState;
	}

	public PuzzleState getStep(int stepIdx)
	{
		return solution.get(stepIdx);
	}

	public int getStepCount()
	{
		return solution.size();
	}

	public boolean hasSolution()
	{
		return solution != null;
	}

	public int getPosition()
	{
		return position;
	}

	public void setPosition(int position)
	{
		this.position = position;
	}

	public boolean hasFailed()
	{
		return failed;
	}

	@Override
	public void run()
	{
		solution = pathfinder.computePath(startState);
		failed = solution == null;
	}
}


text:
<?php
	// birthday_wish.form.php
?>

<form action="<?php if(islogin())/* only work if user is login*/ {echo "$current_file";} ?>" method="POST" enctype="" target="">

    <textarea rows=1 class="mdl-textfield__input" id="comment" name="comment"></textarea>
    <?php if(!islogin()) {echo "Login / Register to Wish your friend ";} else {echo "Wish your friend";}?>

    <button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
    checkwish
    </button>
</form>


text:
package skills;

import effects.ThunderBallEffect;
import conditions.etc.Cooldown;
import game.*;
import org.lwjgl.util.Point;

import org.newdawn.slick.Graphics;

import entities.characters.Character;
import util.Maths;

public class ThunderStorm implements Skill{
	public static final int MAX_LVL = 5;
	public static final int SPEED = ThunderBallEffect.THUNDERBOLT_SPEED;
	private int level = 1;
	private int damage = 20;
	private int manaCost = 20;
	private int cooldownDuration = 12;
	private Cooldown cooldown = new Cooldown(cooldownDuration*20);

	private int maxUses = 20;
	private int uses = maxUses;

	public boolean use(Character user, Point target) {
		if(!cooldown.offCooldown())return true;
		if(user.getMP() < manaCost && uses==maxUses)return true;

		user.drainMana(manaCost);

		float dx = (float)(-((user.getX()-target.getX()) / Maths.dist(user.getLoc(), target)) * SPEED);
		float dy = (float)(-((user.getY()-target.getY()) / Maths.dist(user.getLoc(), target)) * SPEED);

		Engine.add(
				new ThunderBallEffect(
						user,
						dx,
						dy,
						damage,
						0, 30)
		);
		// != 1 because the first use is above
		int additionalUses = 0;
		additionalUses += (int)(user.getStat(Character.ABILITY)/1.15);
		while(uses != 1 - additionalUses){
			dx = (float)Math.random() * SPEED;
			dy = (float)Math.random() * SPEED;
			if(Engine.getRand().nextBoolean())dx*=-1;
			if(Engine.getRand().nextBoolean())dy*=-1;
			Engine.add(
					new ThunderBallEffect(
							user,
							dx,
							dy,
							damage,
							0, 30)
			);
			--uses;
		}

			cooldown.reset();
			uses = maxUses;
			return true;

	}

	@Override
	public void levelUp() {
		if(level + 1 <= MAX_LVL){
			++this.level;
			//this.manaCost++;
			//this.manaCost++;
			maxUses += 3 + (uses/9);
			uses += 3 + (uses/9);
			if (this.level > 1)damage += 3;
			if (this.level > 4){
				damage += 2;
				maxUses += 10;
				uses += 10;
			}
			cooldownDuration += 2;
			cooldown = new Cooldown(cooldownDuration*20);
		}

	}

	@Override
	public void tick() {
		cooldown.tick();
		//To change body of implemented methods use File | Settings | File Templates.
	}
	public boolean offCooldown(){
		return cooldown.offCooldown();
	}
	public int getLevel(){
		return this.level;
	}

	public Point getGridCoord(){
		return new Point(8,2);
	}
	public boolean isReadyable(){return false;}
	public void readiedDraw(float sx, float sy, float z, Graphics g){}

    public String toString() {
        return "Thunder Storm";
    }
	public int getMaxLevel(){return MAX_LVL;}
}


text:
var Parsimmon = {};

Parsimmon.Parser = (function() {
  "use strict";

  // The Parser object is a wrapper for a parser function.
  // Externally, you use one to parse a string by calling
  //   var result = SomeParser.parse('Me Me Me! Parse Me!');
  // You should never call the constructor, rather you should
  // construct your Parser from the base parsers and the
  // parser combinator methods.
  function Parser(action) {
    if (!(this instanceof Parser)) return new Parser(action);
    this._ = action;
  };

  var _ = Parser.prototype;

  function makeSuccess(index, value) {
    return {
      status: true,
      index: index,
      value: value,
      furthest: -1,
      expected: []
    };
  }

  function makeFailure(index, expected) {
    return {
      status: false,
      index: -1,
      value: null,
      furthest: index,
      expected: [expected]
    };
  }

  function mergeReplies(result, last) {
    if (!last) return result;
    if (result.furthest > last.furthest) return result;

    var expected = (result.furthest === last.furthest)
      ? result.expected.concat(last.expected)
      : last.expected;

    return {
      status: result.status,
      index: result.index,
      value: result.value,
      furthest: last.furthest,
      expected: expected
    }
  }

  function assertParser(p) {
    if (!(p instanceof Parser)) throw new Error('not a parser: '+p);
  }

  function formatExpected(expected) {
    if (expected.length === 1) return expected[0];

    return 'one of ' + expected.join(', ')
  }

  function formatGot(stream, error) {
    var i = error.index;

    if (i === stream.length) return ', got the end of the stream'

    var prefix = (i > 0 ? "'..." : "'");
    var suffix = (stream.length - i > 12 ? "...'" : "'");

    return ' at character ' + i + ', got ' + prefix + stream.slice(i, i+12) + suffix
  }

  var formatError = Parsimmon.formatError = function(stream, error) {
    return 'expected ' + formatExpected(error.expected) + formatGot(stream, error)
  };

  _.parse = function(stream) {
    var result = this.skip(eof)._(stream, 0);

    return result.status ? {
      status: true,
      value: result.value
    } : {
      status: false,
      index: result.furthest,
      expected: result.expected
    };
  };

  // [Parser a] -> Parser [a]
  var seq = Parsimmon.seq = function() {
    var parsers = [].slice.call(arguments);
    var numParsers = parsers.length;

    return Parser(function(stream, i) {
      var result;
      var accum = new Array(numParsers);

      for (var j = 0; j < numParsers; j += 1) {
        result = mergeReplies(parsers[j]._(stream, i), result);
        if (!result.status) return result;
        accum[j] = result.value
        i = result.index;
      }

      return mergeReplies(makeSuccess(i, accum), result);
    });
  };

  var seqMap = Parsimmon.seqMap = function() {
    var args = [].slice.call(arguments);
    var mapper = args.pop();
    return seq.apply(null, args).map(function(results) {
      return mapper.apply(null, results);
    });
  };

  /**
   * Allows to add custom primitive parsers
   */
  var custom = Parsimmon.custom = function(parsingFunction) {
    return Parser(parsingFunction(makeSuccess, makeFailure));
  };

  var alt = Parsimmon.alt = function() {
    var parsers = [].slice.call(arguments);
    var numParsers = parsers.length;
    if (numParsers === 0) return fail('zero alternates')

    return Parser(function(stream, i) {
      var result;
      for (var j = 0; j < parsers.length; j += 1) {
        result = mergeReplies(parsers[j]._(stream, i), result);
        if (result.status) return result;
      }
      return result;
    });
  };

  // -*- primitive combinators -*- //
  _.or = function(alternative) {
    return alt(this, alternative);
  };

  _.then = function(next) {
    if (typeof next === 'function') {
      throw new Error('chaining features of .then are no longer supported, use .chain instead');
    }

    assertParser(next);
    return seq(this, next).map(function(results) { return results[1]; });
  };

  // -*- optimized iterative combinators -*- //
  // equivalent to:
  // _.many = function() {
  //   return this.times(0, Infinity);
  // };
  // or, more explicitly:
  // _.many = function() {
  //   var self = this;
  //   return self.then(function(x) {
  //     return self.many().then(function(xs) {
  //       return [x].concat(xs);
  //     });
  //   }).or(succeed([]));
  // };
  _.many = function() {
    var self = this;

    return Parser(function(stream, i) {
      var accum = [];
      var result;
      var prevResult;

      for (;;) {
        result = mergeReplies(self._(stream, i), result);

        if (result.status) {
          i = result.index;
          accum.push(result.value);
        }
        else {
          return mergeReplies(makeSuccess(i, accum), result);
        }
      }
    });
  };

  // equivalent to:
  // _.times = function(min, max) {
  //   if (arguments.length < 2) max = min;
  //   var self = this;
  //   if (min > 0) {
  //     return self.then(function(x) {
  //       return self.times(min - 1, max - 1).then(function(xs) {
  //         return [x].concat(xs);
  //       });
  //     });
  //   }
  //   else if (max > 0) {
  //     return self.then(function(x) {
  //       return self.times(0, max - 1).then(function(xs) {
  //         return [x].concat(xs);
  //       });
  //     }).or(succeed([]));
  //   }
  //   else return succeed([]);
  // };
  _.times = function(min, max) {
    if (arguments.length < 2) max = min;
    var self = this;

    return Parser(function(stream, i) {
      var accum = [];
      var start = i;
      var result;
      var prevResult;

      for (var times = 0; times < min; times += 1) {
        result = self._(stream, i);
        prevResult = mergeReplies(result, prevResult);
        if (result.status) {
          i = result.index;
          accum.push(result.value);
        }
        else return prevResult;
      }

      for (; times < max; times += 1) {
        result = self._(stream, i);
        prevResult = mergeReplies(result, prevResult);
        if (result.status) {
          i = result.index;
          accum.push(result.value);
        }
        else break;
      }

      return mergeReplies(makeSuccess(i, accum), prevResult);
    });
  };

  // -*- higher-level combinators -*- //
  _.result = function(res) { return this.map(function(_) { return res; }); };
  _.atMost = function(n) { return this.times(0, n); };
  _.atLeast = function(n) {
    var self = this;
    return seqMap(this.times(n), this.many(), function(init, rest) {
      return init.concat(rest);
    });
  };

  _.map = function(fn) {
    var self = this;
    return Parser(function(stream, i) {
      var result = self._(stream, i);
      if (!result.status) return result;
      return mergeReplies(makeSuccess(result.index, fn(result.value)), result);
    });
  };

  _.skip = function(next) {
    return seq(this, next).map(function(results) { return results[0]; });
  };

  _.mark = function() {
    return seqMap(index, this, index, function(start, value, end) {
      return { start: start, value: value, end: end };
    });
  };

  _.desc = function(expected) {
    var self = this;
    return Parser(function(stream, i) {
      var reply = self._(stream, i);
      if (!reply.status) reply.expected = [expected];
      return reply;
    });
  };

  // -*- primitive parsers -*- //
  var string = Parsimmon.string = function(str) {
    var len = str.length;
    var expected = "'"+str+"'";

    return Parser(function(stream, i) {
      var head = stream.slice(i, i+len);

      if (head === str) {
        return makeSuccess(i+len, head);
      }
      else {
        return makeFailure(i, expected);
      }
    });
  };

  var regex = Parsimmon.regex = function(re, group) {
    var anchored = RegExp('^(?:'+re.source+')', (''+re).slice((''+re).lastIndexOf('/')+1));
    var expected = '' + re;
    if (group == null) group = 0;

    return Parser(function(stream, i) {
      var match = anchored.exec(stream.slice(i));

      if (match) {
        var fullMatch = match[0];
        var groupMatch = match[group];
        if (groupMatch != null) return makeSuccess(i+fullMatch.length, groupMatch);
      }

      return makeFailure(i, expected);
    });
  };

  var succeed = Parsimmon.succeed = function(value) {
    return Parser(function(stream, i) {
      return makeSuccess(i, value);
    });
  };

  var fail = Parsimmon.fail = function(expected) {
    return Parser(function(stream, i) { return makeFailure(i, expected); });
  };

  var letter = Parsimmon.letter = regex(/[a-z]/i).desc('a letter')
  var letters = Parsimmon.letters = regex(/[a-z]*/i)
  var digit = Parsimmon.digit = regex(/[0-9]/).desc('a digit');
  var digits = Parsimmon.digits = regex(/[0-9]*/)
  var whitespace = Parsimmon.whitespace = regex(/\s+/).desc('whitespace');
  var optWhitespace = Parsimmon.optWhitespace = regex(/\s*/);

  var any = Parsimmon.any = Parser(function(stream, i) {
    if (i >= stream.length) return makeFailure(i, 'any character');

    return makeSuccess(i+1, stream.charAt(i));
  });

  var all = Parsimmon.all = Parser(function(stream, i) {
    return makeSuccess(stream.length, stream.slice(i));
  });

  var eof = Parsimmon.eof = Parser(function(stream, i) {
    if (i < stream.length) return makeFailure(i, 'EOF');

    return makeSuccess(i, null);
  });

  var test = Parsimmon.test = function(predicate) {
    return Parser(function(stream, i) {
      var char = stream.charAt(i);
      if (i < stream.length && predicate(char)) {
        return makeSuccess(i+1, char);
      }
      else {
        return makeFailure(i, 'a character matching '+predicate);
      }
    });
  };

  var oneOf = Parsimmon.oneOf = function(str) {
    return test(function(ch) { return str.indexOf(ch) >= 0; });
  };

  var noneOf = Parsimmon.noneOf = function(str) {
    return test(function(ch) { return str.indexOf(ch) < 0; });
  };

  var takeWhile = Parsimmon.takeWhile = function(predicate) {
    return Parser(function(stream, i) {
      var j = i;
      while (j < stream.length && predicate(stream.charAt(j))) j += 1;
      return makeSuccess(j, stream.slice(i, j));
    });
  };

  var lazy = Parsimmon.lazy = function(desc, f) {
    if (arguments.length < 2) {
      f = desc;
      desc = undefined;
    }

    var parser = Parser(function(stream, i) {
      parser._ = f()._;
      return parser._(stream, i);
    });

    if (desc) parser = parser.desc(desc)

    return parser;
  };

  var index = Parsimmon.index = Parser(function(stream, i) {
    return makeSuccess(i, i);
  });

  //- fantasyland compat

  //- Monoid (Alternative, really)
  _.concat = _.or;
  _.empty = fail('empty')

  //- Applicative
  _.of = Parser.of = Parsimmon.of = succeed

  _.ap = function(other) {
    return seqMap(this, other, function(f, x) { return f(x); })
  };

  //- Monad
  _.chain = function(f) {
    var self = this;
    return Parser(function(stream, i) {
      var result = self._(stream, i);
      if (!result.status) return result;
      var nextParser = f(result.value);
      return mergeReplies(nextParser._(stream, result.index), result);
    });
  };

  return Parser;
})();


text:
  <field-error  error="model.error"
                left-aligned="true"
                uid="{{model.uid}}-error">
  </field-error>

  <input  aria-manager
          id="{{model.uid}}"
          name="{{attribute}}"
          type="checkbox"
          tabindex="{{tabIndex}}"
          ng-model="model.bindable"
          ng-checked="checked"
          ng-disabled="disable || model.disabled"
          ng-change="changed()">

  <field-label  ng-if="label"
                input-uid="{{model.uid}}"
                uid="{{model.uid}}-label"
                label="{{label}}"
                help="{{help}}">
  </field-label>


text:
import sys
import unittest
from dynd import nd, ndt

class TestTypePatternMatch(unittest.TestCase):
    def test_simple(self):
        self.assertTrue(ndt.int32.match(ndt.int32))
        self.assertTrue(ndt.type('T').match(ndt.int16))
        self.assertTrue(ndt.type('... * T').match(ndt.int16))
        self.assertTrue(ndt.type('A... * T').match(ndt.int16))
        self.assertTrue(ndt.type('M * A... * N * T').match(ndt.type('Fixed * var * int')))
        self.assertFalse(ndt.type('M * A... * N * T').match(ndt.type('Fixed * int')))

    def test_tuple(self):
        pat = ndt.type('(T, ?T, 3 * T, A... * S)')
        self.assertTrue(pat.match(ndt.type('(int, ?int, 3 * int, real)')))
        self.assertTrue(pat.match(ndt.type('(string, ?string, 3 * string, 10 * complex)')))
        self.assertFalse(pat.match(ndt.type('(string, ?int, 3 * string, 10 * complex)')))
        self.assertFalse(pat.match(ndt.type('(string, string, 3 * string, 10 * complex)')))
        self.assertFalse(pat.match(ndt.type('(string, ?string, 4 * string, 10 * complex)')))

if __name__ == '__main__':
    unittest.main()


text:
namespace operations_research {
// RangeIntToIntFunction is an interface to int64->int64 functions supporting
// fast answer to range queries about their domain/codomain.
class RangeIntToIntFunction {
 public:
  virtual ~RangeIntToIntFunction() = default;

  // Suppose f is the abstract underlying function.
  // Returns f(argument).
  // TODO(user): Rename to Run
  virtual int64 Query(int64 argument) const = 0;
  // Returns min_x f(x), where x is in [from, to).
  virtual int64 RangeMin(int64 from, int64 to) const = 0;
  // Returns max_x f(x), where x is in [from, to).
  virtual int64 RangeMax(int64 from, int64 to) const = 0;
  // Returns the first x from [range_begin, range_end) for which f(x) is in
  // [interval_begin, interval_end), or range_end if there is no such x.
  virtual int64 RangeFirstInsideInterval(int64 range_begin, int64 range_end,
                                         int64 interval_begin,
                                         int64 interval_end) const = 0;
  // Returns the last x from [range_begin, range_end) for which f(x) is in
  // [interval_begin, interval_end), or range_begin-1 if there is no such x.
  virtual int64 RangeLastInsideInterval(int64 range_begin, int64 range_end,
                                        int64 interval_begin,
                                        int64 interval_end) const = 0;
};

// RangeMinMaxIndexFunction is different from RangeIntToIntFunction in two ways:
//   1. It does not support codomain or value queries.
//   2. For domain queries it returns an argument where the minimum/maximum is
//      attained, rather than the minimum/maximum value.
class RangeMinMaxIndexFunction {
 public:
  // Suppose f is the abstract underlying function.
  virtual ~RangeMinMaxIndexFunction() = default;
  // Returns an x from [from, to), such that f(x) <= f(y) for every y from
  // [from, to).
  virtual int64 RangeMinArgument(int64 from, int64 to) const = 0;
  // Returns an x from [from, to), such that f(x) => f(y) for every y from
  // [from, to).
  virtual int64 RangeMaxArgument(int64 from, int64 to) const = 0;
};

// A copy of f is going to be stored in the returned object, so its closure
// should remain intact as long as the returned object is being used.
RangeIntToIntFunction* MakeBareIntToIntFunction(std::function<int64(int64)> f);
// It is assumed that f is defined over the interval [domain_start, domain_end).
// The function scans f once and it is safe to destroy f and its closure after
// MakeCachedIntToIntFunction returns.
RangeIntToIntFunction* MakeCachedIntToIntFunction(
    const std::function<int64(int64)>& f, int64 domain_start, int64 domain_end);
// It is safe to destroy the first argument and its closure after
// MakeCachedRangeMinMaxIndexFunction returns.
RangeMinMaxIndexFunction* MakeCachedRangeMinMaxIndexFunction(
    const std::function<int64(int64)>& f, int64 domain_start, int64 domain_end);
}  // namespace operations_research

#endif  // OR_TOOLS_UTIL_RANGE_QUERY_FUNCTION_H_


text:
"""Extensions to atts package (http://www.attrs.org)"""

from collections import OrderedDict

import attr

__all__ = ['immutable_attribs']

__private__ = []

def immutable_attribs(cls):
    """Class decorator like ``attr.s(frozen=True)`` with improved __repr__"""
    cls = attr.s(cls, frozen=True)
    defaults = OrderedDict([(a.name, a.default) for a in cls.__attrs_attrs__])

    def repr_(self):
        from qnet.printing import srepr
        real_cls = self.__class__
        class_name = real_cls.__name__
        args = []
        for name in defaults.keys():
            val = getattr(self, name)
            positional = defaults[name] == attr.NOTHING
            if val != defaults[name]:
                args.append(
                    srepr(val) if positional else "%s=%s" % (name, srepr(val)))
        return "{0}({1})".format(class_name, ", ".join(args))

    cls.__repr__ = repr_
    return cls


text:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
           android:duration="220"
           android:fromXDelta="0"
           android:fromYDelta="0"
           android:interpolator="@android:anim/accelerate_decelerate_interpolator"
           android:toXDelta="-25%"
           android:toYDelta="0"
           android:zAdjustment="bottom"/>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BadMishka.DocumentFormat.LuceneIndex.Analysis
{
    public class LetterTokenizer : Tokenizer
    {
        private int offset = 0, bufferIndex = 0, dataLen = 0;
        private static int MAX_WORD_LEN = 255;
        private static int IO_BUFFER_SIZE = 1024;
        private char[] buffer = new char[MAX_WORD_LEN];
        private char[] ioBuffer = new char[IO_BUFFER_SIZE];

        public LetterTokenizer(System.IO.TextReader reader)
        {
            this.TextReader = reader;
        }

        public override Token Read()
        {
            int length = 0;
            int start = offset;
            while (true)
            {
                char c;

                offset++;
                if (bufferIndex >= dataLen)
                {
                    dataLen = this.TextReader.Read(ioBuffer, 0, ioBuffer.Length);
                    bufferIndex = 0;
                };
                if (dataLen == -1)
                {
                    if (length > 0)
                        break;
                    else
                        return null;
                }
                else
                    c = (char)ioBuffer[bufferIndex++];

                if (Char.IsLetter(c))
                {         // if it's a letter

                    if (length == 0)              // start of token
                        start = offset - 1;

                    buffer[length++] = c;             // buffer it

                    if (length == MAX_WORD_LEN)       // buffer overflow!
                        break;

                }
                else if (length > 0)              // at non-Letter w/ chars
                    break;                    // return 'em

            }

            return new Token(new String(buffer, 0, length), start, start + length);
        }

    }
}


text:
This XML format is used for importing publication meta-data into the current research information system of Friedrich-Alexander-Universität Erlangen-Nürnberg: http://cris.fau.de/

After transferring your data into this schema, please send it to cris-support@fau.de.


text:
![](_static/green_circ10.png "green circle"): thoroughly-tested. In many cases,
we verified against known values and/or reproduced results from papers.

~: implemented but lightly tested.

X: known issues (see code for details).

Status                                       | Game
-------------------------------------------- | ----
~         | [2048](#2048)
~         | [Amazons](#amazons)
~         | [Atari](#atari)
![](_static/green_circ10.png "green circle") | [Backgammon](#backgammon)
~         | [Bargaining](#bargaining)
~         | [Battleship](#battleship)
~         | [Blackjack](#blackjack)
![](_static/green_circ10.png "green circle") | [Breakthrough](#breakthrough)
![](_static/green_circ10.png "green circle") | [Bridge](#bridge)
![](_static/green_circ10.png "green circle") | [(Uncontested) Bridge bidding](#uncontested-bridge-bidding)
~         | [Catch](#catch)
~         | [Checkers](#checkers)
~         | [Cliff Walking](#cliff-walking)
~         | [Clobber](#clobber)
~         | [Coin Game](#coin-game)
~         | [Colored Trails](#colored-trails)
![](_static/green_circ10.png "green circle") | [Connect Four](#connect-four)
~         | [Cooperative Box-Pushing](#cooperative-box-pushing)
![](_static/green_circ10.png "green circle") | [Chess](#chess)
~         | [Dark Hex](#dark-hex)
~         | [Deep Sea](#deep-sea)
~         | [Euchre](#euchre)
![](_static/green_circ10.png "green circle") | [First-price Sealed-Bid Auction](#first-price-sealed-bid-auction)
![](_static/green_circ10.png "green circle") | [Gin Rummy](#gin-rummy)
![](_static/green_circ10.png "green circle") | [Go](#go)
![](_static/green_circ10.png "green circle") | [Goofspiel](#goofspiel)
![](_static/green_circ10.png "green circle") | [Hanabi](#hanabi)
![](_static/green_circ10.png "green circle") | [Havannah](#havannah)
![](_static/green_circ10.png "green circle") | [Hearts](#hearts)
~         | [Hex](#hex)
~         | [Kriegspiel](#Kriegspiel)
![](_static/green_circ10.png "green circle") | [Kuhn poker](#kuhn-poker)
~         | [Laser Tag](#laser-tag)
![](_static/green_circ10.png "green circle") | [Leduc poker](#leduc-poker)
~         | [Lewis Signaling](#lewis-signaling)
![](_static/green_circ10.png "green circle") | [Liar's Dice](#liars-dice)
~         | [Mancala](#mancala)
~         | [Markov Soccer](#markov-soccer)
![](_static/green_circ10.png "green circle") | [Matching Pennies (Three-player)](#matching-pennies-three-player)
![](_static/green_circ10.png "green circle") | [Mean Field Game : garnet](#mean_field_game_garnet)
![](_static/green_circ10.png "green circle") | [Mean Field Game : crowd modelling](#mean_field_game_crowd_modelling)
![](_static/green_circ10.png "green circle") | [Mean Field Game : crowd modelling 2d](#mean_field_game_crowd_modelling_2d)
![](_static/green_circ10.png "green circle") | [Mean Field Game : linear quadratic](#mean-field-game--linear-quadratic)
![](_static/green_circ10.png "green circle") | [Mean Field Game : predator prey](#mean_field_game_predator_prey)
![](_static/green_circ10.png "green circle") | [Mean Field Game : routing](#mean-field-game--routing)
~         | [Morpion Solitaire (4D)](#morpion-solitaire-4d)
![](_static/green_circ10.png "green circle") | [Negotiation](#negotiation)
~         | [Nim](#nim)
~         | [Oh Hell](#oh-hell)
![](_static/green_circ10.png "green circle") | [Oshi-Zumo](#oshi-zumo)
![](_static/green_circ10.png "green circle") | [Oware](#oware)
~         | [Pathfinding](#pathfinding)
![](_static/green_circ10.png "green circle") | [Pentago](#pentago)
~         | [Phantom Go](#phantom-go)
~         | [Phantom Tic-Tac-Toe](#phantom-tic-tac-toe)
![](_static/green_circ10.png "green circle") | [Pig](#pig)
~         | [Poker (Hold 'em)](#poker-hold-em)
![](_static/green_circ10.png "green circle") | [Quoridor](#quoridor)
~         | [Reconnaissance Blind Chess](#reconnaissance-blind-chess)
![](_static/green_circ10.png "green circle") | [Routing game](#routing-game)
~         | [Sheriff](#sheriff)
~         | [Slovenian Tarok](#slovenian-tarok)
~         | [Skat (simplified bidding)](#skat-simplified-bidding)
~         | [Solitaire (K+)](#solitaire-k)
![](_static/green_circ10.png "green circle") | [Tic-Tac-Toe](#tic-tac-toe)
![](_static/green_circ10.png "green circle") | [Tiny Bridge](#tiny-bridge)
![](_static/green_circ10.png "green circle") | [Tiny Hanabi](#tiny-hanabi)
![](_static/green_circ10.png "green circle") | [Trade Comm](#trade-comm)
~         | [Ultimate Tic-Tac-Toe](#ultimate-tic-tac-toe)
![](_static/green_circ10.png "green circle") | [Y](#y)

## Details

### 2048

*   A single player game where player aims to create a 2048 tile by merging
    other tiles.
*   Numbers on a grid.
*   Modern game.
*   Non-deterministic.
*   Perfect information.
*   1 player.
*   [Github](https://github.com/gabrielecirulli/2048)

### Amazons

*   Move pieces on a board trying to block opponents from moving.
*   Pieces on a grid.
*   Modern game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Game_of_the_Amazons)

### Atari

*   Agent plays classic games from
    [Gym's Atari Environments](https://www.gymlibrary.dev/environments/atari/),
    such as Breakout.
*   Single player.
*   Most games are non-deterministic.
*   Perfect information.

### Backgammon

*   Players move their pieces through the board based on the rolls of dice.
*   Idiosyncratic format.
*   Traditional game.
*   Non-deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Backgammon)

### Bargaining

*   Agents negotiate for items in a pool with different (hidden) valuations.
*   Research game.
*   Non-deterministic (randomized pool and valuations).
*   Imperfect information.
*   2 players.
*   [Lewis et al. '17](https://arxiv.org/abs/1706.05125),
    [DeVault et al. '15](https://www.aaai.org/ocs/index.php/SSS/SSS15/paper/viewFile/10335/10100)

### Battleship

*   Players place ships and shoot at each other in turns.
*   Pieces on a board.
*   Traditional game.
*   Deterministic.
*   Imperfect information.
*   2 players.
*   Good for correlated equilibria.
*   [Farina et al. '19, Correlation in Extensive-Form Games: Saddle-Point
    Formulation and
    Benchmarks](https://papers.nips.cc/paper/9122-correlation-in-extensive-form-games-saddle-point-formulation-and-benchmarks.pdf).
    Based on the original game
    [(wikipedia)](https://en.wikipedia.org/wiki/Battleship_\(game\))

### Blackjack

*   Simplified version of blackjack, with only HIT/STAND moves.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   1 player.
*   [Wikipedia](https://en.wikipedia.org/wiki/Blackjack)

### Breakthrough

*   Simplified chess using only pawns.
*   Pieces on a grid.
*   Modern game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Breakthrough_\(board_game\))

### Bridge

*   A card game where players compete in pairs.
*   Card game.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   4 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Contract_bridge)

### (Uncontested) Bridge bidding

*   Players score points by forming specific sets with the cards in their hands.
*   Card game.
*   Research game.
*   Non-deterministic.
*   Imperfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Contract_bridge)

### Catch

*   Agent must move horizontally to 'catch' a descending ball. Designed to test
    basic learning.
*   Agent on a grid.
*   Research game.
*   Non-deterministic.
*   Perfect information.
*   1 players.
*   [Mnih et al. 2014, Recurrent Models of Visual Attention](https://papers.nips.cc/paper/5542-recurrent-models-of-visual-attention.pdf),
[Osband et al '19, Behaviour Suite for Reinforcement Learning, Appendix A](https://arxiv.org/abs/1908.03568)

### Checkers

*   Players move pieces around the board with the goal of eliminating the
    opposing pieces.
*   Pieces on a grid.
*   Traditional game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Checkers)

### Cliff Walking

*   Agent must find goal without falling off a cliff. Designed to demonstrate
    exploration-with-danger.
*   Agent on a grid.
*   Research game.
*   Deterministic.
*   Perfect information.
*   1 players.
*   [Sutton et al. '18, page 132](http://www.incompleteideas.net/book/bookdraft2018mar21.pdf)

### Clobber

*   Simplified checkers, where tokens can capture neighbouring tokens. Designed
    to be amenable to combinatorial analysis.
*   Pieces on a grid.
*   Research game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Clobber)

### Coin Game

*   Agents must collect their and their collaborator's tokens while avoiding a
    third kind of token. Designed to test divining of collaborator's intentions
*   Agents on a grid.
*   Research game.
*   Non-deterministic.
*   Imperfect information (all players see the grid and their own preferences,
    but not the preferences of other players).
*   2 players.
*   [Raileanu et al. '18, Modeling Others using Oneself in Multi-Agent
    Reinforcement Learning](https://arxiv.org/abs/1802.09640)

### Colored Trails

*   Agents negotiations for chips that they they play on a colored grid to move
    closer to the goal.
*   Agents on a grid.
*   Research game.
*   Non-deterministic (randomized board & chip configuration).
*   Imperfect information.
*   3 players.
*   [Ya'akov et al. '10](https://dash.harvard.edu/handle/1/4726287),
    [Fecici & Pfeffer '08](https://dl.acm.org/doi/10.5555/1402383.1402431),
    [de Jong et al. '11](https://www.ifaamas.org/Proceedings/aamas2011/papers/C4_R57.pdf)

### Connect Four

*   Players drop tokens into columns to try and form a pattern.
*   Tokens on a grid.
*   Traditional game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Connect_Four)

### Cooperative Box-Pushing

*   Agents must collaborate to push a box into the goal. Designed to test
    collaboration.
*   Agents on a grid.
*   Research game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Seuken & Zilberstein '12, Improved Memory-Bounded Dynamic Programming for
    Decentralized POMDPs](https://arxiv.org/abs/1206.5295)

### Chess

*   Players move pieces around the board with the goal of eliminating the
    opposing pieces.
*   Pieces on a grid.
*   Traditional game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Chess)

### Dark Hex

*   Hex, except the opponent's tokens are hidden. (Imperfect-information
    version)
*   Uses tokens on a hex grid.
*   Research game.
*   Deterministic.
*   Imperfect information.
*   2 players.

### Deep Sea

*   Agent must explore to find reward (first version) or penalty (second
    version). Designed to test exploration.
*   Agent on a grid.
*   Research game.
*   Deterministic.
*   Perfect information.
*   1 players.
*   [Osband et al. '17, Deep Exploration via Randomized Value Functions](https://arxiv.org/abs/1703.07608)

### Euchre

*   Trick-taking card game where players compete in pairs.
*   Card game.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   4 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Euchre)

### First-price Sealed-Bid Auction

*   Agents submit bids simultaneously; highest bid wins, and that's the price
    paid.
*   Idiosyncratic format.
*   Research game.
*   Non-deterministic.
*   Imperfect, incomplete information.
*   2-10 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/First-price_sealed-bid_auction)

### Gin Rummy

*   Players score points by forming specific sets with the cards in their hands.
*   Card game.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Gin_rummy)

### Go

*   Players place tokens on the board with the goal of encircling territory.
*   Tokens on a grid.
*   Traditional game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Go_\(game\))

### Goofspiel

*   Players bid with their cards to win other cards.
*   Card game.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   2-10 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Goofspiel)

### Hanabi

*   Players can see only other player's pieces, and everyone must cooperate to
    win.
*   Idiosyncratic format.
*   Modern game.
*   Non-deterministic.
*   Imperfect information.
*   2-5 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Hanabi_\(card_game\)) and
    [Bard et al. '19, The Hanabi Challenge: A New Frontier for AI Research](https://arxiv.org/abs/1902.00506)
*   Implemented via
    [Hanabi Learning Environment](https://github.com/deepmind/hanabi-learning-environment)

### Havannah

*   Players add tokens to a hex grid to try and form a winning structure.
*   Tokens on a hex grid.
*   Modern game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Havannah)

### Hearts

*   A card game where players try to avoid playing the highest card in each
    round.
*   Card game.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   3-6 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Hearts_\(card_game\))

### Hex

*   Players add tokens to a hex grid to try and link opposite sides of the
    board.
*   Uses tokens on a hex grid.
*   Modern game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Hex_\(board_game\))
*   [Hex, the full story by Ryan Hayward and Bjarne Toft](https://webdocs.cs.ualberta.ca/~hayward/hexbook/hex.html)

### Kriegspiel

*   Chess with opponent's pieces unknown. Illegal moves have no effect - it
    remains the same player's turn until they make a legal move.
*   Traditional chess variant, invented by Henry Michael Temple in 1899.
*   Deterministic.
*   Imperfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Kriegspiel_\(chess\))
*   [Monte Carlo tree search in Kriegspiel](https://www.ics.uci.edu/~dechter/courses/ics-295/fall-2019/papers/2010-mtc-aij.pdf)
*   [Game-Tree Search with Combinatorially Large Belief States, Parker 2005](https://www.cs.umd.edu/~nau/papers/parker2005game-tree.pdf)

### Kuhn poker

*   Simplified poker amenable to game-theoretic analysis.
*   Cards with bidding.
*   Research game.
*   Non-deterministic.
*   Imperfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Kuhn_poker)

### Laser Tag

*   Agents see a local part of the grid, and attempt to tag each other with
    beams.
*   Agents on a grid.
*   Research game.
*   Non-deterministic.
*   Imperfect information.
*   2 players.
*   [Leibo et al. '17](https://arxiv.org/abs/1702.03037),
    [Lanctot et al. '17](https://arxiv.org/abs/1711.00832)

### Leduc poker

*   Simplified poker amenable to game-theoretic analysis.
*   Cards with bidding.
*   Research game.
*   Non-deterministic.
*   Imperfect information.
*   2 players.
*   [Southey et al. '05, Bayes' bluff: Opponent modelling in poker](https://arxiv.org/abs/1207.1411)

### Lewis Signaling

*   Receiver must choose an action dependent on the sender's hidden state.
    Designed to demonstrate the use of conventions.
*   Idiosyncratic format.
*   Research game.
*   Non-deterministic.
*   Imperfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Lewis_signaling_game)

### Liar's Dice

*   Players bid and bluff on the state of all the dice together, given only the
    state of their dice.
*   Dice with bidding.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Liar%27s_dice)

### Mancala

*   Players take turns sowing beans on the board and try to capture more beans
    than the opponent.
*   Idiosyncratic format.
*   Traditional game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Kalah)

### Markov Soccer

*   Agents must take the ball to their goal, and can 'tackle' the opponent by
    predicting their next move.
*   Agents on a grid.
*   Research game.
*   Non-deterministic.
*   Imperfect information.
*   2 players.
*   [Littman '94, Markov games as a framework for multi-agent reinforcement learning](https://www2.cs.duke.edu/courses/spring07/cps296.3/littman94markov.pdf),
[He et al. '16, Opponent Modeling in Deep Reinforcement Learning](https://arxiv.org/abs/1609.05559)

### Matching Pennies (Three-player)

*   Players must predict and match/oppose another player. Designed to have an
    unstable Nash equilibrium.
*   Idiosyncratic format.
*   Research game.
*   Deterministic.
*   Imperfect information.
*   3 players.
*   "Three problems in learning mixed-strategy Nash equilibria"

### Mean Field Game : routing

*   Representative player chooses at each node where they go. They has an
    origin, a destination and a departure time and chooses their route to
    minimize their travel time. Time spent on each link is a function of the
    distribution of players on the link when the player reaches the link.
*   Network with choice of route.
*   Research game.
*   Mean-field (with a unique player).
*   Explicit stochastic game (only for initial node).
*   Perfect information.
*   [Cabannes et. al. '21, Solving N-player dynamic routing games with
    congestion: a mean field approach](https://arxiv.org/pdf/2110.11943.pdf).

### Mean Field Game : Linear-Quadratic

*   Players are uniformly distributed and are then incentivized to gather at the
    same point (The lower the distanbce wrt. the distribution mean position, the
    higher the reward). A mean-reverting term pushes the players towards the
    distribution, a gaussian noise term perturbs them. The players' actions
    alter their states linearly (alpha * a * dt) and the cost thereof is
    quadratic (K * a^2 * dt), hence the name. There exists an exact, closed form
    solution for the fully continuous version of this game.
*   Research game.
*   Mean-field (with a unique player).
*   Explicit stochastic game (only for initial node).
*   Perfect information.
*   [Perrin & al. 2019 (https://arxiv.org/abs/2007.03458)]

### Morpion Solitaire (4D)

*   A single player game where player aims to maximize lines drawn on a grid,
    under certain limitations.
*   Uses tokens on a grid.
*   Traditional game.
*   Deterministic
*   Perfect information.
*   1 player.
*   [Wikipedia](https://en.wikipedia.org/wiki/Join_Five)

### Negotiation

*   Agents with different utilities must negotiate an allocation of resources.
*   Idiosyncratic format.
*   Research game.
*   Non-deterministic.
*   Imperfect information.
*   2 players.
*   [Lewis et al. '17](https://arxiv.org/abs/1706.05125),
    [Cao et al. '18](https://arxiv.org/abs/1804.03980)

### Nim

*   Two agents take objects from distinct piles trying to either avoid taking
    the last one or take it. Any positive number of objects can be taken on each
    turn given they all come from the same pile.
*   Traditional mathematical game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Nim)

### Oh Hell

*   A card game where players try to win exactly a declared number of tricks.
*   Card game.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   3-7 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Oh_Hell)

### Oshi-Zumo

*   Players must repeatedly bid to push a token off the other side of the board.
*   Idiosyncratic format.
*   Traditional game.
*   Deterministic.
*   Imperfect information.
*   2 players.
*   [Buro, 2004. Solving the oshi-zumo game](https://link.springer.com/chapter/10.1007/978-0-387-35706-5_23)
 [Bosansky et al. '16, Algorithms for Computing Strategies in Two-Player Simultaneous Move Games](http://mlanctot.info/files/papers/aij-2psimmove.pdf)

### Oware

*   Players redistribute tokens from their half of the board to capture tokens
    in the opponent's part of the board.
*   Idiosyncratic format.
*   Traditional game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Oware)

### Pathfinding

*   Agents must move to their desitnation.
*   Agents on a grid. Single-agent game is the classic examples from Sutton &
    Barto.
*   Research game.
*   Non-deterministic (in multiagent, collisions resolved by chance nodes).
*   Perfect information.
*   1-10 players.
*   Similar games appeared in
    [Austerweil et al. '15](http://miaoliu.scripts.mit.edu/SSS-16/wp-content/uploads/2016/01/paper.pdf),
    [Greenwald & Hall '03](https://www.aaai.org/Papers/ICML/2003/ICML03-034.pdf),
    and [Littman '01](https://jmvidal.cse.sc.edu/library/littman01a.pdf).

### Pentago

*   Players place tokens on the board, then rotate part of the board to a new
    orientation.
*   Uses tokens on a grid.
*   Modern game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Pentago)

### Phantom Go

*   Go, except the opponent's stones are hidden. The analogue of Kriegspiel for
    Go.
*   Research game.
*   Deterministic.
*   Imperfect information.
*   2 players.
*   [Cazenave '05, A Phantom Go Program](https://link.springer.com/chapter/10.1007/11922155_9)

### Phantom Tic-Tac-Toe

*   Tic-tac-toe, except the opponent's tokens are hidden. Designed as a simple,
    imperfect-information game.
*   Uses tokens on a grid.
*   Research game.
*   Deterministic.
*   Imperfect information.
*   2 players.
*   [Auger '11, Multiple Tree for Partially Observable Monte-Carlo Tree Search](https://hal.archives-ouvertes.fr/hal-00563480v2/document),
[Lisy '14, Alternative Selection Functions for Information Set Monte Carlo Tree Search](https://core.ac.uk/download/pdf/81646968.pdf),
[Lanctot '13](http://mlanctot.info/files/papers/PhD_Thesis_MarcLanctot.pdf)

### Pig

*   Each player rolls a dice until they get a 1 or they 'hold'; the rolled total
    is added to their score.
*   Dice game.
*   Traditional game.
*   Non-deterministic.
*   Perfect information.
*   2-10 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Pig_\(dice_game\))

### Poker (Hold 'em)

*   Players bet on whether their hand of cards plus some communal cards will
    form a special set.
*   Cards with bidding.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   2-10 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Texas_hold_%27em)
*   Implemented via [ACPC](http://www.computerpokercompetition.org/).

### Quoridor

*   Each turn, players can either move their agent or add a small wall to the
    board.
*   Idiosyncratic format.
*   Modern game.
*   Deterministic.
*   Perfect information.
*   2-4 players. (Note, from Wikipedia: "Though it can be played with 3 players,
    it's advised against. Since the 3rd player doesn't have player on the
    opposite side, they have an advantage.")
*   [Wikipedia](https://en.wikipedia.org/wiki/Quoridor)

### Reconnaissance Blind Chess

*   Chess with opponent's pieces unknown, with sensing moves.
*   Chess variant, invented by John Hopkins University Applied Physics Lab. Used
    in NeurIPS competition and Hidden Information Game Competition.
*   Deterministic.
*   Imperfect information.
*   2 players.
*   [JHU APL Main site](https://rbc.jhuapl.edu/)
*   [Markowitz et al. '18, On the Complexity of Reconnaissance Blind Chess](https://arxiv.org/abs/1811.03119)
*   [Newman et al. '16, Reconnaissance blind multi-chess: an experimentation
    platform for ISR sensor fusion and resource
    management](https://www.spiedigitallibrary.org/conference-proceedings-of-spie/9842/984209/Reconnaissance-blind-multi-chess--an-experimentation-platform-for-ISR/10.1117/12.2228127.short?SSO=1)

### Routing game

*   Players choose at each node where they go. They have an origin, a
    destination and a departure time and choose their route to minimize their
    travel time. Time spent on each link is a function of the number of players
    on the link when the player reaches the link.
*   Network with choice of route.
*   Research game.
*   Simultaneous.
*   Deterministic.
*   Perfect information.
*   Any number of players.
*   [Cabannes et. al. '21, Solving N-player dynamic routing games with
    congestion: a mean field approach](https://arxiv.org/pdf/2110.11943.pdf).

### Sheriff

*   Bargaining game.
*   Deterministic.
*   Imperfect information.
*   2 players.
*   Good for correlated equilibria.
*   [Farina et al. '19, Correlation in Extensive-Form Games: Saddle-Point
    Formulation and
    Benchmarks](https://papers.nips.cc/paper/9122-correlation-in-extensive-form-games-saddle-point-formulation-and-benchmarks.pdf).
*   Based on the board game "Sheriff of Nottingham"
    [(bbg)](https://boardgamegeek.com/boardgame/157969/sheriff-nottingham)

### Slovenian Tarok

*   Trick-based card game with bidding.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   3-4 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/K%C3%B6nigrufen#Slovenia)
*   [Luštrek et al. 2003, A program for playing Tarok](https://pdfs.semanticscholar.org/a920/70fe11f75f58c27ed907c4688747259cae15.pdf)

### Skat (simplified bidding)

*   Each turn, players bid to compete against the other two players.
*   Cards with bidding.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   3 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Skat_\(card_game\))

### Solitaire (K+)

*   A single-player card game.
*   Card game.
*   Traditional game.
*   Non-deterministic.
*   Imperfect information.
*   1 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Klondike_\(solitaire\)) and
    [Bjarnason et al. '07, Searching solitaire in real time](http://web.engr.oregonstate.edu/~afern/papers/solitaire.pdf)

### Tic-Tac-Toe

*   Players place tokens to try and form a pattern.
*   Uses tokens on a grid.
*   Traditional game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Tic-tac-toe)

### Tiny Bridge

*   Simplified Bridge with fewer cards and tricks.
*   Cards with bidding.
*   Research game.
*   Non-deterministic.
*   Imperfect information.
*   2, 4 players.
*   See implementation for details.

### Tiny Hanabi

*   Simplified Hanabi with just two turns.
*   Idiosyncratic format.
*   Research game.
*   Non-deterministic.
*   Imperfect information.
*   2-10 players.
*   [Foerster et al 2018, Bayesian Action Decoder for Deep Multi-Agent
    Reinforcement Learning](https://arxiv.org/abs/1811.01458)

### Trade Comm

*   Players with different utilities and items communicate and then trade.
*   Idiosyncratic format.
*   Research game.
*   Non-deterministic.
*   Imperfect information.
*   2 players.
*   A simple emergent communication game based on trading.

### Ultimate Tic-Tac-Toe

*   Players try and form a pattern in local boards and a meta-board.
*   Uses tokens on a grid.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Ultimate_tic-tac-toe)

### Y

*   Players place tokens to try and connect sides of a triangular board.
*   Tokens on hex grid.
*   Modern game.
*   Deterministic.
*   Perfect information.
*   2 players.
*   [Wikipedia](https://en.wikipedia.org/wiki/Y_\(game\))


text:
using AutoMapper;
using $saferootprojectname$.Client.Data.Contracts.Dto;
using $safeprojectname$.Contracts;

namespace $safeprojectname$.Mappers
{
    internal static class EventMapper
    {
        public static IEvent MapToEvent(EventDto eventDto)
        {
            return Mapper.Map<Event>(eventDto);
        }
    }
}


text:
if [ -n "$BASH_VERSION" ];then
  set -u  # comment in case of "unbound variable" error or fix the code
  set -eo pipefail;
else
   echo "Warning: you aren't running script in bash - expect problems..."
 fi

UNAME=$(uname -s | tr 'A-Z' 'a-z')

FONT_CONFIG_CACHE=$(mktemp -d -t font_tmp.XXXXXXXXXX)

if [[ ($UNAME == *darwin*) ]]; then
    FONTS_DIR="/Library/Fonts/"
else
    FONTS_DIR="/usr/share/fonts/"
fi

DISTORT_IMAGE=false
EXTRACT_FONT_PROPERTIES=false
LINEDATA=false
MAX_PAGES=0
MY_BOXTIFF_DIR=""
OUTPUT_DIR="/tmp/tesstrain/tessdata"
OVERWRITE=false
RUN_SHAPE_CLUSTERING=false
SAVE_BOX_TIFF=false
WORKSPACE_DIR=$(mktemp -d)
X_SIZE=3600

# set TESSDATA_PREFIX as empty, if not defined in environment to avoid an unbound variable
TESSDATA_PREFIX=${TESSDATA_PREFIX:-}

# Logging helper functions.
tlog() {
    if test -z "${LOG_FILE:-}"; then
        echo -e $*
    else
        echo -e $* | tee -a ${LOG_FILE}
    fi
}

err_exit() {
    if test -z "${LOG_FILE:-}"; then
        echo -e "ERROR: "$*
    else
        echo -e "ERROR: "$* | tee -a ${LOG_FILE}
    fi
    exit 1
}

# Helper function to run a command and append its output to a log. Aborts early
# if the program file is not found.
# Usage: run_command CMD ARG1 ARG2...
run_command() {
    local cmd
    cmd=$(which $1 || \
              for d in api training; do
                  which $d/$1 && break
              done) || err_exit "'$1' not found"
    shift
    tlog "[$(date)] ${cmd} $@"
    if ! "${cmd}" "$@" |& tee -a ${LOG_FILE}; then
        err_exit "Program $(basename ${cmd}) failed. Abort."
    fi
}

# Check if all the given files exist, or exit otherwise.
# Used to check required input files and produced output files in each phase.
# Usage: check_file_readable FILE1 FILE2...
check_file_readable() {
    for file in $@; do
        if [[ ! -r ${file} ]]; then
            err_exit "${file} does not exist or is not readable"
        fi
    done
}

# Sets the named variable to given value. Aborts if the value is missing or
# if it looks like a flag.
# Usage: parse_value VAR_NAME VALUE
parse_value() {
    local val="${2:-}"
    if [[ -z "$val" ]]; then
        err_exit "Missing value for variable $1"
        exit
    fi
    if [[ ${val:0:2} == "--" ]]; then
        err_exit "Invalid value $val passed for variable $1"
        exit
    fi
    eval $1=\"$val\"
}

# Does simple command-line parsing and initialization.
parse_flags() {
    local i=0
    while test $i -lt ${#ARGV[@]}; do
        local j=$((i+1))
        case ${ARGV[$i]} in
            --)
                break;;
            --fontlist)
                fn=0
                FONTS=""
                while test $j -lt ${#ARGV[@]}; do
                    test -z "${ARGV[$j]}" && break
                    test $(echo ${ARGV[$j]} | cut -c -2) = "--" && break
                    FONTS[$fn]="${ARGV[$j]}"
                    fn=$((fn+1))
                    j=$((j+1))
                done
                i=$((j-1)) ;;
            --exposures)
                exp=""
                while test $j -lt ${#ARGV[@]}; do
                    test -z "${ARGV[$j]}" && break
                    test $(echo ${ARGV[$j]} | cut -c -2) = "--" && break
                    exp="$exp ${ARGV[$j]}"
                    j=$((j+1))
                done
                parse_value "EXPOSURES" "$exp"
                i=$((j-1)) ;;
            --fonts_dir)
                parse_value "FONTS_DIR" ${ARGV[$j]:-}
                i=$j ;;
	    --tmp_dir)
		parse_value "TMP_DIR"   ${ARGV[$j]:-}
		i=$j ;;
            --lang)
                parse_value "LANG_CODE" ${ARGV[$j]:-}
                i=$j ;;
            --langdata_dir)
                parse_value "LANGDATA_ROOT" ${ARGV[$j]:-}
                i=$j ;;
            --maxpages)
                parse_value "MAX_PAGES" ${ARGV[$j]:-}
                i=$j ;;
            --my_boxtiff_dir)
                parse_value "MY_BOXTIFF_DIR" ${ARGV[$j]:-}
                i=$j ;;
            --distort_image)
                DISTORT_IMAGE=true ;;
            --output_dir)
                parse_value "OUTPUT_DIR" ${ARGV[$j]:-}
                i=$j ;;
            --overwrite)
                OVERWRITE=true ;;
            --save_box_tiff)
                SAVE_BOX_TIFF=true ;;
            --linedata_only)
                LINEDATA=true ;;
            --extract_font_properties)
                EXTRACT_FONT_PROPERTIES=true ;;
            --noextract_font_properties)
                EXTRACT_FONT_PROPERTIES=false ;;
            --tessdata_dir)
                parse_value "TESSDATA_DIR" ${ARGV[$j]:-}
                i=$j ;;
            --training_text)
                parse_value "TRAINING_TEXT" "${ARGV[$j]:-}"
                i=$j ;;
            --wordlist)
                parse_value "WORDLIST_FILE" ${ARGV[$j]:-}
                i=$j ;;
            --workspace_dir)
                rmdir "$FONT_CONFIG_CACHE"
                rmdir "$WORKSPACE_DIR"
                parse_value "WORKSPACE_DIR" ${ARGV[$j]:-}
                FONT_CONFIG_CACHE=$WORKSPACE_DIR/fc-cache
                mkdir -p $FONT_CONFIG_CACHE
                i=$j ;;
            --xsize)
                parse_value "X_SIZE" ${ARGV[$j]:-}
                i=$j ;;
            *)
                err_exit "Unrecognized argument ${ARGV[$i]}" ;;
        esac
        i=$((i+1))
    done
    if [[ -z ${LANG_CODE:-} ]]; then
        err_exit "Need to specify a language --lang"
    fi
    if [[ -z ${LANGDATA_ROOT:-} ]]; then
        err_exit "Need to specify path to language files --langdata_dir"
    fi
    if [[ -z ${TESSDATA_DIR:-} ]]; then
        if [[ -z ${TESSDATA_PREFIX} ]]; then
            err_exit "Need to specify a --tessdata_dir or have a "\
        "TESSDATA_PREFIX variable defined in your environment"
        else
            TESSDATA_DIR="${TESSDATA_PREFIX}"
        fi
    fi

    # Location where intermediate files will be created.
    TIMESTAMP=$(date +%Y-%m-%d)
    if [[ -z ${TMP_DIR:-} ]]; then
        TMP_DIR=$(mktemp -d -t ${LANG_CODE}-${TIMESTAMP}.XXX)
    else
	TMP_DIR=$(mktemp -d -p ${TMP_DIR} -t ${LANG_CODE}-${TIMESTAMP}.XXX)
    fi
    TRAINING_DIR=${TMP_DIR}
    # Location of log file for the whole run.
    LOG_FILE=${TRAINING_DIR}/tesstrain.log

    # Take training text and wordlist from the langdata directory if not
    # specified in the command-line.
    TRAINING_TEXT=${TRAINING_TEXT:-${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}.training_text}
    WORDLIST_FILE=${WORDLIST_FILE:-${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}.wordlist}

    WORD_BIGRAMS_FILE=${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}.word.bigrams
    NUMBERS_FILE=${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}.numbers
    PUNC_FILE=${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}.punc
    BIGRAM_FREQS_FILE=${TRAINING_TEXT}.bigram_freqs
    UNIGRAM_FREQS_FILE=${TRAINING_TEXT}.unigram_freqs
    TRAIN_NGRAMS_FILE=${TRAINING_TEXT}.train_ngrams
    GENERATE_DAWGS=1
}

# Function initializes font config with a unique font cache dir.
initialize_fontconfig() {
    export FONT_CONFIG_CACHE
    local sample_path=${FONT_CONFIG_CACHE}/sample_text.txt
    echo "Text" >${sample_path}
    run_command text2image --fonts_dir=${FONTS_DIR} \
        --font="${FONTS[0]}" --outputbase=${sample_path} --text=${sample_path} \
        --fontconfig_tmpdir=${FONT_CONFIG_CACHE}
}

# Helper function for phaseI_generate_image. Generates the image for a single
# language/font combination in a way that can be run in parallel.
generate_font_image() {
    local font="$1"
    tlog "Rendering using ${font}"
    local fontname=$(echo ${font} | tr ' ' '_' | sed 's/,//g')
    local outbase=${TRAINING_DIR}/${LANG_CODE}.${fontname}.exp${EXPOSURE}

    local common_args="--fontconfig_tmpdir=${FONT_CONFIG_CACHE}"
    common_args+=" --fonts_dir=${FONTS_DIR} --strip_unrenderable_words"
    common_args+=" --leading=${LEADING} --xsize=${X_SIZE}"
    common_args+=" --char_spacing=${CHAR_SPACING} --exposure=${EXPOSURE}"
    common_args+=" --outputbase=${outbase} --max_pages=${MAX_PAGES}"
    if $DISTORT_IMAGE; then
        common_args+=" --distort_image "
    fi

    # add --writing_mode=vertical-upright to common_args if the font is
    # specified to be rendered vertically.
    for vfont in "${VERTICAL_FONTS[@]}"; do
      if [[ "${font}" == "${vfont}" ]]; then
        common_args+=" --writing_mode=vertical-upright "
        break
      fi
    done

    run_command text2image ${common_args} --font="${font}" \
        --text=${TRAINING_TEXT}  ${TEXT2IMAGE_EXTRA_ARGS:-}
    check_file_readable ${outbase}.box ${outbase}.tif

    if $EXTRACT_FONT_PROPERTIES &&
        [[ -r ${TRAIN_NGRAMS_FILE} ]]; then
        tlog "Extracting font properties of ${font}"
        run_command text2image ${common_args} --font="${font}" \
            --ligatures=false --text=${TRAIN_NGRAMS_FILE} \
            --only_extract_font_properties --ptsize=32
        check_file_readable ${outbase}.fontinfo
    fi
}

# Phase I : Generate (I)mages from training text for each font.
phase_I_generate_image() {
    local par_factor=${1:-}
    if ! [[ "${par_factor}" -gt 0 ]]; then
        par_factor=1
    fi
    tlog "\n=== Phase I: Generating training images ==="
    if [[ -z ${TRAINING_TEXT:-} ]] || test ! -r "${TRAINING_TEXT}"; then
        err_exit "Could not find training text file ${TRAINING_TEXT:-}"
    fi
    CHAR_SPACING="0.0"

    for EXPOSURE in $EXPOSURES; do
        if $EXTRACT_FONT_PROPERTIES && [[ -r ${BIGRAM_FREQS_FILE} ]]; then
            # Parse .bigram_freqs file and compose a .train_ngrams file with text
            # for tesseract to recognize during training. Take only the ngrams whose
            # combined weight accounts for 95% of all the bigrams in the language.
            NGRAM_FRAC=$(cat ${BIGRAM_FREQS_FILE} \
                | awk '{s=s+$2}; END {print (s/100)*p}' p=99)
            cat ${BIGRAM_FREQS_FILE} | sort -rnk2 \
                | awk '{s=s+$2; if (s <= x) {printf "%s ", $1; } }' \
                x=${NGRAM_FRAC} > ${TRAIN_NGRAMS_FILE}
            check_file_readable ${TRAIN_NGRAMS_FILE}
        fi

        local jobs=
        trap "kill $$" INT
        for font in "${FONTS[@]}"; do
            sleep 1
            test $(jobs -r | wc -l) -ge $par_factor && wait -n
            generate_font_image "${font}" &
            jobs="$jobs $!"
        done
        wait $jobs
        # Check that each process was successful.
        for font in "${FONTS[@]}"; do
            local fontname=$(echo ${font} | tr ' ' '_' | sed 's/,//g')
            local outbase=${TRAINING_DIR}/${LANG_CODE}.${fontname}.exp${EXPOSURE}
            check_file_readable ${outbase}.box ${outbase}.tif
        done
    done
}

# Phase UP : Generate (U)nicharset and (P)roperties file.
phase_UP_generate_unicharset() {
    tlog "\n=== Phase UP: Generating unicharset and unichar properties files ==="

    local box_files=$(ls ${TRAINING_DIR}/*.box)
    UNICHARSET_FILE="${TRAINING_DIR}/${LANG_CODE}.unicharset"
    run_command unicharset_extractor --output_unicharset "${UNICHARSET_FILE}" \
      --norm_mode "${NORM_MODE}" ${box_files}
    check_file_readable ${UNICHARSET_FILE}

    XHEIGHTS_FILE="${TRAINING_DIR}/${LANG_CODE}.xheights"
    run_command set_unicharset_properties \
        -U ${UNICHARSET_FILE} -O ${UNICHARSET_FILE} -X ${XHEIGHTS_FILE} \
        --script_dir=${LANGDATA_ROOT}
    check_file_readable ${XHEIGHTS_FILE}
}

# Phase D : Generate (D)awg files from unicharset file and wordlist files
phase_D_generate_dawg() {
    tlog "\n=== Phase D: Generating Dawg files ==="

    # Skip if requested
    if [[ ${GENERATE_DAWGS} -eq 0 ]]; then
      tlog "Skipping ${phase_name}"
      return
    fi

    # Output files
    WORD_DAWG=${TRAINING_DIR}/${LANG_CODE}.word-dawg
    FREQ_DAWG=${TRAINING_DIR}/${LANG_CODE}.freq-dawg
    PUNC_DAWG=${TRAINING_DIR}/${LANG_CODE}.punc-dawg
    NUMBER_DAWG=${TRAINING_DIR}/${LANG_CODE}.number-dawg
    BIGRAM_DAWG=${TRAINING_DIR}/${LANG_CODE}.bigram-dawg

    # Word DAWG
    local freq_wordlist_file=${TRAINING_DIR}/${LANG_CODE}.wordlist.clean.freq
    if [[ -s ${WORDLIST_FILE} ]]; then
        tlog "Generating word Dawg"
        check_file_readable ${UNICHARSET_FILE}
        run_command wordlist2dawg -r 1 ${WORDLIST_FILE} ${WORD_DAWG} \
            ${UNICHARSET_FILE}
        check_file_readable ${WORD_DAWG}

        FREQ_DAWG_SIZE=100
        head -n ${FREQ_DAWG_SIZE} ${WORDLIST_FILE} > ${freq_wordlist_file}
    fi

    # Freq-word DAWG
    if [[ -s ${freq_wordlist_file} ]]; then
        check_file_readable ${UNICHARSET_FILE}
        tlog "Generating frequent-word Dawg"
        run_command wordlist2dawg  -r 1 ${freq_wordlist_file} \
            ${FREQ_DAWG} ${UNICHARSET_FILE}
        check_file_readable ${FREQ_DAWG}
    fi

    # Punctuation DAWG
    # -r arguments to wordlist2dawg denote RTL reverse policy
    # (see Trie::RTLReversePolicy enum in third_party/tesseract/dict/trie.h).
    # We specify 0/RRP_DO_NO_REVERSE when generating number DAWG,
    # 1/RRP_REVERSE_IF_HAS_RTL for freq and word DAWGS,
    # 2/RRP_FORCE_REVERSE for the punctuation DAWG.
    local punc_reverse_policy=0;
    if [[ "${LANG_IS_RTL}" == "1" ]]; then
      punc_reverse_policy=2
    fi
    if [[ ! -s ${PUNC_FILE} ]]; then
        PUNC_FILE="${LANGDATA_ROOT}/common.punc"
    fi
    check_file_readable ${PUNC_FILE}
    run_command wordlist2dawg -r ${punc_reverse_policy} \
        ${PUNC_FILE} ${PUNC_DAWG} ${UNICHARSET_FILE}
    check_file_readable ${PUNC_DAWG}

    # Numbers DAWG
    if [[ -s ${NUMBERS_FILE} ]]; then
        run_command wordlist2dawg -r 0 \
            ${NUMBERS_FILE} ${NUMBER_DAWG} ${UNICHARSET_FILE}
        check_file_readable ${NUMBER_DAWG}
    fi

    # Bigram dawg
    if [[ -s ${WORD_BIGRAMS_FILE} ]]; then
        run_command wordlist2dawg -r 1 \
            ${WORD_BIGRAMS_FILE} ${BIGRAM_DAWG} ${UNICHARSET_FILE}
        check_file_readable ${BIGRAM_DAWG}
    fi
}

# Phase E : (E)xtract .tr feature files from .tif/.box files
phase_E_extract_features() {
    local box_config=$1
    local par_factor=$2
    local ext=$3
    if ! [[ "${par_factor}" -gt 0 ]]; then
        par_factor=1
    fi
    tlog "\n=== Phase E: Generating ${ext} files ==="

    local img_files=""
    for exposure in ${EXPOSURES}; do
        img_files=${img_files}' '$(ls ${TRAINING_DIR}/*.exp${exposure}.tif)
    done

    # Use any available language-specific configs.
    local config=""
    if [[ -r ${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}.config ]]; then
        config=${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}.config
    fi

    OLD_TESSDATA_PREFIX=${TESSDATA_PREFIX}
    export TESSDATA_PREFIX=${TESSDATA_DIR}
    tlog "Using TESSDATA_PREFIX=${TESSDATA_PREFIX}"
    local jobs=
    trap "kill $$" INT
    for img_file in ${img_files}; do
        test $(jobs -r | wc -l) -ge $par_factor && wait -n
        run_command tesseract ${img_file} ${img_file%.*} \
            ${box_config} ${config} &
        jobs="$jobs $!"
    done
    wait $jobs
    export TESSDATA_PREFIX=${OLD_TESSDATA_PREFIX}
    # Check that all the output files were produced.
    for img_file in ${img_files}; do
        check_file_readable "${img_file%.*}.${ext}"
    done
}

# Phase C : (C)luster feature prototypes in .tr into normproto file (cnTraining)
# phaseC_cluster_prototypes ${TRAINING_DIR}/${LANG_CODE}.normproto
phase_C_cluster_prototypes() {
    tlog "\n=== Phase C: Clustering feature prototypes (cnTraining) ==="
    local out_normproto=$1

    run_command cntraining -D "${TRAINING_DIR}/" \
        $(ls ${TRAINING_DIR}/*.tr)

    check_file_readable ${TRAINING_DIR}/normproto
    mv ${TRAINING_DIR}/normproto ${out_normproto}
}

# Phase S : (S)hape clustering
phase_S_cluster_shapes() {
    if ! $RUN_SHAPE_CLUSTERING; then
        tlog "\n=== Shape Clustering disabled ==="
        return
    fi
    check_file_readable ${LANGDATA_ROOT}/font_properties
    local font_props="-F ${LANGDATA_ROOT}/font_properties"
    if [[ -r ${TRAINING_DIR}/${LANG_CODE}.xheights ]] &&\
       [[ -s ${TRAINING_DIR}/${LANG_CODE}.xheights ]]; then
        font_props=${font_props}" -X ${TRAINING_DIR}/${LANG_CODE}.xheights"
    fi

    run_command shapeclustering \
        -D "${TRAINING_DIR}/" \
        -U ${TRAINING_DIR}/${LANG_CODE}.unicharset \
        -O ${TRAINING_DIR}/${LANG_CODE}.mfunicharset \
        ${font_props} \
        $(ls ${TRAINING_DIR}/*.tr)
    check_file_readable ${TRAINING_DIR}/shapetable \
        ${TRAINING_DIR}/${LANG_CODE}.mfunicharset
}

# Phase M : Clustering microfeatures (mfTraining)
phase_M_cluster_microfeatures() {
    tlog "\n=== Phase M : Clustering microfeatures (mfTraining) ==="

    check_file_readable ${LANGDATA_ROOT}/font_properties
    font_props="-F ${LANGDATA_ROOT}/font_properties"
    if [[ -r ${TRAINING_DIR}/${LANG_CODE}.xheights ]] && \
       [[ -s ${TRAINING_DIR}/${LANG_CODE}.xheights ]]; then
        font_props=${font_props}" -X ${TRAINING_DIR}/${LANG_CODE}.xheights"
    fi

    run_command mftraining \
        -D "${TRAINING_DIR}/" \
        -U ${TRAINING_DIR}/${LANG_CODE}.unicharset \
        -O ${TRAINING_DIR}/${LANG_CODE}.mfunicharset \
        ${font_props} \
        $(ls ${TRAINING_DIR}/*.tr)
    check_file_readable ${TRAINING_DIR}/inttemp ${TRAINING_DIR}/shapetable \
        ${TRAINING_DIR}/pffmtable ${TRAINING_DIR}/${LANG_CODE}.mfunicharset
    mv ${TRAINING_DIR}/inttemp ${TRAINING_DIR}/${LANG_CODE}.inttemp
    mv ${TRAINING_DIR}/shapetable ${TRAINING_DIR}/${LANG_CODE}.shapetable
    mv ${TRAINING_DIR}/pffmtable ${TRAINING_DIR}/${LANG_CODE}.pffmtable
    mv ${TRAINING_DIR}/${LANG_CODE}.mfunicharset ${TRAINING_DIR}/${LANG_CODE}.unicharset
}

phase_B_generate_ambiguities() {
  tlog "\n=== Phase B : ambiguities training ==="

  # Check for manually created ambiguities data.
  if [[ -r ${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}.unicharambigs ]]; then
      tlog "Found file ${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}.unicharambigs"
      cp ${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}.unicharambigs \
          ${TRAINING_DIR}/${LANG_CODE}.unicharambigs
      # Make it writable, as it may be read-only in the client.
      chmod u+w ${TRAINING_DIR}/${LANG_CODE}.unicharambigs
      return
  else
      tlog "No unicharambigs file found!"
  fi

  # TODO: Add support for generating ambiguities automatically.
}

make__lstmdata() {
  tlog "\n=== Constructing LSTM training data ==="
  local lang_prefix="${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}"
  if [[ ! -d "${OUTPUT_DIR}" ]]; then
      tlog "Creating new directory ${OUTPUT_DIR}"
      mkdir -p "${OUTPUT_DIR}"
  fi
  local lang_is_rtl=""
  if [[ "${LANG_IS_RTL}" == "1" ]]; then
    lang_is_rtl="--lang_is_rtl"
  fi
  local pass_through=""
  if [[ "${NORM_MODE}" -ge "2" ]]; then
    pass_through="--pass_through_recoder"
  fi

  # Build the starter traineddata from the inputs.
  run_command combine_lang_model \
    --input_unicharset "${TRAINING_DIR}/${LANG_CODE}.unicharset" \
    --script_dir "${LANGDATA_ROOT}" \
    --words "${lang_prefix}.wordlist" \
    --numbers "${lang_prefix}.numbers" \
    --puncs "${lang_prefix}.punc" \
    --output_dir "${OUTPUT_DIR}" --lang "${LANG_CODE}" \
    "${pass_through}" "${lang_is_rtl}"

  if $SAVE_BOX_TIFF; then
    tlog "\n=== Saving box/tiff pairs for training data ==="
  for f in "${TRAINING_DIR}/${LANG_CODE}".*.box; do
    tlog "Moving ${f} to ${OUTPUT_DIR}"
    mv "${f}" "${OUTPUT_DIR}"
  done
  for f in "${TRAINING_DIR}/${LANG_CODE}".*.tif; do
    tlog "Moving ${f} to ${OUTPUT_DIR}"
    mv "${f}" "${OUTPUT_DIR}"
  done
  fi
  tlog "\n=== Moving lstmf files for training data ==="
  for f in "${TRAINING_DIR}/${LANG_CODE}".*.lstmf; do
    tlog "Moving ${f} to ${OUTPUT_DIR}"
    mv "${f}" "${OUTPUT_DIR}"
  done
  local lstm_list="${OUTPUT_DIR}/${LANG_CODE}.training_files.txt"
  ls -1 "${OUTPUT_DIR}/${LANG_CODE}".*.lstmf > "${lstm_list}"
}

make__traineddata() {
  tlog "\n=== Making final traineddata file ==="
  local lang_prefix=${LANGDATA_ROOT}/${LANG_CODE}/${LANG_CODE}

  # Combine available files for this language from the langdata dir.
  if [[ -r ${lang_prefix}.config ]]; then
    tlog "Copying ${lang_prefix}.config to ${TRAINING_DIR}"
    cp ${lang_prefix}.config ${TRAINING_DIR}
    chmod u+w ${TRAINING_DIR}/${LANG_CODE}.config
  fi
  if [[ -r ${lang_prefix}.params-model ]]; then
    tlog "Copying ${lang_prefix}.params-model to ${TRAINING_DIR}"
    cp ${lang_prefix}.params-model ${TRAINING_DIR}
    chmod u+w ${TRAINING_DIR}/${LANG_CODE}.params-model
  fi

  # Compose the traineddata file.
  run_command combine_tessdata ${TRAINING_DIR}/${LANG_CODE}.

  # Copy it to the output dir, overwriting only if allowed by the cmdline flag.
  if [[ ! -d ${OUTPUT_DIR} ]]; then
      tlog "Creating new directory ${OUTPUT_DIR}"
      mkdir -p ${OUTPUT_DIR}
  fi
  local destfile=${OUTPUT_DIR}/${LANG_CODE}.traineddata;
  if [[ -f ${destfile} ]] && ! $OVERWRITE; then
      err_exit "File ${destfile} exists and no --overwrite specified";
  fi
  tlog "Moving ${TRAINING_DIR}/${LANG_CODE}.traineddata to ${OUTPUT_DIR}"
  cp -f ${TRAINING_DIR}/${LANG_CODE}.traineddata ${destfile}
}


text:
/**
 * @file common.h
 * @ingroup common
 * @short Public header common for both parsing and formatting modules.
 **/

#ifndef FSDP_COMMON_H
#define FSDP_COMMON_H

/* Macros to avoid name mangling when compiling with a C++ compiler */
#ifdef __cplusplus
#  define BEGIN_C_DECLS extern "C" {
#  define END_C_DECLS   }
#else /* !__cplusplus */
#  define BEGIN_C_DECLS
#  define END_C_DECLS
#endif /* __cplusplus */

#include <sys/time.h>
#include <time.h>

BEGIN_C_DECLS
/**
 * @defgroup common FreeSDP Common Facilities
 *
 * Data types and routines common for both parsing and formatting
 * modules.
 **/
/** @addtogroup common */
/*@{*/
/**
 * @enum fsdp_error_t freesdp/common.h
 * @short Error codes in the FreeSDP library.
 *
 * There is a FSDPE_MISSING_XXXX for each mandatory line, as
 * FSDPE_MISSING_OWNER. This kind of error is reported when a
 * mandatory description line, such as the owner line, is not found
 * where it should be in the SDP description. There are also several
 * error codes like FSDPE_INVALID_XXXX. These are returned when there
 * is a recognized line in the parsed description that violates the
 * SDP syntax or gives wrong parameters, for instance "c=foo bar",
 * which would cause a FSDPE_INVALID_CONNECTION error code to be
 * returned.
 **/
typedef enum
{
  FSDPE_OK = 0,
  FSDPE_ILLEGAL_CHARACTER,	 /**< Misplaced '\r', '\n' or '\0' */
  FSDPE_MISSING_VERSION,	 /**< The first line is not like
				    v=... */
  FSDPE_INVALID_VERSION,	 /**< Parse error in version line,
				    perhaps, the version specified in
				    v=... is not valid for FreeSDP */
  FSDPE_MISSING_OWNER,		 /**< No owner line found in its
				    place */
  FSDPE_INVALID_OWNER,		 /**< Parse error in owner line */
  FSDPE_MISSING_NAME,		 /**< No session name found in its
				    place */
  FSDPE_EMPTY_NAME,		 /**< Empty session name line */

  FSDPE_INVALID_CONNECTION,	 /**< Syntax error in connection
				    line */

  FSDPE_INVALID_CONNECTION_ADDRTYPE, /**< Unrecognized address type in
					connection line */
  FSDPE_INVALID_CONNECTION_NETTYPE,  /**< Unrecognized network type in
					connection line */
  FSDPE_INVALID_BANDWIDTH,	     /**< Parse error in bandwidth
					line */
  FSDPE_MISSING_TIME,		 /**< No time period has been given
				    for the session */
  FSDPE_INVALID_TIME,		 /**< Parse error in time line */
  FSDPE_INVALID_REPEAT,		 /**< Parse error in repeat time
				    line */
  FSDPE_INVALID_TIMEZONE,	 /**< Parse error in timezone line */
  FSDPE_INVALID_ENCRYPTION_METHOD, /**< Unknown encryption method */
  FSDPE_INVALID_ATTRIBUTE,	 /**< Syntax error in an attribute
				    line */

  FSDPE_INVALID_ATTRIBUTE_RTPMAP,/**< Parse error in a=rtpmap:... line */
  FSDPE_INVALID_SESSION_TYPE,	 /**< An unknown session type has been
				    specified in a `type:'
				    session-level attribute */

  FSDPE_INVALID_MEDIA,		 /**< Parse error in media line */
  FSDPE_UNKNOWN_MEDIA_TYPE,	 /**< Unknown media type in media
				    line */

  FSDPE_UNKNOWN_MEDIA_TRANSPORT, /**< A media transport has been
				    specified that is unknown */

  FSDPE_OVERFILLED,		 /**< extra unknown lines are at the
				    end of the description */
  FSDPE_INVALID_LINE,		 /**< a line unknown to FreeSDP has been
				    found */
  FSDPE_MISSING_CONNECTION_INFO, /**< No connection information has
				     been provided for the whole
				     session nor one or more media */
  FSDPE_INVALID_INDEX,
  /*  FSDPE_MAXSIZE, description does not fit requested maximun size */
  FSDPE_INTERNAL_ERROR,

  FSDPE_INVALID_PARAMETER,	 /**< Some parameter of the called
				       FreeSDP routine has been given an
				       invalid value. This includes
				       cases such as NULL pointers. */
  FSDPE_BUFFER_OVERFLOW
} fsdp_error_t;

/**
 * @short Type of network
 *
 * Initially, SDP defines "Internet". New network types may be
 * registered with IANA. However, the number of types is expected to
 * be small and rarely extended. In addition, every new network type
 * requires at least one new address type.
 **/
typedef enum
{
  FSDP_NETWORK_TYPE_UNDEFINED,		       /**< Not provided */
  FSDP_NETWORK_TYPE_INET		       /**< Internet */
} fsdp_network_type_t;

/**
 * @short Type of address
 *
 * Initially, IPv4 and IPv6 are defined for the network type
 * Internet. New address types may be registered with IANA.
 **/
typedef enum
{
  FSDP_ADDRESS_TYPE_UNDEFINED,		       /**< Not provided */
  FSDP_ADDRESS_TYPE_IPV4,		      /**< IP version 4 */
  FSDP_ADDRESS_TYPE_IPV6		      /**< IP version 6 */
} fsdp_address_type_t;

/**
 * @short Type of bandwith modifiers
 *
 * Bandwidth modifiers specify the meaning of the bandwidth
 * value. Initially "Conference Total" and "Application Specific" are
 * defined. Both use kilobits as bandwidth unit. "Conference Total"
 * specifies that the bandwidth value is a proposed upper limit to the
 * session bandwidth. "Application Specific" specifies thath the
 * bandwidth value is the application concept of maximum bandwidth.
 **/
typedef enum
{
  FSDP_BW_MOD_TYPE_UNDEFINED,		 /**< Not provided */
  FSDP_BW_MOD_TYPE_UNKNOWN,		 /**< Unknown bandwidth
						  modifier (FreeSDP
						  ignores it) */
  FSDP_BW_MOD_TYPE_CONFERENCE_TOTAL,	 /**< "CT - Conference Total" */
  FSDP_BW_MOD_TYPE_APPLICATION_SPECIFIC, /**< "AS - Application specific" */
  FSDP_BW_MOD_TYPE_RTCP_SENDERS,	 /**< "RS - RTCP bandwidth for
					    senders */
  FSDP_BW_MOD_TYPE_RTCP_RECEIVERS,	 /**< "RR - RTCP bandwidth for
					    receivers */
} fsdp_bw_modifier_type_t;

/**
 * @short encryption method
 *
 * The encryption method specifies the way to get the encryption key.
 **/
typedef enum
{
  FSDP_ENCRYPTION_METHOD_UNDEFINED,    /**< Not provided */
  FSDP_ENCRYPTION_METHOD_CLEAR,	       /**< The key field is the
						 untransformed key */
  FSDP_ENCRYPTION_METHOD_BASE64,       /**< The key is base64
					  encoded */
  FSDP_ENCRYPTION_METHOD_URI,	       /**< The key value provided is
					  a URI pointing to the actual
					  key */
  FSDP_ENCRYPTION_METHOD_PROMPT	       /**< The key is not provided
					  but should be got prompting
					  the user */
} fsdp_encryption_method_t;

/**
 * @short Advised reception/transmission mode
 *
 * Depending on wheter sendrecv, recvonly, sendonly or inactive
 * attribute is given, the tools used to participate in the session
 * should be started in the corresponding transmission
 * mode. FSDP_SENDRECV_SENDRECV is the default for sessions which are
 * not of the conference type broadcast or H332.
 **/
typedef enum
{
  FSDP_SENDRECV_UNDEFINED,		      /**< Not specified */
  FSDP_SENDRECV_SENDRECV,		      /**< Send and receive */
  FSDP_SENDRECV_RECVONLY,		      /**< Receive only */
  FSDP_SENDRECV_SENDONLY,		      /**< Send only */
  FSDP_SENDRECV_INACTIVE		      /**< Do not send nor receive */
} fsdp_sendrecv_mode_t;

/**
 * @short Values for `orient' media attribute.
 *
 * Normally used with whiteboard media, this attribute specifies the
 * orientation of the whiteboard.
 **/
typedef enum
{
  FSDP_ORIENT_UNDEFINED,		     /**< Not specified */
  FSDP_ORIENT_PORTRAIT,			     /**< Portrait */
  FSDP_ORIENT_LANDSCAPE,		     /**< Landscape */
  FSDP_ORIENT_SEASCAPE			     /**< Upside down landscape */
} fsdp_orient_t;

/**
 * @short Type of the conference
 *
 * The following types are initially defined: broadcast, meeting,
 * moderated, test and H332.
 **/
typedef enum
{
  FSDP_SESSION_TYPE_UNDEFINED,		       /**< Not specified */
  FSDP_SESSION_TYPE_BROADCAST,		       /**< Broadcast session */
  FSDP_SESSION_TYPE_MEETING,		       /**< Meeting session */
  FSDP_SESSION_TYPE_MODERATED,		       /**< Moderated session */
  FSDP_SESSION_TYPE_TEST,		       /**< Test (do not display) */
  FSDP_SESSION_TYPE_H332		       /**< H332 session */
} fsdp_session_type_t;

/**
 * @short Media type
 *
 * The following types are defined initially: audio, video,
 * application, data and control.
 **/
typedef enum
{
  FSDP_MEDIA_UNDEFINED,		   /**< Not specified */
  FSDP_MEDIA_VIDEO,		   /**< Video */
  FSDP_MEDIA_AUDIO,		   /**< Audio */
  FSDP_MEDIA_APPLICATION,	   /**< Application, such as whiteboard */
  FSDP_MEDIA_DATA,		   /**< bulk data */
  FSDP_MEDIA_CONTROL		   /**< Control channel */
} fsdp_media_t;

/**
 * @short Transport protocol
 *
 * The transport protocol used depends on the address type. Initially,
 * RTP over UDP Audio/Video Profile, and UDP are defined.
 *
 **/
typedef enum
{
  FSDP_TP_UNDEFINED,		  /**< Not specified */
  FSDP_TP_RTP_AVP,		  /**< RTP Audio/Video Profile */
  FSDP_TP_UDP,			  /**< UDP */
  FSDP_TP_TCP,			  /**< TCP */
  FSDP_TP_UDPTL,		  /**< ITU-T T.38*/
  FSDP_TP_VAT,			  /**< old vat protocol (historic)*/
  FSDP_TP_OLD_RTP,		  /**< old rtp protocols (historic)*/
  FSDP_TP_H320			  /**< TODO: add to the parser */
} fsdp_transport_protocol_t;

/**
 * Session-level attributes whose value is specified as a character
 * string in FreeSDP. These values are usually given to
 * fsdp_get_strn_att() in order to get the corresponding value.
 *
 **/
typedef enum
{
  FSDP_SESSION_STR_ATT_CATEGORY,
  FSDP_SESSION_STR_ATT_KEYWORDS,
  FSDP_SESSION_STR_ATT_TOOL,
  FSDP_SESSION_STR_ATT_CHARSET,
} fsdp_session_str_att_t;

/**
 * @short FreeSDP SDP description media object.
 *
 * Object for media specific information in SDP descriptions. Each SDP
 * description may include any number of media section. A
 * fsdp_media_description_t object encapsulates the information in a
 * media section, such as video, audio or whiteboard.
 **/
typedef struct fsdp_media_description_t_s fsdp_media_description_t;

/**
 * @short FreeSDP SDP session description object.
 *
 * Contains all the information extracted from a textual SDP
 * description, including all the media announcements.
 **/
typedef struct fsdp_description_t_s fsdp_description_t;

/**
 * Allocates memory and initializes values for a new
 * fsdp_description_t object. If you call this routine, do not forget
 * about fsdp_description_delete()
 *
 * @return new fsdp_description_t object
 **/
fsdp_description_t *fsdp_description_new (void);

/**
 * Destroys a fsdp_description_t object.
 *
 * @param dsc pointer to the fsdp_description_t object to delete.
 **/
void fsdp_description_delete (fsdp_description_t * dsc);

/**
 * Calling this function over a description is equivalent to calling
 * fsdp_description_delete and then fsdp_description_delete. This
 * function is however more suitable and efficient for description
 * processing loops.
 *
 * @param dsc pointer to the fsdp_description_t object to
 * renew/recycle.
 **/
void fsdp_description_recycle (fsdp_description_t * dsc);

/**
 *  * Returns a string correspondent to the error number.
 *   *
 *    * @param err_no error number.
 *     **/
const char *fsdp_strerror (fsdp_error_t err_no);

       /*@}*//* closes addtogroup common */

END_C_DECLS
#endif /* FSDP_COMMON_H */


text:
/*******************************************************************************
* Name: QuizziPedia::Front-End::Directives::LogoutBarDirective;
* Description: directive contenente il componente che permette di effettuare
* il logout dal sistema; Permette di effettuare il logout dal sistema;
* Creation data: 27-04-2016;
* Author: Matteo Granzotto;
* License: MIT.
********************************************************************************
* Updates history
*-------------------------------------------------------------------------------
* ID: LogoutBarDirective_20160427;
* Update data: 27-04-2016;
* Description: Creata la direttiva e scritto il file js;
* Author: Matteo Granzotto.
*-------------------------------------------------------------------------------
*******************************************************************************/

app.directive('logoutBarDirective', logoutBarDirective);

function logoutBarDirective() {
  var directive = {
    restrict: 'E',
    templateUrl: 'Directives/LogoutBarDirective.html'
  };
  return directive;
}


text:
require "metacrunch/hash"
require "metacrunch/transformator/transformation/step"
require_relative "../mab_to_primo"

class Metacrunch::UBPB::Transformations::MabToPrimo::AddDDC < Metacrunch::Transformator::Transformation::Step
  def call
    target ? Metacrunch::Hash.add(target, "ddc", ddc) : ddc
  end

  private

  def ddc
    ddc_fields = []
    ddc_fields << source.datafields('700', ind1: 'b', ind2: '1').subfields('a').values
    ddc_fields << source.datafields('705', ind1: :blank, ind2: '1').subfields('a').values

    ddc_fields.flatten.map(&:presence).compact.uniq
  end
end


text:
<?php

namespace Magento\Authorization\Model\Resource\Rules;

/**
 * @magentoAppArea adminhtml
 */
class CollectionTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Magento\Authorization\Model\Resource\Rules\Collection
     */
    protected $_collection;

    protected function setUp()
    {
        $this->_collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
            'Magento\Authorization\Model\Resource\Rules\Collection'
        );
    }

    public function testGetByRoles()
    {
        $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\User\Model\User');
        $user->loadByUsername(\Magento\TestFramework\Bootstrap::ADMIN_NAME);
        $this->_collection->getByRoles($user->getRole()->getId());

        $where = $this->_collection->getSelect()->getPart(\Zend_Db_Select::WHERE);
        /** @var \Zend_Db_Adapter_Abstract $adapter */
        $adapter = $this->_collection->getConnection();
        $quote = $adapter->getQuoteIdentifierSymbol();
        $this->assertContains("({$quote}role_id{$quote} = '" . $user->getRole()->getId() . "')", $where);
    }

    public function testAddSortByLength()
    {
        $this->_collection->addSortByLength();

        $order = $this->_collection->getSelect()->getPart(\Zend_Db_Select::ORDER);
        $this->assertContains(['length', 'DESC'], $order);
    }
}


text:
class ReduceableFateCost {
    constructor(playingType) {
        this.playingType = playingType;
    }

    canPay(context) {
        if(context.source.printedCost === null) {
            return false;
        }
        let minCost = context.player.getMinimumCost(this.playingType, context);
        return context.player.fate >= minCost &&
            (minCost === 0 || context.player.checkRestrictions('spendFate', context));
    }

    resolve(context, result) {
        let alternatePools = context.player.getAlternateFatePools(this.playingType, context.source);
        let alternatePoolTotal = alternatePools.reduce((total, pool) => total + pool.fate, 0);
        let maxPlayerFate = context.player.checkRestrictions('spendFate', context) ? context.player.fate : 0;
        if(this.getReducedCost(context) > maxPlayerFate + alternatePoolTotal) {
            result.cancelled = true;
        } else if(!result.cancelled && alternatePools.length > 0 && context.player.checkRestrictions('takeFateFromRings', context)) {
            let properties = {
                reducedCost: this.getReducedCost(context),
                remainingPoolTotal: alternatePoolTotal
            };
            context.costs.alternateFate = new Map();
            let maxPlayerFate = context.player.checkRestrictions('spendFate', context) ? context.player.fate : 0;
            for(const alternatePool of alternatePools) {
                context.game.queueSimpleStep(() => {
                    properties.remainingPoolTotal -= alternatePool.fate;
                    properties.minFate = Math.max(properties.reducedCost - maxPlayerFate - properties.remainingPoolTotal, 0);
                    properties.maxFate = Math.min(alternatePool.fate, properties.reducedCost);
                    properties.pool = alternatePool;
                    properties.numberOfChoices = properties.maxFate - properties.minFate + 1;
                    if(result.cancelled || properties.numberOfChoices === 0) {
                        return;
                    }
                    this.promptForAlternateFate(context, result, properties);
                });
            }
        }
    }

    getReducedCost(context) {
        return context.player.getReducedCost(this.playingType, context.source);
    }

    promptForAlternateFate(context, result, properties) {
        let choices = Array.from(Array(properties.numberOfChoices), (x, i) => i + properties.minFate);
        if(result.canCancel) {
            choices.push('Cancel');
        }
        context.game.promptWithHandlerMenu(context.player, {
            activePromptTitle: 'Choose amount of fate to spend from the ' + properties.pool.name,
            choices: choices,
            choiceHandler: choice => {
                if(choice === 'Cancel') {
                    result.cancelled = true;
                    return;
                }
                if(choice > 0) {
                    context.game.addMessage('{0} takes {1} fate from {2} to pay the cost of {3}', context.player, choice, properties.pool, context.source);
                }
                context.costs.alternateFate.set(properties.pool, choice);
                properties.reducedCost -= choice;
            }
        });
    }

    pay(context) {
        context.costs.fate = this.getReducedCost(context);
        context.player.markUsedReducers(this.playingType, context.source);
        context.player.fate -= this.getFinalFatecost(context, context.costs.fate);
    }

    getFinalFatecost(context, reducedCost) {
        if(!context.costs.alternateFate) {
            return reducedCost;
        }
        let totalAlternateFate = 0;
        for(let alternatePool of context.player.getAlternateFatePools(this.playingType, context.source)) {
            alternatePool.modifyFate(-context.costs.alternateFate.get(alternatePool));
            totalAlternateFate += context.costs.alternateFate.get(alternatePool);
        }
        return Math.max(reducedCost - totalAlternateFate, 0);
    }
}

module.exports = ReduceableFateCost;


text:
var error = require('./index');

module.exports = {
  toError: function(errorData) {
    if (!errorData.name || !errorData.message) {
      return null
    }

    var ErrorProto = error(errorData.name);

    var props = {};
    for (prop in errorData) {
      if (prop === 'name' || prop === 'message') {
        continue
      }
      props[prop] = errorData[prop];
    }

    return new ErrorProto(errorData.message, props);
  }
};


text:
package com.amazonaws.services.timestreamquery.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.Request;

import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.timestreamquery.model.*;
import com.amazonaws.transform.Marshaller;

import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * CancelQueryRequest Marshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class CancelQueryRequestProtocolMarshaller implements Marshaller<Request<CancelQueryRequest>, CancelQueryRequest> {

    private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.AWS_JSON).requestUri("/")
            .httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true).operationIdentifier("Timestream_20181101.CancelQuery")
            .serviceName("AmazonTimestreamQuery").build();

    private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;

    public CancelQueryRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
        this.protocolFactory = protocolFactory;
    }

    public Request<CancelQueryRequest> marshall(CancelQueryRequest cancelQueryRequest) {

        if (cancelQueryRequest == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            final ProtocolRequestMarshaller<CancelQueryRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING,
                    cancelQueryRequest);

            protocolMarshaller.startMarshalling();
            CancelQueryRequestMarshaller.getInstance().marshall(cancelQueryRequest, protocolMarshaller);
            return protocolMarshaller.finishMarshalling();
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
<!DOCTYPE html>

  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="">
  <meta name="generator" content="Hugo 0.26" />

  <title>Hello World · StatSnips</title>

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.2/pure-min.css">

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.2/grids-responsive-min.css">

  <link rel="stylesheet" href="../../../../css/side-menu.css">

  <link rel="stylesheet" href="../../../../css/blackburn.css">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

  <link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet" type="text/css">

  <link rel="shortcut icon" href="https://statsnips.github.ioimg/favicon.ico" type="image/x-icon" />

  <img src="https://raw.githubusercontent.com/StatSnips/statsnips.github.io/master/images/logo.png" height=25

          Home

          About

          Archive

          Authors

          Contact

          Blog GitHub

      Twitter

      LinkedIn

      GitHub

      GitLab

      Stack Overflow

    © 2017-2018 StatSnips. Distributed Under a MIT License.

    Built with Hugo and Blogdown
    Theme Blackburn

Hello World

    <time>12 Dec 2016</time>

      Alvin Thomas

      General /

      Open Source

You might not think that programmers are artists, but programming is an extremely creative profession. It's logic-based creativity. - John Romero

I hope to use this space to post code snippets to make my life and the lives of other statistical programmers easier. As an epidemiologist, I use data from national registries and clinical trials to answer interesting questions in public health, surgery, and medicine. I code mostly in Stata and R, but I'm always interested in optimizing my workflow and learning new techniques. I hope you find my thoughts useful! You can follow me @alvinthomas13 or add me on LinkedIn.

      Bash Stata on Oracle Grid Engine (JHPCE)

Please enable JavaScript to view the comments powered by Disqus.
comments powered by Disqus


text:
//
//  NWHTTPConnection.h
//  NWTools
//
//  Copyright (c) 2012 noodlewerk. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol NWActivityIndicator;

/**
 * A convenience wrapper around NSURLConnection.
 *
 * Similar to the sendAsynchronousRequest: method of NSURLConnection, but also provides a cancel method.
 */
@interface NWHTTPConnection : NSObject<NSURLConnectionDelegate>

/**
 * The callback block that is invoked as soon as the NSURLConnection finishes or fails.
 */
@property (nonatomic, copy) void(^block)(NSHTTPURLResponse *response, NSData *data);

/**
 * The queue on which the completion block will be invoked.
 */
@property (nonatomic, strong) NSOperationQueue *callbackQueue;

/**
 * Indicator this connection will register on after starting.
 */
@property (nonatomic, strong) id<NWActivityIndicator> indicator;

@property (nonatomic, strong) NSURLRequest *request;

/**
 * Initialize with request.
 * @param request The request fed to a NSURLConnection.
 */
- (id)initWithRequest:(NSURLRequest *)request;

/**
 * Kicks off the NSURLConnection on the main runloop.
 */
- (void)start;

/**
 * Cancels any running connection without calling the completion block.
 */
- (void)cancel;

@end


text:
<ion-view view-title="Calendar">

      <input type="search" ng-model="query" placeholder="Search">

  <ion-content class="has-subheader">

  <ion-refresher on-refresh="doRefresh()"></ion-refresher>

{{ day.weekday }}

{{ day.title }}

{{ day.description }}

    <ion-list>
      <ion-item ng-class="{'item-avatar':item.shortname, 'star': item.star}"
      class="item-text-wrap item-icon-right" ng-repeat="item in day.schedule | filter: query" href="#">

{{ item.time }}

{{ item.title }}

{{ item.artist ? ' with ' + item.artist : '' }}

{{ item.description }}

        <button class="button button-clear icon ion-star button-assertive" ng-click="toggleStar(item)" ng-show="item.star"></button>
        <ion-option-button class="button-calm" ng-click="toggleStar(item)"></ion-option-button>
        <ion-option-button class="button-assertive" ng-click="onItemDelete(dayIndex, item)"></ion-option-button>
      </ion-item>
    </ion-list>

  </ion-content>
</ion-view>