Skip to content

Instantly share code, notes, and snippets.

Given a chess board of dimensions X by Y and a starting position of A and B,
output the first P sequences of moves of a Knight piece that cover every field
and return to the starting position.
A Knight piece can only move in an L-like motion, going two fields in one
direction and then one field 90 degrees to that, or one field in one
direction and then two fields 90 degrees to that.
Create a function that takes five integers X, Y, A, B, P as inputs.
Print out a human-readable representation of a completed sequence,
/*
* MIT LICENSE
*
* Copyright 2019 Markus Lachinger
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
@mmlac
mmlac / BUILD
Created December 11, 2016 04:33 — forked from bsilver8192/BUILD
Basics of generating a compile_commands.json file with Bazel
py_binary(
name = 'generate_compile_command',
srcs = [
'generate_compile_command.py',
],
deps = [
'//third_party/bazel:extra_actions_proto_py',
],
)
@mmlac
mmlac / ConsoleApplication.cpp
Last active August 5, 2023 14:53
[C++ & C# Examples] Getting the existing processes running on the system and their modules - Written & Tested in VS2015
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <psapi.h>
#include <list>
#include <algorithm>
#include <string>
#include <cctype>
#include <sstream>
> testOnly com.badgeville.newton.ApiTest
23
23
23
23
23
23
23
23
23
@mmlac
mmlac / IRB
Last active December 10, 2015 01:19
Mongoid: includes?
################################
### Create some data in IRB ###
################################
30.times{|i|
s = Shelf.create(genre: i.to_s)
100.times{|i|
Book.create(shelf: s, sites: "The not so Final Fantasy #{i}")
}
}
@mmlac
mmlac / AppDelegate.h
Created June 26, 2012 04:11
UITabBarController with NavigationController that lets every view decide if it wants to be rotated
@interface UITabBarController (MyApp)
@end
@interface UINavigationController (MyApp)
@end