AnkiCode

AnkiCode - algorithms memorization app based on Anki

Getting Started

Anki

AnkiCode is a fork of Anki.

Anki Getting Started


New card type - Programming Challenge

AnkiCode extends Anki by adding the new card type “Programming Challenge”. Field list:


Example:

Field Value
Title Sum of two integers.
Decsription Given two integers calculate their sum.
Function name sum
Solution ```js
function sum(a, b) { return a + b }
```
Test-Cases int;int;int
1; 1; 2
2; 2; 4
3; 3; 6


Code Editor

Using the integrated code editor user can debug his solution, errors and log messages will be displayed in the Console.

User can select a Programming Language and Theme using Language and Skin selectboxes.


Code Editor Hotkeys

OS X Windows Action
Cmd + R Ctrl + R Execute code
Cmd + J Ctrl + J Switch to Java
Alt + J Alt + J Switch to JavaScript
Alt + P Alt + P Switch to Python
Alt + C Alt + C Switch to C++


Test-Cases Format

Test-Cases are stored in CSV format (semicolon or tab-separated).


Test-Cases Header Format

Header contains all neccessary type meta-information for a function’s arguments and return value. Generic Header declaration for N arguments:


Arg1-Type[Arg1-Name];Arg2-Type[Arg2-Name];...;ArgN-Type[ArgN-Name];Result-Type[Verification-Opts]



Supported Type Mappings

Type Java Python C++ JavaScript
int int int int Number
long long int long int Number
float double float double Number
string String str string String
bool bool bool bool Boolean
list List List vector array
array array List vector array
map Map Dict map Map
linked_list LinkedListNode LinkedListNode LinkedListNode LinkedListNode
binary_tree BinaryTreeNode BinaryTreeNode BinaryTreeNode LinkedListNode
object class class struct Object


Supported Verification Types

Name Type Description
ignore_order boolean (True or False), False by default ignore order of elements during results comparison


Example:


Primitive types declaration


Arg-Type[Arg-Name]

note: Arg-Name is optional


Example: int[i]

Java

foo_type foo(int i) {
   ...
}

Python

def foo(i: int):
   ...

C++

foo_type foo(int i) {
   ...
}

JavaScript

function foo(i) {
   ...
}


Array/List type declaration


list|array(Inner-Type)[Arg-Name]

note: Arg-Name is optional


Example: array(int)[arr]

Java

foo_type foo(int[] arr) {
   ...
}

Python

def foo(arr: List[int]):
   ...

C++

foo_type foo(vector<int> arr) {
   ...
}

JavaScript

function foo(arr) {
   ...
}


Object type declaration


object(Field1-Type[Field1-Name], Field2-Type[Field2-Name], …)<Object-Type>

note: FieldX-Name is optional


Example: object(array(int)[arr], float[b], object(int[a], String[b])<SubType>[sub])<MainType>[main]

Java

public class SubType {
   public int a;
   public String b;
   public SubType(int a, String b) {
      this.a = a;
      this.b = b;
   }
}

public class MainType {
   public int[] arr;
   public SubType sub;
   public MainType(int[] arr, SubType sub) {
      this.arr = arr;
      this.sub = sub;
   }
}

void foo(MainType main) {
}

Python

class SubType:
   def __init__(self, a: int, b: str):
      self.a = a
      self.b = b

class MainType:
   def __init__(self, arr: List[int], sub: SubType):
      self.arr = arr
      self.sub = sub

C++

struct SubType {
   int a;
   string b;
};

struct MainType {
   vector<int> arr;
   SubType sub;
};

JavaScript

In JavaScript no explicit types will be generated, instead of it the corresponding JS Doc will be generated


Test-Case Rows


Every row of CSV body represents one test case. In every column of every row value for a particular parameter is stored. Values of container types such as lists, maps, arrays, objects are stored in JSON arrays.

Examples: