BitNaughts is a educational programming video-game; it's code gamified!
git clone --recurse-submodules https://github.com/bitnaughts/bitnaughts.git
Updated 8/1/2022
๐จโ๐ป Interpreting (some) C#
BitNaughts is a educational programming video-game; it's code gamified!
git clone --recurse-submodules https://github.com/bitnaughts/bitnaughts.git
Updated 8/1/2022
Add support for the "[]" string, creating array data objects. There are a few cases to consider for how one might declare an array in C#. In the variable handler, array[0] could be saved as "array0", array[1] as "array1", etc.
int[] values = new int[10];
float[] other_values = new float[] { 10.2, 3.4 };
Add support for the "switch" keyword and, implicitly, the "case" and "default" keywords. This will require attention in adjusting how the interpreter handles "break" statements and custom pointer manipulation for the conditional cases.
switch (value) {
case "yes":
break;
case "no":
break;
default:
break;
}
A Substring handler to deal with the many times a Substring function is called would significantly improve readability of code.
e.g. "SubstringHandler.TrimTo(FIRST_INSTANCE_OF, "(", LAST_INSTANCE OF, ")");"
Instead of stepping and switching by line, the interpreter would be more accurate and visually educational if it stepped per part of each line.
e.g.
if (x + 5 == 7) {
would first fetch any variable values from memory (an EEPROM):
if (2 + 5 == 7) {
then step through PEMDAS if need-be:
if (7 == 7) {
and lastly the evaluation (which is still in PEMDAS technically...):
if (true) {
This simplified "if true" would then be passed into the original interpreter to control scope and flow control (see ScopeHandler).
It gets more complicated with function calls mid-line, but this is where the current interpreter fails. Thus, this is an imperative to-do to allow for as versatile code inputs as possible.
Add support for the "else" keyword and, implicitly, the "else if" combination. This will require attention in managing the pointer on closing bracket of an if statement to ensure that it jumps past ignored unsatisfied conditionals.
if (i == 0) {
}
else if (i & 2 == 0) {
}
else {
}
Code, algorithm, data interpreted via plots, graphs, and other visual elements
Remove the integration of Unity in the interpreter.
using UnityEngine;
public GameObject obj;
Add support for various objects that will be of use to a player. Each object will have its own rules and conditions to follow. For example, a Vector2 has two float members, "x" and "y". Other data types will have their own hard-coded list of variable object members.
Vector2 point = new Vector2(10.2, 3.4);
Controlling speed of code interpreting (which, from a game-play aspect, is highly relevant) needs to consider underlying clock cycles from an assembly perspective to better estimate and step through the script.
To facilitate this, it will require a new object-oriented reworking of the interpreter to clearly define an Action
, which ScopeAction
, AssignmentAction
, ArithmeticAction
, etc. would inherit. Actions would have the current scope they were executed on, which would hold scope-visible variables.
The Interpreter would work on each Step()
to determine what the next Action
it needs to take is, then take that Action
. It would never execute more than one action in a clock cycle. Actions could also be set to take a certain number of clock cycles to complete, meaning subsequent calls to Step()
would be working to decrement a clock_cycles_left
sort of counter before finding the next Action
to execute.
This would result in a highly flexible, tune-able interpreter with improved readability from a coding perspective, where logic for isolating and executing Actions
would be distinct and independent functionalities.
It also works to incentivize players to write code that works efficiently and logically, as inefficiency in their code execute would be very obviously hampering ship performance. To help players analyze their script execution, all Actions
can be logged and viewed as an execution tree, built from the scope queue.
Add support for the "foreach" keyword. This is a rather difficult prospect in controlling the flow behind the scenes and iterating across a given array (note, arrays are not implemented at this time).
foreach (int value in array_of_values) {
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.