instruction
stringlengths
71
71.9k
I've written this program that, renders a circle in the middle of the screen. It's been written in a very elementary way. Any suggestions on principles or techniques? Or any more optimal or efficient ways of drawing circles in C? I'm using SDL2 (Simple Direct Media Library) and GCC to compile. #include "SDL.h" #include...
I have written some code for mapping excel columns to table columns and processing data after mapping columns. Please review this code, check for SOLID, OOP principles and suggest any improvements and optimizations. Any critiques, suggestions or comments are warmly welcomed. API Action Method to get table and excel co...
As this will eventually become part of an operating system I'm developing, there is no specific adherence to any particular ABI, even though this is being developed and tested on Ubuntu 16.04. My OS will however adopt a SYSTEM V paradigm insomuch as passing values by register, but they will be passed in the one most su...
So, I have an assignment due in a couple days where I need to create a card game. I chose to do a memory game and I'm nearly completed however I'm completely stuck and not sure how to move all of the methods or functions into classes. Shuffle, cardFlip etc I'm wanting in classes but not sure on how to move them without...
I was attempting a question on HackerRank-Dijkstra's Shortest Reach 2 and upon submission my programs times out in 3/7 test cases. One of the test cases had 200 nodes and about 2000 connections. Here is my code- import java.util.Comparator; import java.util.PriorityQueue; import java.util.Scanner; import java.i...
I am in the process of refactoring this simple binary search tree code responsible for adding new values: void add_internal(Node *root, int value) { // Decide whether to insert left or right if (root->value >= value) { // Decide whether to insert here or down the subtree if (root->left) { ...
I have made this pong game as a 1 player game, versus the computer. however it is impossible to beat the ai. Any ideas to make the code better would be appreciated. import pygame from pygame.locals import * pointcounter = 0 class Pong(object): def __init__(self, screensize): self.screensize = screensize ...
I am programming my first android app. It is going to be a quiz. It will have 40 different categories of questions and for each category I am going to have a SQLite Table, which holds the questions for that category. I have a working DatabaseHelper for the first 2 tables. If I keep going like this for the next 38 tab...
I am using this code to upload an image. Please review it and give your feedback regarding performance, security, and quality. This also works in PDO project. <!DOCTYPE html> <html lang="en"> <meta charset="UTF-8"> <form action="" method="post" enctype="multipart/form-data"> <h2>Upload File</h2> <label for="file...
Write a program by creating an array of 9 integers that represent the positions in the tic-tac-toe board. Once the array is created, assign values to the board and print the contents of the board out. The values for the board are: Board Value: X, Integer in Array: 10 Board Value: O, Integer in Array: 100 Board ...
I have in-house template like QList which creates a list of all objects of, say, Book. This list contains many objects of Book. Book has member variable called BookTitle and in some cases objects have same value for BookTitle. Now I am thinking of writing a function which contains objects of Book having unique book ...
I'm working on a project that has an option to playing against Al, so I started to make it in a separate class and just extended the main class which has an object of a GUI class which draws the buttons and frames. My algorithm works as follows: Once a button is clicked: Set the text to "X" Check if player "X"(human) ...
My code works but I don't believe its the most efficient way of doing it. I'm still learning. Here is what the program requirements are: Executable code will fall within a loop that continues to loop until menu item 3 is entered. The menu (see screenshots below) appears first, and what follows depends on which men...
I've done this assignment here for my android programming course I'm taking. The exercise requirements were to create a single-activity interface for selecting a 'photo package' to purchase, and to select the payment method, and then display a short summary of the information (subtotal, sales tax, total cost, and sele...
Inspired by this question, I decided to give it a try and implemented a brainfuck interpreter myself. It includes various improvements: It's object-oriented and modular Unlimited tape size It includes a call stack (no seeking for opening parenthesis) It allows stepping and debugging It throws exceptions on errors Tap...
This is an iterative review. I asked for reviews on a Collatz sequence generator here. I tried to address all of the suggestions that were made. I've added a new function get_longest_collatz(n), which can be used to solve Project Euler problem 14 (the question states: which number under a million has the longest Collat...
I am working on an application which responds to different screen resolutions. At a certain minimum DPI, we want to apply a set of styles. We also want to apply that same set of styles if the class hidpi is present on the root html element. Our project uses LESS. This is the code I inherited. I've replaced the styles w...
Our senior developer gave us (trainees/jr. developers) a small exercise and that is to make our own Integer.toBinaryString(int n) implementation. This is the answer I came up with. I would just like to hear comments/suggestions/opinions on this. Especially, if there is a way to optimize my answer. public static String ...
I implemented a invert-range operation in a (logical) circular vector. A circular vector is a vector without a logical starting and ending object, or, equivalently, the successive element of the element at the last index of the vector is the element at index 0 (similarly for the previous element). I'm not 100% sure it'...
What I have I am a bit advanced PHP developer, but now I'm going to college where we are learning Ruby. We got the first homework and I did it. But I wanna make great code - so I looked for standards and found pretty much nothing. I only realized, that variables aren't named with camelCase but_like_this. I edited some ...
I am new to Haskell, and wrote a script to verify credit number. I did some tests, the script worked, but can it be improved further? isCreditCardNumber :: String -> Bool isCreditCardNumber number = 0 == creditCardReminder ( creditCardDouble ( blowupCreditCardNumber ( reverse number))) blowupCreditCardNumber :: St...
This is a little assignment I am working on. I am a beginner Java programmer and would love some advice on how to improve this code. For more context, here are the assignment details: Create a complete program that has the ability to store and display integer values in an array. The maximum number of values that yo...
I'm making a Texas Hold'em game for multiple players. So far, I have finished the flow control for betting / calling sequences, player stack / pot updating, and just now - the part responsible for drawing cards and distributing them. It is this last part that I would like reviewed, if possible. Essentially, I wanted to...
A couple of model classes are doing the validation using FluentValidator. These model classes are used to Add and Edit the branch data and they are working well but I have no idea how to remove the code smell (duplication). Problem: Notice the duplicate validations being written in BranchEditModel class as well. I have...
I see a couple of these on codereview but I was hoping my way hasn't yet been encountered: def is_palindrome_permutation(strng): cache = set() for char in strng.lower(): if not char.isalpha(): continue if char in cache: cache.remove(char) else: cache.a...
Using DataTables (Table plug-in for jQuery) with server-side processing, I had to create filtering for my data with good performance. However, in my opinion it's kinda ugly, especially the part of (.Where(...)), where I have to manually compare each property with the search variable. Is it possible to make it better? u...
I can recently coded an emulation system and in this project I have a PacketHandler for each player connected to a socket server, and each player receives packets (data) from the client application. Can someone please let me know if this code can be improved in any way? I will post the code below for the PlayerPacketHa...
I've written a small PHP library to connect with an Instagram application. The repository is on GitHub Instagram-php. Here I am adding only main class code. I require a code review and thoughts on performance and security issues. namespace Haridarshan\Instagram; use Haridarshan\Instagram\Exceptions\InstagramException;...
I wrote the following code for generating a table with random numbers and would like to ask if there is any way to optimize/enhance/modularize the JavaScript code, especially the addColumn and the addRow functions. <body onload="initlization()"> <form> <input type="button" class="button" value="Add Row" onclick="addRo...
This is an extension of this question due to it not covering an important role of my setup that I think needs more attention. The files are stored on a different server for separation and convenience. I'm trying to store references to files in my REST API. I'm using Django for my REST API and I need to find a convenien...
I have been trying to write a sample code block to remove multiple backward or forward slashes from a path (e.g. //a//b should be /a/b; on Windows, c:\\a\\b\\\c should be c:\a\b\c). I am assuming that: Code must be platform independent Should work in all cases (or report a proper error) It should be readable and maint...
After posting some of this code on Stack Overflow I was told to have a look here and get some feedback. I am having fun building a light JavaScript framework and have copied this pattern. It works fine, but I like to have some review on it. The reason that I was directed here is likely the use of CSSStyleDeclaration. I...
I'm starting to learn C and thought it would be a good idea to try and implement some data structures. I started with a very simple stack and would like to hear some opinions. Stack.c #include <stdio.h> #include <stdlib.h> #include "stack.h" struct Node { int element; struct Node* next; }; struct Node* head;...
I'm not really super experienced async/await and working with tasks, so I thought I'd ask for some other opinions. I'm working with code written by someone else that establishes a TCP connection. It works most of the time. But sometimes it just doesn't, and the connection gets dropped and we don't know about it. My fir...
I wrote this Python script as a utility script for me. It's something that could be achieved in a simple shell script or alias, but it wasn't 'verbose' enough for me in that format, or customizable. This script, basically, is just designed to take and process whether a specified DNS TSIG keyfile (necessary for 'signed...
This is a new discussion from this post (Find the shortest whole repetitive substring) and since it is totally new code, I post as a new thread here. The major initiative of posting a new thread is, RobAu has posted a smarter idea, and there is no implementation, and I implemented the ideas and has simple prove the ide...
The problem I want to solve is very simple: Given a string s and a string t, check if s is subsequence of t. there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string, and s is a short string (<=100). Example 1: s = "abc", t = "ahbgdc" Return true. Example 2:...
My code is a general solution to the following problem from Project Euler #12: What is the value of the first triangle number to have over five hundred divisors? MY CODE #include <iostream> int generate_triangular(int n); int enumerate_divisors(int n); int main() { std::cout<<"You want to find the first triangula...
Working on the problem of sum game. Suppose we have consecutive numbers from 1 to n, and an expected sum number, there are two players, and each player tries to select one number in turn (once a number is selected by one player, the other player cannot select it again), and the selected numbers are summed together. The...
My problem starts with a list A (length around n = 100) of big strings (around 10000 characters each). I also have another q = 10000 strings of length 100. I want to check if each string is a substring of any element of the list A. I've tried to do this using inor any but it is still taking too much time as there are 1...
I've made this little animation using SVG, CSS-keyframes and a bit of Sass. html, body, .wrap { height: 100%; } body { background-color: #efefef; } svg { max-width: 500px; width: 100%; height: 400px; position: absolute; margin: auto; top: 0; left: 0; bottom: 0; right: 0; } circle { position: a...
I've got an assigment where I have to print all the Pythagorean triples smaller than a given n. Even though I could print them directly in pythagoreanTriple function, I decided to structure everything, as I want to go deply into programming structure.(my teacher does not teach us a lot, so I'll have to study on my own)...
I wanted to start contributing to the Open Source community, and decided to release some of the Python tools I have written awhile ago. The problem is that I am not really familiar with good practices, and would really appreciate any advice and/or pointers you guys could give me. The code below is a package to visualiz...
I generally work in Python for programming competitions, but I'm teaching myself Scala. As an exercise, I've attempted Project Euler problem #12 in Scala. I hope that somebody familiar with Scala can point out anything I'm doing which is not idiomatic in "functional style" Scala. My code produces the correct result, an...
The following problem has been written using TDD. Please review the following: Unit tests OOP Design Principles (SOLID) Cleanliness and naming Anything that could make the program better. Problem Statement: Taxi Meter Company has to develop an app for their business. The app calculates the bill based on the car type...
I'm new to Observables. I'm using them to check if the user is logged in or not in the constructor of my root page. I have nested many Observables in order to do this, and they are working fine, but I think that there is a way to flatten all of these nested Observables. I just want you to review the code and let me kno...
This implementation is inspired by the POSIX functions sem_wait() and sem_post(). It tries to get rid of busy loops in the code and appears to work after some simple tests that have been done. But code involving concurrency is hard to get right. Hopefully, there are no race conditions and/or deadlocks in it. Update 1 s...
I'm new to Rust and trying to convert some Python to Rust. I have the following in Python: >>> v = ((0, 0), (1,1), (2, 2)) >>> strings = "\n".join(("%s: (%s, %s)" % (i, val[0], val[1]) for i,val in enumerate(v)))) >>> print(strings) 0: (0, 0) 1: (1, 1) 2: (2, 2) I'm trying to find the best/smartest/most rustic way of...
Recently while practicing I came across this problem , here is an excerpt from it, A permutation of the numbers 1, ..., N is a rearrangment of these numbers. For example 2 4 5 1 7 6 3 8 is a permutation of 1,2, ..., 8. Of course, 1 2 3 4 5 6 7 8 is also a permutation of 1, 2, ..., 8. Associated with ...
Mainly for practicing purposes, I'm trying to implement a simple, yet efficient memory pool. It's basically a linked list that is able to grow, with fixed sized members. Each node has a flag if it's free or not. I'm not sure if I'm doing it the right way, and especially confused about how to deal with alignment, and th...
I've been learning C++ for about a week now. My primary language is Python, so I thought I would find some code to translate to figure out how the pieces fit together. Please let me know any simplifications/best practices! There is an assignment on a unit of Udacity's "Artificial Intelligence for Robotics" where you ha...
I wrote a shell script to authenticate users connecting to an OpenVPN server. When a user attempts to connect, OpenVPN executes the script with the username and password variables sends. The script then sends an HTTP request to a web server that either returns a status code of 202 upon success and 401 on failure. I wou...
The program asks for a user to set the max number of the range. That number is used to set the max range of a randomly generated number. The program keeps track of the number of guesses. I have taken a couple classes recently on different programming languages. I wrote a Hi/Low program in C a while back and decided to ...
Is it a bad practice to use getters and setters this way? Below is my code: public struct Settings { public static int workMinutes { get { return Properties.Settings.Default.workMinutes; } set { Properties.Settings.Default.workMinutes = value; ...
I've written a program that runs through a matrix of numbers, ranging from 0 to 2, and stores the results in a 2D vector. I'm using the values in the 2D vector as the profile for a tile map for a game engine. I want this to be optimal, and as this is my first attempt at it, I doubt that it is but it does work as is. ...
Based on responses to my question posted here, I've built a full implementation of a Location object. Such an object can be used to build a map for a text-based adventure game. Feel free to review the code, leave some comments about the good and the bad of what you see. Things to notice Objects of this class can only b...
I have windows form application. One button event starts the script via object called ScriptStarter. The status of object is used to pass message and color to UI (toolStripStatusLabel1). I'm not sure if this is good practice. Could you please give me advice or suggestion how to better set up the communication between o...
I'm writing a class that acts as the base for almost all objects in my project. I know this class technically doesn't represent a tree structure, because it can have more than 2 children. What should I change? Should I be using smart pointers? I'm a self-taught C++ programmer, so I've got much more to learn. Here's the...
I want to learn C# and have started off with making simple Pong game. I would like to ask you whether the approach I took is correct, as in it is readable and fits the conventions/standards. Maybe some of the implementations I have made (more like for sure) are far from optimal or not complete, probably some things are...
I wrote this code to implement a data structure in C++. It works perfectly, however, I am looking to improve its efficiency. Also, I'm just getting started in C++ so using code to explain your suggestions would be incredibly helpful. Here is the class that implements the data structure: class key_value_sequences { publ...
This function returns true if the string contains zero or one periods, and returns false if the string contains more than one period. bool isStringValid(std::string str){ std::size_t pos = str.find('.', 0); if(pos != std::string::npos){ pos = str.find('.', pos + 1); if(pos != std::string::npos){...
I am a beginner Java programmer and I have just finished creating a simple 2 player TicTacToe game and would appreciate some feedback/advice on how to make it better. import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class TicTacToe implements ActionListener { publi...
I made this as a practice application to learn React. It is simply a box where someone can enter their name and a comment and submit it, and display other comments. This animated GIF illustrates what it looks like: Note: Please don't be too critical of the looks, I haven't spent a lot of time styling it with CSS. Als...
I'll need to build a syntax tree (AST) for Rubberduck, but since VBA has dozens of tokens and complex rules, I needed a simpler language to play with first, so I thought BrainFuck would be a perfect candidate. The result is completely overkill for BF, but the exercise was very educational. Lexer The lexer reads the co...
This is a binary-to-text encoder that is based on Base64, but it works by converting data into an almost pronounceable string (consonant-vowel-consonant-vowel for each 3 bytes). Any improvements, suggestions, etc. are welcome. bitspeak.hpp #ifndef BITSPEAK_HPP #define BITSPEAK_HPP /* Encoding: ******** ******** *...
I'm writing a service that receives a list of Latitude/Longitude objects, prepares them for transaction, and then calls a web service to write them to the organization's Mainframe. According to the existing application that I'm replacing, the Mainframe can only accept "chunks" of up to 5 Lat/Long values at a time, how...
Below is the program to find k-complementary pairs: K = A[i] + A[j];. package org.test; import java.util.HashMap; import java.util.Map; public class ComplementaryPairs { public int noOfComplementaryPairs(int arr[],int k){ int result = 0; for(int i=0;i<=arr.length;i++){ for(int j=i;j<a...
The boot loader that I'm designing is just simply going to setup (A) Stack, (B) Segment registers (C) Load remainder of track for specified device. Conventionally, this could have been up to 4 floppy and/or fixed disk devices, but now, it may be an FDC, but most likely USB or fixed disk. As my boot sector does have an ...
This is my very first attempt at Python and whilst the script works perfectly, I'd like to see if I'm missing anything obvious or doing anything particularly stupid. I think this runs on Python 2.7, but I'm not 100% sure. Goal: The goal here is to grab a task and its elements (records contain BLOB PDF data) and write ...
I need a constant (dictionary with values and default return value if there are no defined value for a key). Searching for any ways to simplify the code. Without a default value I can simply define a dictionary like this: REDUCE_VALUE = { "honda": 0.95, "suzuki": 0.85, "yamaha": 0.87 } But with a default v...
Okay so this is NOT my code, I just inherited it. Seems it has an obvious bug that it will only return the first email despite being called "GetEmails". My main concern is actually that it takes forever on some pages. The regex looks over complicated, but regex are something I have never really 'got into' hence posting...
I have the following situation: I have... Models like ServerRoom and ServerCabinet Repositories of the Model instances (in-memory collection) PersistenceServices which are interfacing the persistence-method I chose (mssql db) The problem I am facing is repetition. Basically, the implementation of a PersistenceService...
I wrote an answer to another question about the same subject and a new implementation, but instead of just posting my code there I think it's a good chance to see what can be improved on my own code. #include <algorithm> #include <array> #include <iostream> #include <iterator> #include <map> #include <tuple> #include <...
This is a music downloader and transcoder based on Youtube-Dl and VLC. It is written in Python 3. The PAFY Python module is required in addition to VLC. Currently, the cancel button is not functional and there is still a pop up command prompt, though this does not matter and should be disregarded. import urllib.request...
I run subprocesses with lot of output (compilation of Unity 3D projects). I use log parsers to find known issues. class LogParser(object): def __init__(self): self.report = [] def __call__(self, output: bytes): for decoded_line in output.decode().splitlines(): self.parse(line) ...
I'm trying to create a grid of settings for the user to edit. I'm using a PropertyGrid at the moment, but I'm open to alternative solutions. My two big issues are that I don't love the look of the property grid. It looks overly complex for the small number of properties that can be edited. Also, I dislike how verbose ...
I have written a simple prepared statement factory in Java and would like some feedback on how "secure" it is. By "secure" I mean that I can pass any old garbage in as a string and it should not allow any form of SQL injection or modification of the query in an undesirable way. Here is the code for the factory: /** * ...
I previously asked this question but have since improved my code: Substituting bookmarks in a Word document with data combined from an Excel sheet What happens in the code: Information about a list of suppliers needs to be consolidated into a Word document that maintains the same layout on all pages. To do this, a doc...
Here is a caching code of a nodejs / typescript app using lru Cache module from https://www.npmjs.com/package/lru-cache. For various reason i need to setup separate caches: one for homeCache another one for detailThreadCache... but this is just the beginning I may need to set up more. This code is working, but how woul...
I'm currently using Backbone to generate a carousel slider. In my View, I have an initialize function that looks like this: var SlideModel = Backbone.Model.extend({ defaults: { id: null, source_url: null, date: null, slug: null, link: null }, idAttribute: '_id' }); ...
My Python code is converting XML attributes in an ElementTree to appropriate values. How do I best convert a value in this dict to a float() if it exists, or else get None? Best I have now is: attr = etree_elem.attrib self.radius = float(attr['radius']) if 'radius' in attr else None ... if self.radius: # do stuff usi...
In a completely overkill BrainFuck lexer/parser I've presented the lexer, parser, interpreter and syntax tree classes. With this post I'd like to go over the lower-level Token and Span mechanics. Each token has a Type property that returns a TokenType enum value: namespace BrainFuck.Tokens { public enum TokenType ...
I have two tables, devices and device_properties. The devices table columns are as follows: id ip mac device_property_id created_at updated_at The device_properties table columns are as follows: id property_name cli_enabled created_at updated_at At the moment I have the following code to retrieve an array of devic...
First of all, the code: struct Bucket<H, V> where H: Ord { hash: H, values: Vec<V> } impl<H, V> Bucket<H, V> where H: Ord { fn new(hash: H) -> Bucket<H, V> { Bucket { hash: hash, values: vec![], } } } pub fn bucket_sort<T, F, H>(values: Vec<T>, hasher: F) -> Vec...
I needed an asynchronous parallel ForEach mechanism so I could enumerate an enumerable by N degrees of concurrency and process an action for each item. Searching around, my code was modeled/merged from a few posts I found. The tests I have been running are: Run body() to completion Inside the body(), do a Cancellati...
The purpose of this code is to change each column to a row, and assign keys to each value for the new array according to the old array. I would like to know if there're other ways to optimize it. <?php $arr = [ 'name' => ['a', 'b', 'c'], 'age' => [ 2 , 1 , 3 ] ]; $result = []; $keys = array_keys($arr); f...
A simple implementation of Naive Bayes, as I'm a Haskell beginner I've tried to put an emphasis on clarity and documentation. I've tried to incorporate the feedback from a similar question. This is the main module, the full code can be found here. Update: implemented hlint suggestions. module NB where import qualified ...
I have the following functions which help me to open a text file and remove any blank (empty) lines: def fileExists(file): try: f = open(file,'r') f.close() except FileNotFoundError: return False return True def isLineEmpty(line): return len(line.strip()) < 1 def removeEmptyLine...
My Implementation of a FIFO queue. I am mainly curious about my initialization of empty generic arrays. public class Queue<T> { T queue[]; public Queue() { queue = (T[])new Object[0]; } public T pop() { T queue2[] = (T[])new Object[queue.length-1]; T obj = queue[0];...
how can I optimalize this code? #include<bits/stdc++.h> using namespace std; class Graph { int V; list<int> *adj; void DFSUtil(int v, bool visited[]); public: Graph(int V); void addEdge(int v, int w); void DFS(int v); }; Graph::Graph(int V) { this->V = V; adj = new list<int>[V]; } voi...
I'm currently taking a JavaScript class. I'm fairly familiar with JavaScript and coding in general, so I decided to teach myself functional programming on the side. It's been great, my teacher's fine with it. However he doesn't really know much about functional programming, so it's difficult for him to critique my desi...
To be able to apply various colors to the console I created a ConosoleColorizer. It's really simple. It just takes an XML and renders it to the console with the colors specified. The element names are actually optional and can be any names. They are only required to parse the XML. What matters are the attribute and col...
I have a non-trivial list comprehension in Python. My goal is to take a whitespace-delimited list of strings from an XML attribute — which may not exist — and look up the corresponding constant in my module — which may not exist — and create a set of the results. What's the accepted way to format such a beast? They a...
The objective of the program is to check that the weight of the bag that the user inputs and then calculate how many coins are needed to the added/removed to ensure the bag has the right amount of coins in. It needs to display the difference in weight and the number of coins to be added/removed and a total value of coi...
I was writing some code that required the user to input a number, which was then stored in a variable. While testing the code I input a number larger than the variable type would allow and I got an variable overflow error. So I wrote this code to prevent that from happening. It works, but I was hoping there was a mor...
_____ _____ _____ _____ _____ _______ /\ / ____| / ____| |_ _| |_ _| /\ | __ \ |__ __| / \ | (___ | | | | | | / \ | |__) | | | / /\ \ \___ \ | | | | | | / /\ \ | _ / | | / ____ \ ____)...
I did a super simple version of Conway's Game of Life and would like a review. public class Conway { String [][] grid; int [][] neighbors; int [][] directions = {{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1},{-1,0},{-1,1}}; Conway (int gridSize) { this.neighbors = new int [grid...
I have the following solution for the Trip problem from Skiena's and Revilla's Programming Challenges (full problem description here). //#include "stdafx.h" #include <iostream> #include <string> //Always import <string> if piping std input to a string in .net #include<algorithm> #include<math.h> #include<fstream> usin...
I have simulated the conversation between a caller and receiver using fork and pipe. The parent process is the receiver and the child process is the caller. Each message is terminated by a newline. The program seems to be running correctly. Should I take care of any other condition? #include <stdio.h> #include <string....
An L-system is a rewriting system that can be used to generate fractals and space filling curves, because of its recursive nature. Some L-systems for mathematical curves can be found here. An example L-system: Axiom: $$FX+FX+$$ Production rules: $$X → X+YF$$ $$Y → FX-Y$$ Angle: $$\theta = 90$$ In this example, F means ...