instruction
stringlengths
71
71.9k
I have made a game in Java that involves two players to fight each other with spaceships. For one player mode, I have programmed a simple AI to avoid allies and asteroids and go straight towards the player. Unfortunately, the game lags quite a bit when there are 3 AIs at once. I think this is because of all the for loo...
I've written a very short program that is intended to run the program specified in its arguments (argv) as the user named "restrict" (which exists). I want to make sure that there are no subtle bugs in the program, and that the program is as simple as possible. Is this program doing what I intend? Can someone use this...
People say that the code in my implementation is generally obscure. Can you point me what looks bad? import time import string from queue import Queue from channel import Channel from client import Client __author__ = 'mark' import socket import connection from threading import Thread SPECIAL = "[]\`_^{|}" ALLOWED_...
I need to find the common elements present in all the given arrays. All the arrays are present in another array. I have come up with this solution and it's working. I tried to remove the usage of indexOf, but I could not. Could someone help me optimize this? var findCommonElements= function(arrs) { var resArr = [];...
I recently started to learn Python for the purpose of making my life as a network engineer easier when performing repetitive tasks. The script below does parse a huge inventory.xml file I get from a reporting tool to find the ID of ports I want it to and then writes back to the XML file a structure representing a cable...
I'm hoping for someone to help me use the best practices and further make my code better that I used to accomplish the DailyProgrammer Challenge "Balancing Words". The challenge is to check if a word will "balance" and if it will, where it balances. For a word to balance at a letter, all of the weight to the left and t...
I keep looking at this trying to figure if there's a better way. All three functions work, but I wanted to get some insights and ideas from others. IsLoadDay determines if the date parameter is a "Load Day". Load Days are Tuesday through Saturday, but we skip holidays and designated No Load Days. There are two exist...
I have this code currently written to help me create a menu. I was just wondering if there is a way to tidy this so that there is less code needed to achieve the same thing. The code is designed to create large dropdowns which have divs inside which will contain most of the content. I want to hide parts of the menu so ...
I've recently finished implementing a ring queue based on std::array in C++11. I tried to write the code as if I were going to submit it to the C++ Standard committee to have a RingQueue as part of the standard while keeping the implementation as simple and fast as possible. Please let me know if there are any changes ...
I have a script for a countdown function, which is using massive amounts of CPU power on my MBP. The script updates the countdown display every second and is updating all piecharts as well. var options = { scaleColor: false, trackColor: 'rgba(255,255,255,0.3)', barColor: '#E7F7F5', l...
See Set-uid root program that runs a program as the user "restrict" for context. I've written a very short program that is intended to run the program specified in its arguments (argv) as the user named "restrict" (which exists). I want to make sure that there are no subtle bugs in the program, and that the program is ...
A word is balanced at the index if the sum of the alphabet positions of all the chars multiplied by the distance to the index is zero. This description is equivalent to the one given by DailyProgrammer in the challenge info. I did not code Input/Output as I found them not as interesting as the logic. The code works f...
I'm writing a plugin and want it to have no dependencies. I create a form and append it to the page, but the code is really long. Does anyone have any suggestions to clean it up, perhaps shortening it? I feel like there must be a better way! // Create elements var elements = [ reporter_wrapper = ...
After a bit of work, I've changed my code a lot from the previous question: I was recommended by George Mauer and schism to make a better structural design, so hopefully this new build is a bit sleeker in design. I will note that my main target is optimal performance. But like Mr. Mauer said, it is most likely negligi...
I stumbled upon this exercise , and I am wondering if there is a more efficient way of writing this. It is written from high school level knowledge. Find the most occuring number of an array of numbers, with each number only counting one per number. For example in 2222 the 2 only counts ONCE. If you have 2 or more dig...
Unfortunately there is no URL where you can see the code working. I hope you all can figure out what the code does simply by looking at it. GitHub var FilteredNav = { wrapper: $(".dept-filters") , init: function() { FilteredNav.changeUrl(); FilteredNav.createUrl(); } , createUrl:...
For fun, I have been making a very basic login system in Python. I was going to look up an algorithm or something for user info storage and transfer, but then decided it would be more fun to come up with and implement it myself. What I would like to know is: Is there anyway to make it secure (i.e.-encrypting the passw...
Below is my attempt at providing a type-safe way to combine enumeration and bitset together. The resulting class is intended to be use as a set of flags, where each flag is a member of the "user-defined enumeration". The user must not define any explicit value to the enumeration member. Below is the "library file" (1 h...
For practice and to explore my vanilla JavaScript (no-library) weaknesses, yesterday I made a Todo app, similar to what you see floating around for AngularJS blog demos. How can I optimize this? // VanillaJS Todo App with full CRUD (function crudApp() { "use strict"; // Look ma... no library! var itemData = {}; ...
I'm using Linq-to-Entities for querying, and MVC.NET and C# for coding. I'm trying to generate monthly donor registry report which needs donor count, donors who signed through web,donors who registered in current month and all this is to be display per county. private MonthlySummaryViewModel BuildMonthlySummaryViewMode...
I have here a snippet of code from a simple video game AI enemy. The basic idea behind the enemy is that he can be in one of a few states. By default he is in a patrolling state, where he moves around at a slow speed to random points within a circle. While in this state, he is rolling every X seconds to switch to on...
I'm writing my own framework (purely for learning purposes, SPL, OOP, patterns, etc) and have written a class to manage config data throughout the framework (not front end/view, just the core framework). Example of config data: The framework requires a specific PHP version to run correctly, and that "required PHP ver...
I've just edited my .htaccess file. All works as it should, but I'm not too familiar with regular expressions and want to make sure that there aren't any unintended consequences. I want to: Add www to the domain if it's not there (i.e. domain.com becomes www.domain.com) redirect from secondary.primary.com to www.seco...
I have one input that is needed in many forms, so I created a partial view for that. In the partial view I query the database and generate a drop down list. I just want to make sure, this is the best way to achieve this. The partial view looks like this: @model long? @{ var data = Utility.GetData(); } @Html.Drop...
I'm new to JavaScript and new to jQuery plugin development. My plugin is really easy I just want to taggify a <ul> (function($) { var allTags; $.fn.taggify = function(options) { allTags = this; _create(allTags); return this; }; function _create(...
Here I am again; referring to my previous code review request about a self-updating, asynchronous (?) cache. The previous class takes care of caching operations like "get all users registered in our basecamp company", and updates the list through a getter function, periodically through a TimeSpan parameter supplied at ...
I have already flunked the test with this code so don't feel bad for cheating any employer. I didn't get any feedback though just wondering what could have gone wrong. You don't need to get into the functionality, just the overall design. What are short-coming of this code which disqualifies it from being production qu...
This is a follow-up to yesterday's codereview-question about reading serial data and parsing it. The code below is run into a seperate thread looped endlessly. Currently I track the position in my inputBufer manually and copy all bytes which haven't been processed into a new byte-array and assigning that to the old in...
See the next iteration. I have this iterative mergesort (a.k.a. bottom-up mergesort). BottomUpMergesort.java: package net.coderodde.util.sorting; import java.util.Arrays; import java.util.Comparator; /** * This class provides static methods for sorting object arrays using * bottom-up merge sort. The algorithm used...
My aim is to write a blocking char driver that return to the user space a complete protocol message from the kernel uart driver. Protocol description I'm fighting with a very bad protocol, called DMX. Protocol packet is very simple: start with a break on serial line first char has to be 0x00 follows 512 bytes No CRC ...
I have the following method that will return VariantID for given VariantName ("Name" in db). To avoid calling my db few thousand times I have dumped all records (~30) to the simple dictionary. I'm almost certain that this is the correct way of implementing this method but I would like to hear some feedback and any poss...
Based on input from the UI (most likely a string) I would like to search a list of object and return all object that has one or more matching property values which match the given input. Do you have any thoughts regarding performance or overall design? The only requirement is that I need to keep the outer Array.prototy...
I have some legacy classes written without thread safety in mind. Instances of these classes are now being accessed in a multithreaded context in a thread-un-safe manner. Cue chaos. To fix this I make a wrapper class that enforces the user to take a transaction lock to serialize access to the instance. #include <memor...
Problem Question taken from here. I want to go up a flight of stairs that has n steps. I can either take 1 or 2 steps each time. How many different ways can I go up this flight of stairs? Write a function count_stair_ways that solves this problem for me. def count_stair_ways(n): Solution: def count_stair_ways(n): ...
What I'm trying to achieve here is sort queue of .item-dragable between different lists. Users can click on right and left arrows and items move in queue respectively, where the previous or next item gets placed in place of item that was moved. There is also a placeholder element that should not be counted as a valid s...
I am a little confused over which layers my filters should be contained in with an n-layer web application. I've got 4 layers: Presentation layer Application layer Business layer Infrastructure layer The Presentation layer can only talk to the Application layer and the Infrastructure layer. The Application layer can ...
Problem: Pascal’s triangle is a useful recursive definition that tells us the coefficients in the expansion of the polynomial (x + a)^n. Each element in the triangle has a coordinate, given by the row it is on and its position in the row (which you could call its column). Every number in Pascal’s triangle is defined a...
Continuation of this question: I have tried to refactor code according to PEP 8. I tried to raise some errors instead of just print and sys.exit, as was suggested. (should I define much more exceptions for every function and so, or are general ones enough?) Code is not complete, there are a few issues I need to look in...
I am working on to find the kth smallest element in min heap. I have code for this whose complexity is \$O(k \log k)\$. I tried to improve it to \$O(k)\$. struct heap{ int *array; int count; int capacity; } intkthsmallestelement(struct heap *h,int i,int k){ if(i<0||i>=h->count) return IN...
I have been working the some project and I'm struggling to find the answer. Right now I'm coding with Angular and there some code that makes me write twice. There only two arrays now but if I have lots of arrays the code will be really big. The thing makes me stop always that I have to write the IDs one by one and I co...
I am trying to plot a 3Dplot of a linear regression with two variables. My linear model: ls = lm(mpg ~ disp + qsec, data = mtcars) The minimum and maximum values to predict: mmd = min(mtcars$disp):max(mtcars$disp) mmq = min(mtcars$qsec):max(mtcars$qsec) The linear function: flm = function(x1, x2) ( (ls$coefficients[1...
I'm fairly proficient in C and Python, but want to learn some skills for administrating my new Linux machine. I wrote this simple address book app to teach myself shell scripting. This is the first script I've written longer than a couple of lines. The address book is a plain text file stored in $HOME/.sab-db. Entries ...
Problem: Pascal’s triangle is a useful recursive definition that tells us the coefficients in the expansion of the polynomial (x + a)^n. Each element in the triangle has a coordinate, given by the row it is on and its position in the row (which you could call its column). Every number in Pascal’s triangle is d...
I am working on a project, and at the moment I have just finished the majority of the Bayes Rating/Classifier. I have two sets of methods I am most concerned about. Method set 1, will select a certain number of extraneous elements (which have probabilities furthest from 0.5), and only take those into account for classi...
This code is to find expiring/expired documents. It was included in one of the models, say Document. Is this good approach of using constant variables which holds the some data and used within this mixin only? Is there any better approach I could use instead the constants? require 'active_support/concern' module Expi...
Java program uses the following construction: (provided mainly for context) public class Utils { public static final byte PROVIDER_FOO = 0; public static final byte PROVIDER_MOO = 1; public static final byte PROVIDER_BAR = 2; public static final byte PROVIDER_FUR = 3; public static final byte PROVIDER_BOO = 4...
I have a collection of strings as follows: 44.01 44.02 44.03 44.04 44.12 46.05 46 ... and so on. I want to remove leading zeros from the component of the string after the full stop. As you can see from above, not all strings have a sub-component and not all sub-components will have leading zeros. Is there...
Having already attempted an implementation of the std::vector class here, I decided to take the comments on board and also do some new bits myself (mainly the algorithms for allocation and insert). I have a commented version, but it exceeded the character limit so I had to add the non-commented version. However, I can ...
I am building an application messaging system. I am planning on using channels for real-time notifications but I was wondering if this schema makes sense. I am looking for any constructive criticism and problems that might arise. message.ex defmodule Trophus.Message do use Trophus.Web, :model schema "messages" do ...
I have such input: [ { name: 'timezone', value: 'EST' }, { name: 'interval', value: 'day' }, { name: 'metrics[]', value: 1}, { name: 'metrics[]', value: 2} ] As you may already notice - these are parameters from POST request. What I need to do is to get such output: [ { name: 'timezone', value: 'EST' }, { name...
I've just started teaching myself Scala to get my feet wet with functional programming, and I'm messing with around with some classical cryptography. The following code produces monoalphabetic simple substitution encryption, but I'm still trying to wrap my head around both Scala itself and functional style, so I'm sure...
I am new to ASP.NET (C#) and MVC 5. I'm really enjoying it so far, but want to take a step back and make sure that I'm following best practices here. My controller seems like it may be getting too fat, but perhaps that's just part of it? This is the Index action for the TicketsController in a support ticket application...
Below you can see my binary search method, and as a relatively new programmer I am looking for any suggestions on how it could be improved. bool found = false; int min = 0; int max = 9; int avg; int anArray[] = {1,2,3,4,5,6,7,8,9,10}; int userNumber; printf("Enter a number between 1 and 10:\n"); scanf("%d", &userNumb...
This is my first time putting up a completed program onto the web and I was hoping to get some feedback on these areas: Commenting (Too much, not enough or do I need to simplify anything) Structure (I guess does it seem reasonably tidy, presentable and laid out well) Naming (Are my variables well named, are sensible?)...
The problem is to find the minimum number of moves that a knight will take to go from one square to another on a 'n' cross 'n' chessboard. The code below is based on backtracking. It works well until n equals 5 but from n equals 6 the time limit is exceeded on ideone. How can I make the code more efficient? #includ...
As I started to learn about regular expressions, and as part of bigger project, I wrote a regex analyzer, which: takes the PROPER regular expression, takes the String already MATCHED by this regex, visualize with (random) colors which parts of given regex are responsible for matching a particular fragment of given str...
I have a clear function that accepts an array, string, or no arguments. If no arguments, it should clear the entire data object. It works fine, but looking for a code review. The possibilities should be: clear('one'); clear(); //clear all clear(['one', 'three']); var data = { one: 'test1', two: 'test2', three:...
I put together this simple query which calculates the total percentage of answered questions and unanswered questions. The formulas used to calculate these are shown below: $$ \text{Answered Percentage} = 100 - \left(\frac{\text{Unanswered}}{\text{Answered}} \times 100\right) \\ \text{Unanswered Percentage} = \frac{\te...
I made a do...while loop in order to wait for the web browser to load completely in order to enter username and password. I don't know whether this impacts the system a lot because I repeated it in at least 4 places. Is there a better solution? private async void DeleteProduct() { if (string.IsNullOrEmpty(TextBoxF...
I am a Java programmer who recently started learning some Swift. I made an app that displays the Sierpinski triangle and adds triangles if the user pans up, and zooms in and out using the pinch gesture. I am wondering what I can do to make my code more Swift-y and how I can improve the zooming. SierpinskiViewController...
I wanted to create a save game system for my city building game that did not require the player to input a name for the city. It was also important to allow infinite save games, so I could not just use save slots to solve the problem. With a bit of help, I devised a system that would allow the player to optionally ente...
Is it appropriate for the class to subscribe to its own events like this? Should the class not subscribe, and instead move that code to before the OnEventName(Object args) methods call the EventHandlers? I'm curious if there are any downfalls to this approach. On one hand, with this approach I could remove all the null...
I want to replace rm by a more informative variant: I would like to see which files will be deleted, along with their size, and I would like this information to use the same coloring as ls. As an example (please imagine the coloring): # remove -r foo/ bar/* 4K bar/file1 1.2M foo/ 6.1M bar/file2 remove -r 3 files, 7.3...
I solved the following problem on Hackerrank. The challenge is to: Parse HTML input and display the tags and attributes in lexicographically ascending order. This is the input format: 2 //number of test cases/ lines of html <p><a href="http://www.quackit.com/html/tutorial/html_links.cfm">Example Link</a></p> <div cl...
All of this does just one thing. Move my player by finding the first finger that was used to touch the ship and drag it. I have a few questions: The first thing is I have an embedded class of MotionState. At first glance it makes a lot of sense to start with that. I latter ended up not using it. How do I go about ref...
I was doing a puzzle on Coderbyte, and here is what the puzzle stated: Have the function SimpleMode(arr) take the array of numbers stored in arr and return the number that appears most frequently (the mode). For example: if arr contains [10, 4, 5, 2, 4] the output should be 4. If there is more than one mode return the...
I have a requirement to check all records in a table which is big (Around 1.5-2 million records). What I am doing is very simple, just get all the records and loop through one by one, and do things. I have a quartz job which will run every 2 minutes to check things. ApplicationDetailCheckingJob.java public class Applic...
This method works for what I need it to do, but I just don't think it's extremely readable, and could be abstracted into different methods. I have a feeling I'm going against some best practices. Please let me know your suggestions: def reserve return render json: { error: "This entity is not available to reserve" ...
Because of the coupling with the VBIDE API (the extensibility library for the VBA IDE), unit testing the rubberduck refactorings, inspections and quick-fixes has been pretty much impossible, at least until a MockFactory was implemented, to do things like this: internal static Mock<CodeModule> CreateCodeModuleMock(strin...
This code encrypts a text with mono-alphabetic and poli-alphabetic substitutions ciphers. For further info see: Mono-alphabetic/Caesar Cipher Poli-alphabetic cipher require 'arrow_test' ALPHABET = ("a".."z").to_a # Moves a letter forward in the alphabet by # the given key wrapping around. # # <code> # shift('a', ...
I have an UpdateId class which represents some kind of version (like AssemblyVersion). UpdateId has three int values (listed in their compare priorities order): Year, ReleaseNumber and Revision. How can I make my CompareTo method better? It looks clumpy to me. public int CompareTo(object obj) { if(obj == null) retu...
This is my Java 8 code for a console calculator. I just want to know if it can be improved in any way. Just so you know i am a real beginner just got into java about a couple of weeks ago. import java.util.Scanner; public class Algorithm1 { public static int FirstNumber, SecondNumber; public static float TheAnswer...
Community moderator elections on the Stack Exchange network are really exciting. Alas, on the page of the primaries, I find it mildly annoying that candidates are randomly reordered on every page load, even if it's surely for a good reason. So, I cooked up (pun totally intended) this script using Beautiful Soup 4 in Py...
It randomly gets a word from an array of Strings. It prints out a '_' char for every letter of the word, displays the ones you have already guessed and displays the ones you have missed. Some advice would be welcome, such as what I should change, avoid and so on. Main class: import java.util.Scanner; public class Main ...
import java.util.Scanner; import java.lang.Comparable; class InsertionSort { private InsertionSort() {} private static boolean less(Comparable v, Comparable w) { return (v.compareTo(w) < 0); } private static void exch(Object[] a, int i, int j) { Object swap = a[i]; a[i] = a[j...
Here is my code for printf() implementation in C. Please share your thoughts for improvements. #define PRINTCHAR(c) putchar(c) #define MAXLEN 256 // Write a printf function which simulates printf() in C. int formatAndPrintString(char *pcFmt, va_list lList) { //Holds the number of characters printed, 0 on error ...
I tried to implement a generic stack in C using void pointers and tried to keep it as simple as possible by delegating all responsibility to the caller of the functions and avoiding more sophisticated approaches. stack.h #ifndef STACK_H #define STACK_H #include <stdbool.h> struct Stack { void *data; struct St...
I have had a hard time understanding all the documentation on the logger module and forking processes. My goal is to have each child process that's worked to write to their own separate log file. This seems to work but I just want to try and verify that this is the correct way. import os import logging def generate_p...
I found a custom function called UniqueItems() to use and then developed my own RemoveDups() and FaxesToUse() code: Function UniqueItems(ArrayIn, Optional Count As Variant) As Variant ' Accepts an array or range as input ' If Count = True or is missing, the function returns the number of unique elements ' If Cou...
I've got the following schema, which can not be modified since it's a problem taken from an exam: Player ------- player_id (PK) player_name player_games_total player_games_won Competition ----------- comp_id (PK) comp_player1 (FK references Player.player_id, NOT NULL) comp_player2 (FK references Player.player...
I created a widget to handle multiple selections in CoffeeScript. There's a working attached snippet that uses the compiled JavaScript (Stack Snippets don't support CoffeeScript), which is available to see. There are two classes: DocList and Doc (I didn't use Document fearing a name clash). The DocList class keeps trac...
Here is the slow part of my code: def Prepare_WCfst_file(): content_WCfst = "iteration\tlocus\tFromSite\tToSite\tWCFst\n" nbchunks = nbsites/nbsitesPerChunk if nbchunks%1 != 0: print("\n\nThe number of sites per chunk for WCFst is not a divisor of the number of sites per locus.\nProcess is aborted!\...
Please have a look at the HTML/CSS/JS (there is very little JS at the moment) and give me some feedback as to how my code looks to you, what level of skills it looks like I have and how I can improve. It's not anywhere near being completed but it should give you a good idea of where I'm at and where I'm going with it. ...
The function below accepts a hierarchical structure and returns a flat list of captions. There are few variations on the returned data: If showTotals is true, and root has children (if(!root.IsEmpty)) - "RootCaption" needs to be added as a first element of the list. If showTotals is false - all the children with a pr...
I was trying this problem and I was wondering if there is a way to check for the edge cases inside the for-loop. The problem statement: We'll say that a lowercase 'g' in a string is "happy" if there is another 'g' immediately to its left or right. Return true if all the g's in the given string are happy. Here I am s...
I implemented search module, but I'm a novice in programming and I'm not sure about public and private functions that I coded. Did I do it right? var data = require('./data'); function My_module(string) { var data_size_ = data.length; /** * @param {Array.<Object>} data. * @return {Array.<Object>} r...
I'm currently working on a simple simulator in Unity3D that involves planets orbiting each other. I wrote the following C# script to do that. It uses the classic gravitational formula, $$F=G\frac{m_1m_2}{r^2}$$ using UnityEngine; /// <summary> /// Class used for calculating /// how an object orbits another /// object...
I've built an app for members of an organization I'm in--the app shows the picture of a member with four multiple choice buttons, and the user then tries to guess the member's name. Pretty simple, but this is one of my first major apps. import UIKit import Foundation class ViewController: UIViewController { @IBO...
I have a process running in a separate thread which reads data over Ethernet and raises an event for each read. Then, this data is processed over a tree of classes. At the top of my class tree, I want to store the processed data to SQL tables. This read rate can be rather fast and often at times but on average its slow...
I'm trying to speed up this code that loops over an entire spectrum range. It's using a Raspberry Pi, and a rtl-sdr dongle that covers up to around 1.7 GHz. My goal is to be sweep over that spectrum and gather data from it in a timely manner. #!bin/usr/python #gathers from the rtl library needed for this program from ...
Here we trying to fix logs that have overlaps with each other. Am I doing it right? Is there any way to improve/refactor it? DROP TYPE IF EXISTS logs_with_error; CREATE TYPE logs_with_error AS ( model_id INT, model_type TEXT, initiator_id INT, initiator_type TEXT, error_type_id INT, ...
I have a Django view and template that work together, but I think I probably did things in a crappy way. I basically have many dynamic values that I want to display on the page, and in two different ways. When the user first comes to the page, these values get returned in the normal context and are stored in javascript...
In a recent CodeReview I presented a Product Manager that manages product listings and prices. Based on the great feedback I have refactored the mentioned Prompt and validator class and want feedback about the code and naming. Utilities/ProductValidator.cs namespace Ferienaufgabe_2.Utilities { class ProductValidator { ...
I attempted the Project Euler question #7 in C++ ("What is the 10 001st prime number?"). I took into account what I've been told about primes in order to create the most efficient algorithm I could in order to solve this. I would like to know if there is anything else I can do to check even fewer numbers for an even m...
Looking for review of design strategy of using a struct to return the functional result and error status. Your experience of how my design approach may succeeded or failed is especially welcomed. In constructing a library of functions, I've tried various error handling approaches, none completely satisfactory and was ...
I'm building a simple canvas animation engine as an exercise in learning ES6. Coming from C++ and Java, I miss static properties, but I've read that "Prototypes having data properties is generally considered an anti-pattern". The animation engine simulates \$n\$ river waves (simple lines), flowing from right to left in...
This script uses the Red Hat Satellite v5.4 API to delete servers which are read in from a file. The servers are listed in the file by hostname but the Satellite API deletes servers by ID number. The script runs the getId call using the hostname and stores the ID ( val[0]["id"] ) in the system_ids array (assuming it is...
I've refactored my previous query and added better checks when selecting the data. The query link can be found here. The formulas used to calculate the two percentages are the same, and can be seen below: $$ \text{Answered Percentage} = 100 - \left(\frac{\text{Unanswered}}{\text{Answered}} \times 100\right) \\ \text{Un...
I have just implemented an algorithm which calculates the direction an enemy in my game should face when moving to a location. This is a 2D game where characters can face in one of four directions: (Up, Down, Left, Right). When navigating to a point, if the new point is further away on the X axis than the Y axis, the ...
I was developing a web app using Entity Framework 6 and MVC 5. For the data access layer, I eased the job and wrote a generic repository as following: public class GenericRepository<T> where T : class { private EFDbContext context = new EFDbContext(); public IEnumerable<T> GetAll() { return contex...