instruction
stringlengths
71
95.1k
Assuming I have a method with this signature public void DoStuffWith<T>(T foo) and I want to allow both structs and classes to be passed as T, I was wondering about how to best do the null-checking in case T is a class. I came up with following two approaches: 1. Checking whether T is a struct or a class at runtime: ...
I have a SQL Server Database filled with Reports all having the same schema. What I've done is created a .NET application to automate the process of adding all reports to a new table. How can the code be modified to increase performance? Is there a better approach then using: conn.Close(); dr.Close(); conn.Open(); su...
I would like some feedback regarding my doubly linked list implementation in C++. I have been programming in C++ for about a year and a half and consider myself fairly proficient in the language. I know someone will say something about it, so I'm going to get it out of the way: Yes, I did use raw pointers for my implem...
I've wrote this code to evaluate a Machine Learning - the classification problem for digits recognition as in the figure below: For more details and to check the whole code, check the GitHub repository. Its important to notice that these numbers are in old Indian form, currently they are called Arabic numbers. This is...
As the title says, this batch script installs the XignCode Bypasser. Xigncode is a software bundled with games to analise running programs and prevent cheating. (Sometimes, it prevents the game to load at all on the newest Windows releases.) For this, a bypasser was created that disables this check, allowing players t...
Any improvements? Please review. It could be faster if I use own strstr function which searches from the end (less memory to move) but I wanted to use only the standard functions. char *removestr(char *str, const char *word) { char *ptr = str; size_t len = strlen(word); while((ptr = strstr(ptr, word))) ...
In my web application, there is a search input field, and when the user empties all of the text inside the input field, there is an API call made for a default-list of results, which are displayed in a dropdown right underneath the input field. I'm using the keyup event to try to capture when the user will have complet...
I don't know if you guys get tired of seeing a bunch of requests for review of similar projects, but I was really looking for advice. My website is designed on the MVC pattern. I have a very simple router that seems to be working just fine! If there is any upgrade I would add to it would be the ability to catch a third...
I've been getting into COBOL lately, and I find it a very peculiar and interesting language that can still hold up to this day. The reason I'm uploading this is mostly to get some feedback in code organisation and conventions, as well as in optimal uses for subroutines, since I had a hard time trying to reuse some of t...
def gcd(a,b): if (a>b): r1=a r2=b else: r1=b r2=a if(r1%r2==0): print (r2) else: gcd(r2, r1%r2) a= int(input("Enter a number")) b= int(input("Enter a number")) gcd(a,b) This code is about finding the greatest common divisor of two numbers. Are there a...
I need to implement a method that adds a "7-3-1" check digit to my id. The "7-3-1" method works as following: Weights 7, 3, 1 are assigned to the original number from right to left. So if the original number is 12345, then 5 will have weight 7, 4 will have weight 3, 3 will have weight 1, 2 will have weight 7, 1 will h...
My first Firefox add-on (WebExtensions compatible, so it works without modification in at least Chromium) puts a red border around insecure links, including plain HTTP links and links with a JavaScript event handler. The code is linted and appears to have good unit and acceptance test coverage. I'm mostly worried about...
I'm currently building up an object from dictionaries with lots of optional key/value pairs. To handle the different cases i check if i need to add anything like: if dict.get('someKey', None) is not None: obj.AddSomeKeyThingy(dict) This seems to work but i wonder: a) isn't the is not None redundant since the get r...
I'm trying to read any file locally and write out the binary as string, it loads and reads small files very fast. How can I modifier it to read large files greater than 1gb without crashing the browser or slowing down the system? <html> <head> <title> Read File </title> </head> <body> <input type="file" id="myFile"> ...
This program has the goal to teach the user words of another language. The user has to learn words of a current section and than they get tested. The program can be modified easy. The programmer just has to add the new name of the language and the corresponding translations in the Words class. I would like to know how ...
I have a Company Class, and separate normalized Address Class. I did this because the Address table will hold more than just Company Addresses, so I don't want "CompanyAddress", "EmployeeAddress", "MiscAddress" tables. The Address table will also hold historical addresses, which would only need to be seen on the Edit a...
I am trying to set up a time variable as a local storage property to be retrieved when I open my app in my browser. If I open it for the first time, today, I'll set it up to today at midnight. Otherwise, if the time property has already been set up today in a previous session, I'll provide the retrieved value to the s...
As you know, when dealing with SocketAsyncEventArgs, this is possible to receive partial messages and depending on the protocol used, you have to deal with it. In my case, this is real-time market data and every messages are separated with a \r\n pattern. In order to reduce memory allocation, I decided to build a handl...
I'm a bit new to working with Numba, but I got the gist of it. I wonder if there any more advanced tricks to make four nested for loops even faster that what I have now. In particular, I need to calculate the following integral: $$ G_B(\mathbf X, T) = \Lambda \int_\Omega G(\mathbf X, \mathbf X', T) W(\mathbf X', T) \ d...
I've written a library that uses generics and funcs to implement a feature toggle system without the need to use if statements. This was mostly to hone my skills, as I'm still new to this profession. I'd really appreciate any comments on how to improve the code. It can be found in this following git repo An extract of...
I'm learning to code PHP and gave myself a challenge: Filter array data by matching a specific element value for duplication. I went through it logically on paper then wrote code and it worked on the first try :) But I bet it is the most inefficient way, so to learn I would like to compare it against what others would ...
What I tried to do: In my main project folder I have directory downloadable_app with these files/folders inside: index.html js/app.f54b97d7097bcf4226c0.js I need to allow users to download this downloadable_app folder as zip archive In app.f54b97d7097bcf4226c0.js file I have axios.defaults.headers.common['Authoriza...
There is an object which has few properties. I wrote a function for test cases which check if the properties are satisfied or not. The function should throw an exception if the property is not satisfied. But, I think there are better ways to write those test cases. A subset of the property of the object is as follows: ...
I do not have much experience with VBA, and therefore need the help of this community for the following issue encountered. I used Application.Volatile in my code to run a series of calculation which slowed it down considerably. Without Application.Volatile the code is fast enough for my purposes, but does not calculate...
I am doing a bottom mobile navigation for the first time. Using a lot of fixed positioning. Is there a way to get the child elements inside the fixed positioned parent element to be formated with out top, left, etc like I am currently doing. Go past the reset css, usually in another file and not important for the quest...
Edit: A follow up post can be found here. So I've started a c++ project, coming from Java / C# there are many obvious differences. Below is an example of a class I've been working on: .h #pragma once #include <vector> #include <GL/glew.h> #include <glm/glm.hpp> class GLDebug { private: struct Line { glm...
binaryToDecimal = lambda binary: sum([[int(2**index) for index in range(len(binary))][-index-1] for index, char in enumerate(binary) if int(char)]) I wrote a simple function that converts binary strings into decimal integers. How can this be improved/simplified? I know about the int function, I wanted to implement the...
The following code compares two dates and checks if they are within 15 minutes of each other, with a tolerance of a second. All of the test cases below pass with the existing solution. The question is can it be improved by making it more efficient and/or elegant given the following test cases. TestId, whenCreated, when...
I'm making a website for a friend (just for fun) where we have to move a lot of svg images in absolute positions. To make it easier I wrote some code to calculate the % position of each element so we can do it faster. I'm wondering what you think about it and what can I do to improve it. And also any improvements to my...
Problem Statement Originally, the problem is defined in the book as following: Describe how you could use a single array to implement three stacks. — Cracking the Coding Interview (6th edition) After some consideration I decided to reshape it. Here is the generalized, yet more specific definition: Implement a data s...
This is a small program written for a small assignment to check spelling. The assignment asks for the following output: A list of words that are misspelled in the file A count of the whitespace delimited words contained in the file For all words that appear in the file, a count of the number of times they appear. Th...
As part of a C++ library, I'm implementing a filter class for approximate set membership and abundance queries. The filter has two primary operations: add to store an element, and get to query the element's presence or abundance. Under the hood, my filter class contains a fixed array of counters/buckets with d rows and...
Objective: Create a heap sort that returns a unsorted list to sorted from greatest to least. Does this implementation look correct? Do you have any tips for optimizing this? '''HeapSort. Best: n log(n) Average: n log(n) Worst: n log(n) ''' #Calls heapify and returns sorted list from greatest to least. def heapSort...
I am looking for ways to improve my password generation code written in C. This is in the same vein as my code in C++ and Python with many improvements. I am using getopt.h for command line parsing and libsodium.h for cryptographically secure number generation. I have written it in the GNU style (although not strictly)...
I was trying to learn how to use libraries like Opaleye and Servant. I wrote this toy Create/Read/Update/Delete App. {-# OPTIONS_GHC -Wall #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}...
I have this code... & .light-green { background: linear-gradient(135deg, #128465 0%, #99ca3c 100%); height: 100%; & .card__header { background: #128465; &::before { content: ""; display: inline-block; width: 0; position: absolute; ...
I am learning from Bjarne Stroustrup's book for beginners and I on Chapter 6 Exercise 4 as seen below. I am studying it alone and I need some reviews. Are my comments any good? Can you recommend me some improvements regarding comments or overusing functions? The writer of the book has some solutions for his exercise a...
This is a simple question, but during my migration to TypeScript, I'm seeing that in many cases my code could take these two directions... which one could be a better direction to go with: class.ts or interface.ts? class.ts export class ActionSet { constructor(private name: string) {} get ACTION(): string { ...
I get list JSON text from a webservice and list_of_columns is predefined, I need the output in that format. I am not sure about few things which are as follows I don't need "\n" towards the very end and this code seems sub-optimal to me but right now I can't think of any pythonic way to do it. My order for the code sh...
I recently started learning Haskell and had to program a 4 Bit Ripple Carry Adder that worked with tuples of the form type Nibble = (Bool, Bool, Bool, Bool) Beforehand I wrote the functions -- XOR operator xor :: Bool -> Bool -> Bool xor a b = (not (a && b) ) && (a || b) -- Fulladder for 1-Bit binary numbers -- R...
I made a code for a health system for the game I'm creating. I made it myself and I wanted some criticism on how to make it better. Thanks for viewing. ## Health system import time SH = 100 PA = True while PA == (True): DMG = input("How much damage would you like to take?" ) Output = int(SH) - int(DMG) if Output...
I am still attempting to learn how to best handle arrays and iterate their values transforming them into the correct formats that are needed for my database/API. So I have this array: $arr = [ 0 => [ 'field' => [ 0 => [ '@name' => 'first_name', '@value' => 'Jack' ...
So I had posted C++ OpenGL Debug Utility before to get some feedback on it, this is a more complete version of the class. (Again, looking for feedback/critiquing of any sort. {As I'm in the early stages of learning C++ and don't want to pick up any bad practices / poor coding styles.}) #pragma once #include <vector> ...
I have a sequence of methods which should only be called if the previous returned successfully. If a method is successful it returns true, otherwise it returns false. Please tell me what you think of this approach, and if there is a standard/better way to accomplish the same thing. public class EventParser { privat...
This is a maximum sum contiguous problem from interviewbit.com Problem : Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example: Given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. This is my solution : def ...
class EmptyStackError(Exception): def __init__(self): super().__init__('Stack is empty. Invalid operation') class FullStackError(Exception): def __init__(self): super().__init__('Stack is full. Cannot push') class Stack: """ Stack with a specified size """ def __init__(self, size): ...
I'm looking for an honest review of what I've got thus far. I'm still trying to get my head wrapped around software development and have picked Java as my starting language. That said, I figured that I would attempt to create a reusable module for which I'd use this as an external library. I think it would be invaluabl...
This is an exercise in thread pooling in which I attempt (hopefully in a successful manner) to reuse existing threads (much like Java's own ExecutorService.newCachedThreadPool). Essentially, my goal is: if all threads so far are busy doing their tasks, create a new thread in their place. MyCustomThreadPool.java package...
The following program is written in python. Is there a more efficient way to write this program? Suggestions and criticism are welcome. You can also comment about my variable naming practices and code readability. # int ----> list # returns factor list of a num def factor(num): factors = [] for i in range(num)...
My code uses a canvas element to create a live snake game on a plane! <!DOCTYPE html> <html id="game"> <head> <title>Snake!</title> </head> <body> <canvas id="canvas" width="400" height="400"></canvas> <script src="https://code.jquery.com/jquery-2.1.0.min.js"></script> ...
I wrote code that replaces integers from 0 to 3 with strings. I was only allowed to use getchar() and putchar(). If the input is 1, the output will become "one". #include <stdio.h> int main() { int c; char* arr[4] = {"zero", "one", "two","three"}; int i; while ((c = getchar ()) != EOF) { ...
The following is my attempt at writing a linked list that attempts to emulate the behavior of std::list. Any feedback would be appreciated. #pragma once #include <algorithm> #include <cstddef> #include <initializer_list> #include <iterator> #include <stdexcept> #include <utility> //a list is composed of links that co...
As a learning exercise, I decided to implement an automatic solver for the Sacred Geometry feat from Pathfinder (a TTRPG). The requirements to use the feat are: Roll N six-sided dice, where 1 < N < 21 Pick a set of target numbers, depending on the desired effect. For example, [59, 61, 67]. Using addition, sub...
I am working on a program that is meant to fold a large input line into smaller ones. Basic flow of the program would be as follows: User calls the program with a long string as input Program prints tokens generated in separate lines I haven't seen handling file input yet, so keep that in mind. I haven't seen reading...
I am trying to efficiently use the SEDE tool to get a list of tags a user has answered questions on, and their stats on each Tag. My code works for my account in 3185 ms, but if I try to run it on @jon-skeet's, user ID (22656) then it times out. Are there ways to make this more efficient / better code, and allow it to ...
I'm hoping someone would be able to identify if my code is prone to SQL injections, and just overall see if there is anything that could be done better. This is also my first time using MySQLi prepared statements in a login script. <?php include('../include/sessions.php'); if(isset($_POST['username'])) { $username =...
I started using Retrofit and RxJava recently and I love it. I am working on an Android project and I am following MVP Repository pattern as specified in Android Architecture Components. I'm still learning though. Whenever I have to make an API call, I do it like this in the Presenter: fruitsRepository .getFeaturedFru...
Assume s is a string of lower case characters. Write a program that prints the longest substring of s in which the letters occur in alphabetical order. For example, if s = 'azcbobobegghakl', then your program should print Longest substring in alphabetical order is: beggh In the case of ties, print the first substrin...
The following code works, but the filter operation is bottlenecking my analysis. Do you have an idea how I can make the filter operation faster? Do you have other comments about the codestyle? import sys import pandas as pd import numpy as np from numpy.random import randint, rand, choice, permutation ID = [value for ...
So background context: I wrote this script for a personal project that holds a large amount of items, I already display and am able to filter the results based on its country/location. I am a student PHP coder and would like constructive criticism on my thought process/code. Thought Process: I decided to code my countr...
I have this middleware to log the number of queries, the time spent on each view and some errors and tracebacks. This will be called on each request, so I had to put a 75ms timeout. I don't like it, but I feel like using async request for this is unnecessary, I don't care about the host response. What do you think? Can...
I wrote a program to calculate the value of Definite Integral of a function from a to b. It used the trapezoidal approximation method where the function area is divided into 'n' trapeziums and area of each is added. def calculate_area(f, a, b, n): # Trapezoidal approximation: divide area of function into n trapeziu...
This code is something that I have used for about 3-4 simple embedded systems projects. The idea is something like this: This is non-OS based implementation, everything is done in an outer infinite loop. No dynamic memory involved or advised. It's an interrupt-driven system, polling for peripherals is not used anywher...
Task: Create the Fizz Buzz game using Test Driven Developoment. Print the correct word for range 1-100. The implementation: public class Main { static final String FIZZ = "Fizz"; static final String BUZZ = "Buzz"; static final String FIZZ_BUZZ = "Fizz Buzz"; public static void main(String[] args) { ...
It's been nearly a year I've been using C++, and I have just implemented this queue. I've tested it in many different scenarios, and it seems to work completely fine. Would you mind telling me what can be improved? What techniques might and might not be used in a professional scenario? In general, could you please giv...
I'm just starting to learn using both dependent types and proof assistants, and as an exercise I'm trying to write a provably correct merge sort. As a first step, I'm writing a function that merges two non-decreasing lists (this is easy) along with a proof that it produces a non-decreasing list (this is the hard part I...
I'm trying to remove the first $offset elements from an array and reduce the offset for future adds to the array. The loop must also end if I reach the end of the array. $max1 = $offset; $max2 = count($elements); for ($i=0; ($i<$max1 && $i<$max2); $i++) { unset($elements[$i]); $offset--; } I'm trying to find a...
i have made a simple sudoku solver which is a puzzle game where the player has to figure out the empty cell and checks which numbers are absent from the corresponding row, column. how can I improve it further? #include <iostream> int isAvailable(int puzzle[][9], int row, int col, int num) { for (int i = 0; i<9; ++...
Snake on a plane 2.0 This is the first iteration of an iterative review. The next iteration is found here: 3D 1st Person Snake Game #2 When I figure out how to add wings, this snake is going to have hyper-wings. (Note: I am not asking for help with these being implemented) My code creates a 3d version of the snake game...
Fill in the ? with a Javascript expression to set the scale ratio for an image having a given height and width so that it fit inside a maxdim-by-maxdim square area (touching at least two edges). function scaleImage(width, height, maxdim) { var scale = ?; return [scale * width, scale * height]; } Here is my s...
I have to validate Tags with Rules for AWS resource. Input contains list of dictionaries. [{"keyName": "KeyValue", "valueName": "ValueValue"}, {"keyName": "KeyValue", "valueName": "ValueValue"}, {"keyName": "KeyValue", "valueName": "ValueValue"}, ...] There are following rules for validation: Tag key must be non empty...
I am solving questions on arrays from here. Problem: You are given an array of N integers, A1, A2 ,…, AN. Return maximum value of: f(i, j) for all 1 ≤ i, j ≤ N. f(i, j) is defined as |A[i] - A[j]| + |i - j|, where |x| denotes absolute value of x. Solution approach: |A[i] - A[j]| + |i - j| gives us 4 cases: Case1:|A[...
I am trying to solve a programming problem and I see the size of program has increased a bit while I keep coding. I found this problem here. Here is the problem: Write a program that outputs all possibilities to put + or - or nothing between the numbers 1, 2, ..., 9 (in this order) such that the result is always 1...
I want to rewrite blockchain source code from Golang to C++11. Please, review my code and help me to improve it. Source in Golang: package main import "time" type Block struct { Timestamp int64 Data []byte PrevBlockHash []byte Hash []byte Nonce int } func NewBlock(data string...
You have been given two strings, A and B (of length N each) and Q queries. The strings contain only 0s and/or 1s. For every query, you are given an index i. You have to update the value at index i to 1 in string B and check if B is lexicographically equal to or larger than A or not. If yes, then print "YES" and ...
I have made some code which will validate user input for getting 4 control points for a bezier curve. It works fine however I was just wondering If I could make this code any more compact or efficient? p = [] #empty points array #gets 4 control points from user input def get_points(): #loops through 4 times to get...
Kotlin defines extension functions like also but they are not null checked. That's fine because you might not need the check. In case you do though, do you see any issue with the solution below? inline fun <T> T?.ifNotNull(block: (T) -> Unit): T? { return this?.also { block(it) } } inline fun <T> T?.ot...
I have created template class to easily get the current number of instances a class has. It's threadsafe and I tried to make it as hard as possible to abuse. #include <atomic> #include <cstdint> #include <type_traits> template<typename t_derived> struct countable { friend t_derived; struct counter { ...
Problem: Given an even number (greater than 2), return two prime numbers whose sum will be equal to given number. NOTE 1: A solution will always exist. (Goldbach's conjecture) Note 2: If there are more than one solutions possible, return the lexicographically smaller solution. This solution becomes slower for hi...
I am currently learning PHP and decided to write a login and registration system to learn about error handling, mysql, password hashing and basic queries. I know there's standard authentication systems with frameworks such as Laravel, but I wanted to write one myself just for learning purposes. I'd like to get some fee...
PRAMP Award Budget Cuts The awards committee of your alma mater (i.e. your college/university) asked for your assistance with a budget allocation problem they’re facing. Originally, the committee planned to give N research grants this year. However, due to spending cutbacks, the budget was reduced to newBudget dollars...
I was trying to implement FizzBuzz without modulus operator. Areas of concern: inner for loop maybe not needed? seq[] array maybe not needed? class FizzBuzzWithoutModulus{ public static void main(String[] args){ int[] fizzbuzz = new int[101]; int[] buzz = new int[101]; int[] fizz = new int[101]; i...
Recently I came across a coding problem where I have to find the least positive value which is not possible to make using the coins present in the coin denomination array(array values can be used only once). suppose that if the input is 3 5 7, the answer is 1 if the input is 1 2 4, the answer is 8 if the input is 1 3 4...
I am using Vue.js to play mp3 sounds on keyboard clicks. Even though each mp3 is less than 40 KB, there is a 95ms delay on heroku, on each request. Is there a way to download sounds when dom is ready and not when clicking the buttons? let a = 'sound1.mp3', b = 'sound2.mp3'; new Vue({ created() { ...
I've had a go at creating a small class in C# that can generated salted hashes from text. I would like to know how this could be improved (in terms of code style) and whether or not this code is secure enough that it could be used in a professional environment (it won't be). Hasher.cs using System.Security.Cryptography...
The purpose of this project is to generate an interactive Mandelbrot Set with smooth coloring. The user can interact with the W, A, S, D keys to move around and with + and - to zoom in and out. It divides the height of the window into multiple sections and uses threads to paint each section. It also paints on a Buffere...
This module has a ensure_downloaded function which takes a slice of Urls. It downloads all of the urls to a local downloads folder (if they aren't already downloaded) and returns. use curl::easy::Easy; use failure::Error; use pbr::{ProgressBar, Units}; use std::fs::{rename, DirBuilder, File}; use std::io::Write; use st...
Illustration You're testing a new driverless car that is located at the Southwest (bottom-left) corner of an n×n grid. The car is supposed to get to the opposite, Northeast (top-right), corner of the grid. Given n, the size of the grid’s axes, write a function numOfPathsToDest that returns the number of the po...
This is from a Java course which I'm taking. The class StudentUtil, including method-declarations and comments, was provided by the instructor. I just had to finish the bodies of the two methods. calculateGPA() computes the average performance of students. Every A-grade gives 4 points, every B-grade 3 and every C-grade...
I am using Node.js. I have two different classes. The first one is called Controller, the second is called ServerCommunicator. Controller calls a method in SC (sendDataToDolibarrAsync), which takes a JSON array as indata and loops through it, and POSTs it to Dolibarr (Dolibarr is an ERP CRM. In my case it is mostly use...
I'm follow this article about "common opponent in tennis", my goal is to script it in the most efficient way. Below you can find my code but is so slow. To calculate the result of 1 match my laptop spent 120seconds more or less, and I have a dataset of 150k of rows to calculate. The article: (PDF) I need your help to c...
I wish to improve a class design that causes me readability and performance problems as the code grows. public class ProductCategory { public string Name { get; } public string SalesAmountInUSD { get; } public IEnumerable<CurrencyWeight> weightOfEachCurrenciesForProductCategory { get; } } public class Cur...
I'm trying to code a machine learning version of pong in python. So far, all I have is the game without any AI. I personally have very little experience with Python and coding in general, so any feedback would really help! If possible, I'd like to know what the common best practices are when working on a project like t...
The Karatsuba algorithm, first published in 1962, aims to speed up the multiplication of big numbers by reducing the number of 'single-digit-multiplications' involved. Because of its complexity (overhead) this method is not particularly fast on the 'smaller' numbers. There's a threshold to be observed. Computing MAX_UI...
I have couple of MessageProcessors. One of the Processor will log the payload. Other Processor will save into an embedded database. Here is the code I have written so far: I am using annotation-driven configuration so I have omitted other classes which are not used in this use case. @Component public class ProcessorCon...
I've been working on a two player snake game in python. I would really appreciate any suggestions/general input that would help improve my coding. """ 5-13-2018 Nathan van 't Hof 2 player snake game players can move around using wasd (player 1) and ijkl (player 2) eating apples: - will increase players length """ impo...
I am currently reading through an algorithm book and trying to implement everything as I go. I am also learning python at the same time. This is my implementation of a simple linked-list. I am mainly concerned with whether the code looks "looks python like" any tips on how I can refactor would be greatly appreciated. c...
Looking to see if there is a simpler way to achieve this. I would love if I could keep the return as a one-line LINQ expression. I want to grab the total number of hints used, which can be more than one. public int hintsUsed { get { int i = 0; questions.ForEach(q => i += q.hintsUsed); r...
I wrote a simple breakout game in javascript. I was wondering if anyone could give me some advice on improving my code. I wrote somethings a bit oddly so I am more then welcome to criticism (constructive would be preferred however.) let canvas = document.getElementById("mainCanv"); let ctx = canvas.getContext("2d")...
Continuing with my web-based checkers game, this question is about the actual playing system. I'll ask for a review on my UI system in the next post. First, my BoardController.cs. Note that I have references to a ComponentGenerator class here and in other files. I consider this part of the UI, and will post it later. I...