content stringlengths 263 5.24M | pred_label stringclasses 1
value | pred_score_pos float64 0.6 1 |
|---|---|---|
<!DOCTYPE html>
<html>
<head>
<title>Game Physics Engine Integration: RigidBody Physics Engine </title>
<link rel ="icon" type ="image/x-icon" href="./assets/favicon.png">
<!-- the following says there are javascript source code contained in
the external source files
-... | __label__POS | 0.85032 |
#include "stdafx.h"
#include <stdlib.h>
// The function PrintResults is defined in CalcMatrixRowColSumsMisc.cpp
extern void PrintResults(const int* x, int nrows, int ncols, int* row_sums, int* col_sums);
extern "C" int CalcMatrixRowColSums_(const int* x, int nrows, int ncols, int* row_sums, int* col_sums);
void CalcM... | __label__POS | 0.975391 |
#include "stdafx.h"
#include <math.h>
extern "C" bool CalcMeanStdev_(const double* a, int n, double* mean, double* stdev);
bool CalcMeanStdevCpp(const double* a, int n, double* mean, double* stdev)
{
if (n <= 1)
return false;
double sum = 0.0;
for (int i = 0; i < n; i++)
... | __label__POS | 0.755927 |
/*
* File: CameraShake.js
* Defines a damped simple harmonic motion to simulate camera shakie
*/
/*jslint node: true, vars: true, bitwise: true */
/*global gEngine, vec2, ShakePosition */
/* find out more about jslint: http://www.jslint.com/help.html */
"use strict";
/**
* Defines a damped simple harmonic motion... | __label__POS | 0.803081 |
/**
* Sequence.go
* Copyright Roger Peppe
*/
package main
import (
"errors"
"fmt"
"os"
"text/template"
)
var tmpl = `{{$comma := sequence "" ", "}}
{{range $}}{{$comma.Next}}{{.}}{{end}}
{{$comma := sequence "" ", "}}
{{$colour := cycle "black" "white" "red"}}
{{range $}}{{$comma.Next}}{{.}} in {{$colour.Next... | __label__POS | 0.782512 |
//------------------------------------------------
// Ch05_09_fcpp.cpp
//------------------------------------------------
#include <stdexcept>
#include <vector>
#include <immintrin.h>
#include "Ch05_09.h"
#include "MatrixF64.h"
bool MatrixInvF64_Cpp(MatrixF64& a_inv, const MatrixF64& a, double epsilon)
... | __label__POS | 0.809683 |
package dictionary
import (
"bufio"
"fmt"
"os"
//"fmt"
"container/vector"
"strings"
)
func main() {
// called only when debugging this package
dictionaryPath := "/var/www/go/chinese/cedict_ts.u8"
d := new(Dictionary)
d.loadDictionary(dictionaryPath)
// check it loaded okay
goodD := d.LookupEnglish("good"... | __label__POS | 0.729891 |
//------------------------------------------------
// Ch05_08_fcpp.cpp
//------------------------------------------------
#include <stdexcept>
#include <vector>
#include <immintrin.h>
#include "Ch05_08.h"
#include "MatrixF32.h"
bool MatrixInvF32_Cpp(MatrixF32& a_inv, const MatrixF32& a, float epsilon)
{... | __label__POS | 0.641416 |
/* Sequence.go
* Copyright Roger Peppe
*/
package main
import (
"errors"
"fmt"
"os"
"text/template"
)
var tmpl = `{{$comma := sequence "" ", "}}
{{range $}}{{$comma.Next}}{{.}}{{end}}
{{$comma := sequence "" ", "}}
{{$colour := cycle "black" "white" "red"}}
{{range $}}{{$comma.Next}}{{.}} in {{$colour.Next}}{{e... | __label__POS | 0.668126 |
package main
import (
"fmt"
"unicode/utf8"
)
func str2int(str string) []int {
r := []rune(str)
b := make([]int, utf8.RuneCountInString(str))
for i, v := range r {
b[i] = int(v)
}
return b
}
//unicode to 8859-4
var unicodeToISOMap = map[int]uint8{
// example match ascii 0x0021: 0x21, // !
0x012e: 0xc7, // ... | __label__POS | 0.872558 |
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
/*
// go run dictionary.go - will load cedict_ts.u8 and render
func main() {
// called only when debugging this package
dictionaryPath := "cedict_ts.u8"
d := new(Dictionary)
d.loadDictionary(dictionaryPath)
// check it l... | __label__POS | 0.739501 |
package main
import (
"fmt"
"strings"
)
func PinyinFormatter(args ...any) string {
ok := false
var s string
if len(args) == 1 {
s, ok = args[0].(string)
}
if !ok {
s = fmt.Sprint(args...)
}
fmt.Println("Formatting func " + s)
// the string may consist of several pinyin words
// each one needs to be cha... | __label__POS | 0.620836 |
package main
import (
"bytes"
"encoding/base64"
"encoding/hex"
"net/http"
"net/http/httptest"
"testing"
)
func FuzzMe(f *testing.F) {
for _, seed := range [][]byte{{}, {0}, {9}, {0xa}, {0xf}, {1, 2, 3, 4}} {
f.Add(seed)
}
// the fuzz runner f leverages the test runner t,
// this is so the fuzzer can mana... | __label__POS | 0.60826 |
#BlueJ package file
dependency1.from=HelloLauncher
dependency1.to=HelloWorldImage
dependency1.type=UsesDependency
editor.fx.0.height=0
editor.fx.0.width=0
editor.fx.0.x=0
editor.fx.0.y=0
objectbench.height=154
objectbench.width=760
package.divider.horizontal=0.6
package.divider.vertical=0.6786427145708582
package.edito... | __label__POS | 0.601578 |
<?php
declare(strict_types=1);
namespace popp\ch05\batch09;
require_once("vendor/autoload.php");
use popp\test\BaseUnit;
class Batch09Test extends BaseUnit
{
public function testRunner()
{
$val = $this->capture(function() { Runner::runClass(); });
$expected = <<<EXPECTED
popp\ch05\batch09\... | __label__POS | 0.980309 |
<?php
declare(strict_types=1);
namespace popp\ch24\batch01\parse;
/* listing 24.12 */
class RepetitionParse extends CollectionParse
{
public function __construct(private int $min = 0, private int $max = 0, ?string $name = null, array $options = [])
{
parent::__construct($name, $options);
if... | __label__POS | 0.987444 |
<?php
namespace popp\ch10\batch05;
require_once("vendor/autoload.php");
use popp\test\BaseUnit;
class Batch05Test extends BaseUnit
{
public function testArmy()
{
$tank = new Tank();
$tank2 = new Tank();
$soldier = new Soldier();
$army = new Army();
$army->addUnit($... | __label__POS | 0.669937 |
<?php
declare(strict_types=1);
namespace popp\ch12\batch05;
//use popp\ch18\batch04\woo\controller\ApplicationHelper;
//
class Registry
{
private array $values = [];
private static ?Registry $instance = null;
private ?Request $request = null;
private ?Conf $conf = null;
private ?Conf $commands = ... | __label__POS | 0.910686 |
<?php
declare(strict_types=1);
namespace popp\ch12\batch05;
/* listing 12.15 */
abstract class Request
{
protected array $properties = [];
protected array $feedback = [];
protected string $path = "/";
public function __construct()
{
$this->init();
}
abstract public function init... | __label__POS | 0.852835 |
<?php
declare(strict_types=1);
namespace popp\ch12\batch04;
class Registry
{
private static ?Registry $instance = null;
private ?Request $request = null;
/* listing 12.06 */
// class Registry
private ?TreeBuilder $treeBuilder = null;
private ?Conf $conf = null;
// ...
/* /listing 12.06 */... | __label__POS | 0.752094 |
<?php
declare(strict_types=1);
namespace popp\ch12\batch06;
class Registry
{
private array $values = [];
private static $instance = null;
private ?Request $request = null;
private ?Conf $conf = null;
private ?Conf $commands = null;
private ?ApplicationHelper $applicationHelper = null;
pri... | __label__POS | 0.830301 |
<?php
declare(strict_types=1);
namespace popp\ch12\batch06;
abstract class Request
{
protected array $properties = [];
protected array $feedback = [];
protected string $path = "/";
protected int $cmdstatus = 0;
public function __construct()
{
$this->init();
}
abstract public... | __label__POS | 0.976415 |
//------------------------------------------------
// Ch09_03.cpp
//------------------------------------------------
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include "Ch09_03.h"
static void CalcBSA(void);
int main()
{
try
{
CalcBSA();
CalcBSA_b... | __label__POS | 0.691482 |
<?php
declare(strict_types = 1);
namespace popp\ch24\batch01\parse;
/* listing 24.11 */
class RepetitionParse extends CollectionParse
{
private $min;
private $max;
public function __construct($min = 0, $max = 0, $name = null, $options = null)
{
parent::__construct($name, $options);
i... | __label__POS | 0.969271 |
<?php
declare(strict_types = 1);
namespace popp\ch12\batch05;
//use popp\ch18\batch04\woo\controller\ApplicationHelper;
//
class Registry
{
private $values = [];
private static $instance = null;
private $request = null;
private $conf = null;
private $commands = null;
private $applicationHelper... | __label__POS | 0.883458 |
<?php
declare(strict_types=1);
namespace popp\ch09\batch14_1;
/* listing 09.54 */
class ObjectAssembler
{
private array $components = [];
public function __construct(string $conf)
{
$this->configure($conf);
}
private function configure(string $conf): void
{
$data = simplexml... | __label__POS | 0.897696 |
<?php
declare(strict_types = 1);
namespace popp\ch12\batch05;
/* listing 12.15 */
abstract class Request
{
protected $properties;
protected $feedback = [];
protected $path = "/";
public function __construct()
{
$this->init();
}
abstract public function init();
public functio... | __label__POS | 0.899956 |
<?php
declare(strict_types = 1);
namespace popp\ch12\batch04;
class Registry
{
private static $instance = null;
private $request = null;
/* listing 12.06 */
// class Registry
private $treeBuilder = null;
private $conf = null;
// ...
/* /listing 12.06 */
/* listing 12.07 */
// class Re... | __label__POS | 0.744667 |
<?php
declare(strict_types = 1);
namespace popp\ch12\batch06;
class Registry
{
private $values = array();
private static $instance = null;
private $request = null;
private $conf = null;
private $commands = null;
private $applicationHelper = null;
private $pdo = null;
private function ... | __label__POS | 0.860508 |
<?php
declare(strict_types=1);
namespace popp\ch03\batch15;
/* listing 03.74 */
class ShopProduct
{
private int|float $discount = 0;
public function __construct(
private string $title,
private string $producerFirstName,
private string $producerMainName,
protected int|float $p... | __label__POS | 0.631863 |
using chapter_09.Objects;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
namespace chapter_09.States.Gameplay
{
public class ChopperGenerator
{
private bool _generateLeft = true;
private Vector2 _leftVector = new Vector2(-... | __label__POS | 0.604021 |
<?php
declare(strict_types = 1);
namespace popp\ch12\batch06;
abstract class Request
{
protected $properties;
protected $feedback = [];
protected $path = "/";
protected $cmdstatus = 0;
public function __construct()
{
$this->init();
}
abstract public function init();
abst... | __label__POS | 0.990041 |
<?php
namespace popp\ch06\batch01;
class ShopProduct
{
public string $type="book";
public function __construct(
public string $title,
public string $producerFirstName,
public string $producerMainName,
public float $price,
public int $numPages = 0,
public in... | __label__POS | 0.961374 |
/* File: Arena.js
*
*/
/*jslint node: true, vars: true */
/*global gEngine, Scene, GameObjectset, TextureObject, Camera, vec2,
FontRenderable, SpriteRenderable, LineRenderable,
GameObject */
/* find out more about jslint: http://www.jslint.com/help.html */
"use strict";
function Arena(x,y,w,h,res,frct,s1,s2, a... | __label__POS | 0.811043 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
<?php
declare(strict_types = 1);
namespace popp\ch09\batch14;
/* listing 09.39 */
class ObjectAssembler
{
private $components = [];
public function __construct(string $conf)
{
$this->configure($conf);
}
private function configure(string $conf)
{
$data = simplexml_load_file($c... | __label__POS | 0.892979 |
using Microsoft.Xna.Framework;
using System;
namespace chapter_09.Engine.Particles.EmitterTypes
{
public class CircleEmitterType : IEmitterType
{
public float Radius { get; private set; }
private RandomNumberGenerator _rnd = new RandomNumberGenerator();
public CircleEmitterType(float... | __label__POS | 0.931908 |
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.utils.Align;
/**
* Convenience class for creating custom Action objects
* for use with SceneSegment and Scene classes.
*/
public class Scen... | __label__POS | 0.888365 |
import com.badlogic.gdx.controllers.ControllerListener;
import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.Controllers;
import com.badlogic.gdx.controllers.PovDirection;
import com.badlogic.gdx.math.Vector3;
public abstract class BaseGamepadScreen extends BaseScreen implements Controll... | __label__POS | 0.991304 |
<?php
declare(strict_types=1);
namespace popp\ch03\batch14;
class ShopProduct
{
public $title;
public $producerMainName;
public $producerFirstName;
public $price;
/* listing 03.44 */
// ShopProduct class
public $discount = 0;
/* /listing 03.44 */
public function __construct(
string ... | __label__POS | 0.636822 |
<?php
namespace popp\ch18\batch04\woo\mapper;
abstract class Collection implements \Iterator
{
protected $mapper;
protected $total = 0;
protected $raw = [];
private $result;
private $pointer = 0;
private $objects = [];
private $package = "\\popp\\ch18\\batch04\\woo\\mapper";
public ... | __label__POS | 0.843902 |
using System;
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void RungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.NumEqns;
double s;
double[] q;
double[] dq1 = new dou... | __label__POS | 0.906164 |
using System;
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void RungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.NumEqns;
double s;
double[] q;
double[] dq1 = new dou... | __label__POS | 0.906164 |
<?php
declare(strict_types=1);
namespace popp\ch06\batch03;
/* listing 06.04 */
abstract class ParamHandler
{
protected $source;
protected $params = [];
public function __construct(string $source)
{
$this->source = $source;
}
public function addParam(string $key, string $val)
{
... | __label__POS | 0.975897 |
<?php
declare(strict_types=1);
namespace popp\ch18\batch04\woo\base;
use popp\ch18\batch04\woo\controller\Request;
use popp\ch18\batch04\woo\controller\AppController;
use popp\ch18\batch04\woo\controller\ControllerMap;
class ApplicationRegistry extends Registry
{
private static $instance = null;
private $fr... | __label__POS | 0.952038 |
<?php
namespace popp\ch18\batch04\woo\command;
use popp\ch18\batch04\woo\domain\Venue;
use popp\ch18\batch04\woo\controller\Request;
class AddSpace extends Command
{
protected function doExecute(Request $request)
{
$venue = $request->getObject("venue");
if (! isset($venue)) {
$ven... | __label__POS | 0.720373 |
using System;
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void RungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.NumEqns;
double s;
double[] q;
double[] dq1 = new dou... | __label__POS | 0.906164 |
<?php
namespace popp\ch18\batch04\woo\controller;
class ControllerMap
{
private $viewMap = [];
private $forwardMap = [];
private $classrootMap = [];
public function addClassroot($command, $classroot)
{
$this->classrootMap[$command] = $classroot;
}
public function getClassroot($co... | __label__POS | 0.999133 |
<?php
namespace popp\ch18\batch04\woo\controller;
use popp\ch18\batch04\woo\command\Command;
class Request
{
private $appreg;
private $properties;
private $objects = array();
private $feedback = array();
private $lastCommand;
public function __construct()
{
$this->init();
}
... | __label__POS | 0.754611 |
import com.badlogic.gdx.controllers.PovDirection;
public class XBoxGamepad
{
public static final int BUTTON_A = 0;
public static final int BUTTON_B = 1;
public static final int BUTTON_X = 2;
public static final int BUTTON_Y = 3;
public static fin... | __label__POS | 0.999951 |
using System;
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void RungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.NumEqns;
double s;
double[] q;
double[] dq1 = new dou... | __label__POS | 0.906164 |
<?php
namespace popp\ch18\batch04\woo\mapper;
abstract class Collection implements \Iterator
{
protected $mapper;
protected $total = 0;
protected $raw = [];
private $result;
private $pointer = 0;
private $objects = [];
private $package = "\\popp\\ch18\\batch04\\woo\\mapper";
public ... | __label__POS | 0.852677 |
<?php
namespace popp\ch18\batch04\woo\domain;
class Venue extends DomainObject
{
private $name;
private $spaces;
public function __construct($id = null, $name = null)
{
$this->name = $name;
parent::__construct($id);
}
public function setSpaces(SpaceCollection $spaces)
{
... | __label__POS | 0.957202 |
<?php
namespace popp\ch18\batch04\woo\domain;
class Space extends DomainObject
{
private $name;
private $events;
private $venue;
public function __construct($id = null, $name = 'main')
{
parent::__construct($id);
//$this->events = self::getCollection("woo\\domain\\Event");
... | __label__POS | 0.82846 |
<?php
namespace popp\ch18\batch04\woo\domain;
class Event extends DomainObject
{
private $start;
private $duration;
private $name;
private $space;
public function __construct($id = null, $name = "unknown")
{
parent::__construct($id);
$this->name = $name;
}
public func... | __label__POS | 0.66938 |
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var canvas_bg = document.getElementById('canvas_bg');
var context_bg = canvas_bg.getContext('2d');
var ball;
var displ;
var center = new Vector2D(0.5*canvas.width,50);
var m = 1;
var kSpring = 10;
var cDamping = 0.5;
var t0, t, dt... | __label__POS | 0.695922 |
<?php
namespace popp\ch18\batch04\woo\domain;
class ObjectWatcher
{
private $all = [];
private $dirty = [];
private $new = [];
private $delete = [];
private static $instance;
private function __construct()
{
}
public static function instance()
{
if (! self::$instance)... | __label__POS | 0.942527 |
<?php
namespace popp\ch18\batch04\woo\domain;
abstract class DomainObject
{
private $id = -1;
public function __construct($id = null)
{
if (is_null($id)) {
$this->markNew();
} else {
$this->id = $id;
}
}
public function markNew()
{
Obje... | __label__POS | 0.981924 |
using System;
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void RungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.NumEqns;
double s;
double[] q;
double[] dq1 = new dou... | __label__POS | 0.906164 |
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var canvas_bg = document.getElementById('canvas_bg');
var context_bg = canvas_bg.getContext('2d');
var ball;
var displ;
var center = new Vector2D(0.5*canvas.width,50);
var m = 1;
var kSpring = 10;
var cDamping = 0.5;
var t0, t, dt... | __label__POS | 0.602946 |
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.utils.Align;
/**
* Convenience class for creating custom Action objects
* for use with SceneSegment and Scene classes.
*/
public class Scen... | __label__POS | 0.888365 |
<?php
declare(strict_types=1);
namespace popp\ch18\batch04\woo\base;
use popp\ch18\batch04\woo\controller\Request;
use popp\ch18\batch04\woo\controller\AppController;
use popp\ch18\batch04\woo\controller\ControllerMap;
class ApplicationRegistry extends Registry
{
private static $instance=null;
private $freez... | __label__POS | 0.983194 |
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var canvas_bg = document.getElementById('canvas_bg');
var context_bg = canvas_bg.getContext('2d');
var ball;
var displ;
var center = new Vector2D(0.5*canvas.width,50);
var m = 1;
var kSpring = 1;
var t0, t, dt;
var acc, force;
var... | __label__POS | 0.690974 |
using chapter_10.Engine.Input;
using Microsoft.Xna.Framework.Input;
using System.Collections.Generic;
namespace chapter_10.Input
{
public class DevInputMapper : BaseInputMapper
{
public override IEnumerable<BaseInputCommand> GetKeyboardState(KeyboardState state)
{
var commands = ne... | __label__POS | 0.935155 |
<?php
namespace popp\ch18\batch04\woo\command;
use popp\ch18\batch04\woo\domain\Venue;
use popp\ch18\batch04\woo\controller\Request;
class AddSpace extends Command
{
public function doExecute(Request $request)
{
$venue = $request->getObject("venue");
if (! isset($venue)) {
$venue =... | __label__POS | 0.755547 |
using chapter_10.Objects;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
namespace chapter_10.States.Gameplay
{
public class ChopperGenerator
{
private bool _generateLeft = true;
private Vector2 _leftVector = new Vector2(-... | __label__POS | 0.604309 |
<?php
namespace popp\ch18\batch04\woo\controller;
class ControllerMap
{
private $viewMap = [];
private $forwardMap = [];
private $classrootMap = [];
public function addClassroot($command, $classroot)
{
$this->classrootMap[$command] = $classroot;
}
public function getClassroot($co... | __label__POS | 0.999568 |
/* File: UISprite.js
* Sprite class for the UI
*/
"use strict";
/**
* A sprite for UI
* @param {texture} sprite The sprite sheet to map the UISprite to
* @param {Array[]} position The base location for the UISprite
* @param {Array[]} size The size of the UISprite
* @param {Array[]} uvPos The UV location for... | __label__POS | 0.612368 |
<?php
declare(strict_types=1);
namespace popp\ch04\batch03;
use popp\ch04\batch02\ShopProduct;
use popp\ch04\batch02\BookProduct;
use popp\ch04\batch02\CdProduct;
class Runner
{
public static function run2()
{
// demonstrate abstract instantiation error
/* listing 04.10 */
$writer = new Sh... | __label__POS | 0.791994 |
using System;
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void RungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.NumEqns;
double s;
double[] q;
double[] dq1 = new dou... | __label__POS | 0.906164 |
using chapter_10.Engine.Input;
using Microsoft.Xna.Framework.Input;
using System.Collections.Generic;
namespace chapter_10.Input
{
public class GameplayInputMapper : BaseInputMapper
{
public override IEnumerable<BaseInputCommand> GetKeyboardState(KeyboardState state)
{
var commands... | __label__POS | 0.98856 |
<?php
namespace popp\ch18\batch04\woo\controller;
use popp\ch18\batch04\woo\command\Command;
class Request
{
private $appreg;
private $properties;
private $objects = array();
private $feedback = array();
private $lastCommand;
public function __construct()
{
$this->init();
}
... | __label__POS | 0.75349 |
//Program to illustrate "protected" with
// phones
// -- from _C++ for Lazy Programmers_
#include <cassert>
class Phone
{
public:
void call() { /*do some stuff, and then */ incNumCalls(); }
static int numCalls() { return numCalls_; }
protected:
void incNumCalls () { ++numCalls_; }
... | __label__POS | 0.730599 |
<?php
declare(strict_types=1);
namespace popp\ch04\batch08;
class Runner
{
public static function run()
{
$logger = create_function(
'$product',
'print " logging ({$product->name})\n";'
);
$processor = new ProcessSale();
$processor->registerCallback... | __label__POS | 0.661863 |
//Program to print a list of super-heroes
// -- from _C++ for Lazy Programmers_
#include <iostream>
#include <string>
#include "vector.h"
using namespace std;
class Superhero
{
public:
Superhero (const char* theName = "") : name_ (theName) {}
void print (ostream& out ) const { out << name_; }
private:
... | __label__POS | 0.806421 |
<?php
namespace popp\ch18\batch04\woo\domain;
class Venue extends DomainObject
{
private $name;
private $spaces;
public function __construct($id = null, $name = null)
{
$this->name = $name;
parent::__construct($id);
}
public function setSpaces(SpaceCollection $spaces)
{
... | __label__POS | 0.957202 |
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var balls;
var t;
var t0;
var dt;
var animId;
var animTime = 10; // duration of animation
var numBalls = 10;
window.onload = init;
function init() {
balls = new Array();
for (var i=0; i<numBalls; i++){
var radius = (Math.ra... | __label__POS | 0.652628 |
<?php
namespace popp\ch18\batch04\woo\domain;
class Space extends DomainObject
{
private $name;
private $events;
private $venue;
public function __construct($id = null, $name = 'main')
{
parent::__construct($id);
//$this->events = self::getCollection("woo\\domain\\Event");
... | __label__POS | 0.82846 |
<?php
namespace popp\ch18\batch04\woo\domain;
class Event extends DomainObject
{
private $start;
private $duration;
private $name;
private $space;
public function __construct($id = null, $name = "unknown")
{
parent::__construct($id);
$this->name = $name;
}
public func... | __label__POS | 0.66938 |
<?php
namespace popp\ch18\batch04\woo\domain;
class ObjectWatcher
{
private $all = [];
private $dirty = [];
private $new = [];
private $delete = [];
private static $instance;
private function __construct()
{
}
public static function instance()
{
if (! self::$instance)... | __label__POS | 0.945603 |
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var ball1;
var ball2;
var t; // time from start of simulation
var t0; // time at last call
var dt; // elapsed time between calls
var animId;
var pos0 = new Vector2D(100,350);
var velo0 = new Vector2D(20,-80);
var acc = new Ve... | __label__POS | 0.796666 |
<?php
namespace popp\ch18\batch04\woo\domain;
abstract class DomainObject
{
private $id = -1;
public function __construct($id = null)
{
if (is_null($id)) {
$this->markNew();
} else {
$this->id = $id;
}
}
public function markNew()
{
Obje... | __label__POS | 0.981924 |
/*
* File: CameraShake.js
* Defines a damped simple harmonic motion to simulate camera shakie
*/
/*jslint node: true, vars: true, bitwise: true */
/*global gEngine, vec2, ShakePosition */
/* find out more about jslint: http://www.jslint.com/help.html */
"use strict";
/**
* Defines a damped simple harmonic motion... | __label__POS | 0.803081 |
using System;
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void RungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.NumEqns;
double s;
double[] q;
double[] dq1 = new dou... | __label__POS | 0.906164 |
using Microsoft.Xna.Framework;
using System;
namespace chapter_10.Engine.Particles.EmitterTypes
{
public class CircleEmitterType : IEmitterType
{
public float Radius { get; private set; }
private RandomNumberGenerator _rnd = new RandomNumberGenerator();
public CircleEmitterType(float... | __label__POS | 0.932026 |
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System.Linq;
namespace chapter_10.Engine.Objects.Animations
{
public class Animation
{
private List<AnimationFrame> _frames = new List<AnimationFrame>();
private int _animationAge = 0;
private int _lifespan = -1;
... | __label__POS | 0.91968 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var canvas_bg = document.getElementById('canvas_bg');
var context_bg = canvas_bg.getContext('2d');
var planet;
var sun;
var m = 1; // planet's mass
var M = 1000000; // sun's mass
var G = 1;
var t0,dt;
window.onload = init;
func... | __label__POS | 0.674852 |
<?php
declare(strict_types=1);
namespace popp\ch04\batch16;
/* listing 04.92 */
class Address
{
private string $number;
private string $street;
public function __construct(string $maybenumber, string $maybestreet = null)
{
if (is_null($maybestreet)) {
$this->streetaddress = $mayb... | __label__POS | 0.619608 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void rungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.getNumEqns();
double s;
double q[];
double dq1[] = new double[numEqn... | __label__POS | 0.806099 |
using chapter_10.Objects;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
namespace chapter_10.States.Gameplay
{
public class ChopperGenerator
{
private bool _generateLeft = true;
private Vector2 _leftVector = new Vector2(-... | __label__POS | 0.604309 |
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void rungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.getNumEqns();
double s;
double q[];
double dq1[] = new double[numEqn... | __label__POS | 0.839229 |
<?php
declare(strict_types=1);
namespace popp\ch13\batch05;
use popp\ch13\batch04\Registry;
abstract class Mapper
{
protected ?\PDO $pdo = null;
public function __construct()
{
$reg = Registry::instance();
$this->pdo = $reg->getPdo();
}
private function getFromMap($id): ?Domain... | __label__POS | 0.75003 |
public class ODESolver
{
// Fourth-order Runge-Kutta ODE solver.
public static void rungeKutta4(ODE ode, double ds) {
// Define some convenience variables to make the
// code more readable
int j;
int numEqns = ode.getNumEqns();
double s;
double q[];
double dq1[] = new double[numEqn... | __label__POS | 0.839229 |
using Microsoft.Xna.Framework;
using System;
namespace chapter_10.Engine.Particles.EmitterTypes
{
public class CircleEmitterType : IEmitterType
{
public float Radius { get; private set; }
private RandomNumberGenerator _rnd = new RandomNumberGenerator();
public CircleEmitterType(float... | __label__POS | 0.932026 |
<?php
declare(strict_types=1);
namespace popp\ch13\batch01;
/* listing 13.01 */
abstract class Mapper
{
protected \PDO $pdo;
public function __construct()
{
$reg = Registry::instance();
$this->pdo = $reg->getPdo();
}
public function find(int $id): ?DomainObject
{
$th... | __label__POS | 0.64545 |
using chapter_11.Engine.States;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
namespace chapter_11.Levels
{
public class LevelReader
{
private int _viewportWidth;
private const int NB_ROWS = 11;
private const int NB_TILE_R... | __label__POS | 0.786413 |
info face="Cooper Black" size=48 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=3,2,3,2 spacing=0,0
common lineHeight=62 base=45 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="cooper.png"
chars count=95
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=45 xa... | __label__POS | 0.946561 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.