instruction
stringlengths
71
71.9k
I built a Simon Says game using an Arduino UNO board. This was my first "real" arduino project. I would like to know how to make it better, game mechanics and code efficiency. #define RedTone 165 #define GreenTone 330 #define YelloTone 659 #define BlueTone 1319 #define FailTone 100 #define BuzzerPin 8 /* The led and...
I have to compare variables to obtain coordinates. l upleft l upright -----------l-------------- downleft l downright l Here is what I am doing now: protected function check_if_quadrant_is_valid($variable) { $middle_of_x = 297; $middle_of_y = 421; $heigth...
I have a collection of full type names where I need to reduce common namespaces. For this purpose I wrote two extensions. The first one explodes each namespace into pieces and the second one removes the first name for as long as all first names are equal thus reducing each namespace. static class Namespace { public...
I'm trying to implement a simple automation solution in a restricted environment. I have actually implemented something but it took a bit longer than I wanted. I want to improve the solution and I'll probably have to extend it in the future so I'm asking for code review - my boss will probably be happier if I can deliv...
I am trying to get familiar with traversals algorithms implementations in Neo4j and to practice I am implementing classic graph algorithms (not judging if is the best approach or not, just for the sake of practising). I implemented this find dense nodes class, but i am not completely happy with it, I feel it can be imp...
I have a conf.inc.php file which has the following few lines. // enable css using convention below: // $css["pageName"] = ["cssName1", "cssName2", ...] $css["all"] = ["style"]; $css["myPage"] = ["someStyle"]; $css["myOtherPage"] = ["otherStyle", "anotherStyle"]; // disable css $exCss["myOtherPage"] = ["s...
I solved the standard "write a method to determine if one string is a permutation of the other" question with the following code, using xor, map, and reduce: from functools import reduce from operator import xor def checkPermutation(str1, str2): return not bool(reduce(xor, map(ord, str1 + str2))) The idea is that...
How can it be more cross-browser compatible, robust, better performance if possible? var Form={ /*QA : Goals : Cross browser compliant 2.DRYness 3. performant */ formObjects:{ enumObjects : function(){ for(var i=0; i < this.length; i++){ console.log(this[i]); ...
I have the following code that takes a string t and checks to see if any anagram of t is a substring of s: ### Question 1 main function and helper functions. """Given two strings s and t, determine whether some anagram of t is a substring of s. For example: if s = "udacity" and t = "ad", then the function returns True....
I love pizza and design patterns. This is my first program to practice the builder pattern of GoF, without fluent interface. I put emphasis on the structure and characters of builder pattern. Here are some notes, hope it will help you read: Directors --> MeatPizzaLover, CheesePizzaLover. I add an extra-layer of abstra...
I have a feature for users to be able to export the database information. But if the user choose all options to export it takes 1 minute or more to download the .csv file. I'm only including 1 part of the if statement, where I'm pulling in all the data. here it is: function exportTheData() { //get the data f...
I have the following code that works correctly. I am wondering if there is a simpler way to go about implementing my solution and/or if there is anything that looks non-standard in my code. If anyone wants to offer criticism I'm all ears. ### Question 2 main function and helper functions. """Given a string a, find the ...
I'm currently working through "Algorithms in java" by Robert Sedgewick (3rd edition, german version) on my own and am trying to solve one of the exercises there. The exercise (translation): Change the "divide and conquer"-Method for the search of the largest element in an array (program 5.6), so that you split the arr...
This is a challenge question from hackerrank.com. We have defined our own markup language HRML. In HRML, each element consists of a starting and ending tag, and there are attributes associated with each tag. Only starting tags can have attributes. We can call an attribute by referencing the tag, followed by a ti...
I am new to React and still getting a handle on props and state. I tried to adopt the example of lifting state from the React Docs and add the feature of different criteria by liquid type for evaluating these values. Here is the JSBin version. const liquidNames = { w: "Water", eth: "Ethanol" }; var liquidInvent...
I am writing a program to analyze books from the Gutenberg archive. The program takes the title and URL and finds the text and downloads it. Then it goes through the text and tokenizes it. Here is the code: from urllib import request import nltk import os.path canon_titles = [ 'Moby Dick', 'Great Expectations'...
I managed to get this code working. But I would like to find out how to tidy it up. Please give me some guide. In index.js, I have this code: var API = require('./../controllers/rounds.js'); var getToken = function() { var promise = new Promise(function(resolve, reject){ API.getToken(function(err, token) {...
This is a hackerank easy question. You are given a list of N people who are attending ACM-ICPC World Finals. Each of them are either well versed in a topic or they are not. Find out the maximum number of topics a 2-person team can know. And also find out how many teams can know that maximum number of topics. N...
#ifndef VECTOR_H #define VECTOR_H /** * A minimal vector that can dynamically store multiple objects */ template <class T> class Vector { public: /** * Create an initial vector */ Vector(); /** * Delete memory allocated resources ...
I was given the task to refactor this code from ES5 to ES6 , I am currently learning JS and this is like an assignment I really want to complete. You can see how I already started refactoring here, I need to use the following ES6 concepts: class, static methods, spread operator, const / let and array destructuring. cl...
This isn't any homework questions or assignments, only my practice. In the CodeFights Quora bot. My code cannot pass even the first hidden input because of the execution time. I'm only a first-month programmer in university. Here is the detailed question: For the purposes of this problem, suppose that Quora has \$n\$ ...
I've just finished a homework assignment to implement a simple Vector class. -Kindly ignore the following two paragraphs if you don't want to read someone whining about their professor Yadda, yadda, same old stuff. Here's where it gets interesting though; My professor is a bit... strange in his preferences. He's a reti...
What do you guys think about this? I myself think it is pretty usefull, But how does it look from an OOP perspective? Here's an example class public class Person { private string firstName, lastName; private int id; private static int statId; private static List<Person> persons = new List<Person>(); ...
I am having a scenario where I need to execute observables that depends on the result of the first one. However I need to keep the result of the first observable. I couldn't find any extension that would help me do this. For instance SelectMany does a projection of the first observable discarding the source results. Th...
Here is a simple C++ 11 trie for insertion and membership testing: #include <stdio.h> #include <stdlib.h> #include <map> #include <string.h> class TrieNode{ //TrieNodes can also be used as tries public: std::map<char, TrieNode> children; bool isLeaf; bool isContained(char * string){ if (strlen(string)==0)...
I would really like to improve, so any feedback is so appreciated! Tasks.js class Tasks extends Component { constructor(props) { super(props) this.state = { tasks: [], nextId: null } } componentDidMount() { this.getTasks() } getTasks() { const tasks = List(this.state.tasks).p...
I have a function that takes the root node as input and needs to return if the tree is a proper BST as per the definition below: The data value of every node in a node's left subtree is less than the data value of that node. The data value of every node in a node's right subtree is greater than the data value of that...
After reading some beginner textbooks on C++ programming, I decided to write a trivial unit conversion program. Since I am working on Windows, the console windows still use codepage 850 by default, and I wanted to output the Euro currency sign. I also wanted to get the error handling right, since that's one of the topi...
I am learning C++ and today I've implemented a version of the binary search tree. I would like your thoughts about it. node.h #pragma once struct Node { int val; Node *left; Node *right; }; bTree.h #include "node.h" #pragma once class BTree { private: Node *root; void addValue(int n, Node *node); ...
I've written a simple JavaScript function based off some existing code that takes a specific UNIX time string (in the snippet: 1491685200). It shows an alert if the specified time is still in the future. When that date has passed, it shows the elapsed days, hours and minutes whenever the function is called in-page. I...
So, chance, huh? Randomness. I'm looking into how I can test a class whose sole responsibility is to return weighted random results, that is, where there is a set probability of returning true. The trouble is, random being what it is, sometimes the result doesn't reflect the initial probability. Here's my attempt, whic...
I'm running these on page load to ensure that all h2 tags have a span inserted (it's a large WordPress site that needs to have this done to get the right styles) $('.bottomLine').each(function() { $(this).insertAfter($(this).parent().find('.price')); }); $('.prod-desc > h2').each(function() { $(this).wrapInner(...
Aim This program will help you train your memory on facts and trivia by the use of flashcards. How to use Type start to start, then type the answer to the question of the flashcard shown above. If the answer is correct, you will automatically progress to the next card. If you do not know the answer, type ??? and the an...
I'm an experienced programmer (mostly C#, JavaScript, PHP). Go is quite a paradigm shift and I want to make sure I'm starting on the right foot. This is my first Golang package. It's purpose is to be initiated and sent log lines (in the form of map[string]string to AddEntry. It's using channels since the lines could be...
I'm wondering how I can improve this class, for instance: Should local variables such as allInput that are passed in to more than one function be instance variables? Should functions like determineMeetingFormat and parseParticipants be called directly into the Meeting constructor or be assigned to local constants th...
I have an app written with node.js, I have a function which takes an image file name and generates a few variations of this image, code below. The issue I am having is that when I have to generate resized images from multiple original images(20+) it sucks up all of the resources on my developing machine, CPU bumps to 1...
So i am developing an Android application as a side project/hobby and I have come across the situation that I have to pass an Activity into a method for use a context (Don't question it) The problem here is that I have to pass it into a PreferenceOnClickListener and so I am unable to use this. I have come up with the f...
Here is the original question. In order to motivate his Peruvian students, a teacher includes words in the Quechua language in his math class. Today, he defined a curious set for a given positive integer N. He called this set, an Inti set, and defined it as the set of all positive integer numbers that have the n...
I am a Python beginner (well, a newbie programmer). I am creating a small address book, just as a fun project, nothing too serious. I would appreciate if you review it and advise me on how to make it better (not complete yet). Here's the link: https://github.com/volf52/address-book Here's the code: main.py import conta...
This code sort the string below in ascending order. I'd prefer it split-up in two or three smaller, simpler methods. I'm also wondering whether my algorithm has a decent time complexity. Given string [H, B, D, G, F, E, A, C] Output [A, B, C, D, E, F, G, H] public class sortArray { public static void sort (String[...
I've got to made a function which returns the checksum of an given integer. Source code of my implementation so far: function computeChecksum(num) { if (typeof num !== 'number' || isNaN(num)) { throw new Error('Number, which is not NaN, expected as Parameter.'); } num = Math.floor(Math.abs(num)); // Make s...
I have implemented a tree in Python. However, due to my lack of experience with Python, I am not able to judge the overall quality of my code. import unittest from datetime import * from gc import * RET_NO = 0 RET_YES = 1 RET_MAYBE = 0.5 # haha :) class Tree(object): """ Mutable abstract data type for arbitr...
I'm new to Express and SQL, so I don't know the conventional ways of combining the two. Right now I have done it the following way: app.get('/login', function (req, res) { res.render('login'); }); app.get('/home', function (req, res) { res.render('home'); }); app.post('/login', function (req, res) { db = ...
I tried to get back into Java by implementing a simplified version of the 2048 game. What I am mainly looking for is ways to reduce code duplication, all of my move functions have a very similar but distinct pattern. Suggestions on better patterns, practices or optimizations are welcome, keeping in mind that I am tryin...
I'm currently designing a game using a game engine I created and I'm currently implementing a method that loads maps into my game. The maps are made using Tiled Map Editor, saved as an XML file and are loaded using TiledSharp. At the moment, I'm trying to load a map, that contains 1437 'Game Objects' (These are just ti...
Ahead of the General Data Protection Regulation (GDPR) I begin to crypt more than ever before, in fact, all I can crypt become crypt. However, I wonder if anybody can tell me if this code is secure enough or can make it even better, optimize or just have some tips about the code. and not sure about the OpenSSL are sec...
I have a class 'M249' it is initiated with 'ammo' The class has one responsibility(I hope) to expend ammo. Does there exist a way to increment without accessor or writer? I am shaky on when I should be using mixins, or inheritance. I think module is best here? module MG_tools Rof = {:sustained => rand(3..9), :rapid =...
My goal here is to make a program that makes a list of passwords that has no doubles, making an end result of every combination of passwords in a specific area. print "Make sure you have a botnet army for this..." print "You will need one or this will take about 20+ days to compile.\n(Depending on your cpu speed an...
I've got an element with multiple classes in a page and I need to dynamically get the number at the end of a specific class name. Example: <div id="gallery-1" class="gallery galleryid-555 gallery-columns-3 gallery-size-thumbnail"> ... </div> In particular I've to get "3" from gallery-columns-3. I've made this func...
I've tried to implement the Kohonen algorithm using Python and I've managed to do this, but my result is so slow. I want to know if anyone knows how I can improve it. Objective: I have to read a file with X and Y position of 3000 points I generate N number of neutrons and arrange them uniformly over the whole chart (o...
I implemented the enciphering/deciphering algorithm from this code golf task. Enciphering reads string from left to right, replacing each character by a number N (0-9) to indicate that it is the same as the character N+1 positions before it. Only characters up to 10 positions back are replaced. Deciphering inverses th...
I want to write a function named inRange which will have below interface inRange(long a, long b, boolean inclusiveStart, boolean inclusiveEnd) This function calculates if this.value is in between a & b. However there are two important points to note: Two boolean values (inclusiveStart & inclusiveEnd) specify if a (or...
Here is the problem I've been trying to tackle: Design a thread-safe image caching server that can keep in memory only the ten most recently used images. I chose to implement an LRU cache to solve this as follows: ''' This module defines an LRUCache. Constraints: 1. May only hold upto ten items at a time. 2. Must b...
I am using KeystoneJS to manage data and my APIs (which includes Node.js, MongoDB, and Express.js). It uses Mongoose to connect with MongoDB; Keystone queries are essentially the same as Mongoose queries, just prefixed with keystone.list('listname').model instead of mongoose.model('name'). My use case is loading inform...
I am new to OOP and slowly starting to learn it to increase my PHP. This is my first attempt at writing something using OOP. Now people always talk about separating the logic and php code from the HTML / views. This is a rather difficult concept for me to grasp thus, I tried making my own little MVC "framework" simply ...
As an exercise to learn how OpenGL and image creation worked, as well as to satisfy a curiosity I've developed for Chaos Theory, I decided to create a mandelbrot fractal drawer in C++, which can either draw to an OpenGL context or to a PNG image. I am a beginner at C++, and would much appreciate any constructive feedba...
I would definitely love some feedback on this message board app I made. I been doing front end development for the most part and I just want to keep my backend chops up. Let me know anywhere that can be improved. Here's the github and the heroku PostController class PostsController < ApplicationController before_acti...
The below code is working uses formula to concatenate the result from Range("K:M") and write the result in column H. Is there a better way to write the below code that can concatenate the result to the exact location as per below table? Please note that data in the before table is discontinued but sometimes will be fr...
I am trying to convert "Random = 1" into dictionary {"Random":1} I tried Key = (line.split('=')[0]).split()[0] #to get key and remove spaces value = (line.split('=')[1]).split()[0] CQ_Options[Key] = value How could I do it in more mature way?
This code is written using the latest version of Processing. This has been compiled and proven working. What this code does: Enter name of the web color listed in Wikipedia in the text field. Or press CTRL for a random color. How to compile: Get the latest version of Processing (3.3) and copy-paste the code. Press run...
I have made an implementation of coin change problem solved with Dynamic Programming. Could you guys help with renaming some method and variables? Here is my implementation - public class CoinChange { public int computeMinimumNumberOfCoins(int[] coins, int finalSum) { Sum[] sums = new Sum[finalSum + 1]; ...
The challenge was to find the missing letter in an array in alphabetical order. Find the missing letter in the passed letter range and return it. If all letters are present in the range, return undefined. My solution was this: function fearNotLetter(str) { var letters = str.split(''); var codes = []; var missi...
I'm reading 'Haskell Programming from First Principles' book written by Christopher Allen and Julie Moronuki. As part of the exercises, I'm supposed to implement encryption and decryption functions for Vigenere cipher. This is my implementation. I'm using recursion for every letter in the plain text. shift :: (Int -> I...
I have created a function which converts numbers into text format and successfully converted up to 6 digit numbers. However, I want to know if I can make any modifications to make the code shorter. $(document).ready(function() { var onesVal = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', ...
I need the command I am executing on a datagrids context menu to know which column was clicked on. XAML <DataGrid x:Name="dataGrid" ItemsSource="{Binding Table}" ContextMenuOpening="DataGrid_ContextMenuOpening"> <DataGrid.ContextMenu> <ContextMenu> <MenuItem Header="Add Column" Command="{Binding...
I have created one method that get whois information from arin server is this any changes in this code for good code structure. public ArinResponse GetWhoisInfo(string domainName) { if (string.IsNullOrEmpty(domainName)) { throw new ArgumentException("You have to supply a domainName.", nameof(domainName)...
I'm developing a system that supports creating accounts and multiple users within every account that can each access a certain subset of data of their "parent" account. The data is stored in a SQL Server database in the following tables: Accounts: Id(guid, primary key), Title(nvarchar(200)) Users: Id(guid, primary ke...
Given a text file containing a list of links, I wrote some code to download them, one by one, from YouTube, using either YoutubeMP3 or Convert2mp3 logging any songs that failed to download. The code with Youtube-mp3 is significantly faster than Convert2mp3 but less accurate (some songs fail for unknown reasons, even ma...
I have been interested in writing some code that allows an object to wrap around the screen. It turned out to be much simpler than I was expecting, so I kept working and changed the white box that I had to a car that can rotate and move in the direction that it is facing by using basic trigonometry. I then expanded it ...
I've only been programming for about 2 weeks. I've been following a lot of tutorials and decided that the best way to learn would be to do it myself Looking to properly structure my code as well as a way to split it into multiple classes (Player, Item etc.) package kataKeptar; import java.util.Scanner; public class M...
My current embedded project uses a 16x2 LCD controlled by the HD44780 standard controller. My PIC18 speaks to the LCD via the Adafruit LCD serial backpack (schematic link). I chose the SPI interface. The HD44780 is controlled through various instruction writes to 8 data pins (DB0-7), a read/write pin (R/W), a register ...
It's a common occurrence nowadays to have different refresh rates across different devices. That's why it's very important to keep track of the device's frame rate to keep the game time consistent across different refresh rates. Is this an efficient way to go about this? var timeBetween; var timeLast; function gameLoo...
This program will read data in the form of: Number Name In each line of a text file, then it will write it to a binary file and print the resulting binary file. I am getting a warning in line 73, but I don't think it's an issue as null is converted into 0, right? while(((fread((char*)&student, 1, sizeof(student), binar...
I currently have a languages.js set up as such: var MaterialProperties = 0; var YieldStrength = 1; var OtherPhrases = 2; //continue to list other phrases - there are 40+ var English = [ "Material Properties", "Yield Strength", "Other Phrases" ]; var Chinese = [ // Chinese string that means "Material ...
I am working on a javaproject for the Information Retrieval subject in my graduation. What I'm trying to do is to reduce the lines of code I have to write due to the lack of time. We're currently on the second checkpoint, where we have to implement the engine collector component. What I'm trying to do is to use the Jso...
I have implemented the following MCMC algorithm for the german tank puzzle found here I just want to make sure everything is legit and that I am not getting the right answer by chance. from scipy.stats import norm import numpy as np import math import scipy as sp import matplotlib.pyplot as plt from scipy.stats impor...
I'm working on an algorithm to search through 100,000+ lines of dna sequencing, with the fastest time possible. Here is my current code, I was wondering if there's any ways to make this run faster: public static void mostCommonKmer(String s, int k) { // your code here HashMap<String, Integer> m = new HashMap<>(...
The context: I am currently struggling with a conception problem: I am building a SEO tags generator in PHP. I already managed to render some beautiful tags like these: <meta name="keywords" content="look, at, my, horse" /> <meta property="og:title" content="My horse is amazing" /> <meta http-equiv="Cache-Control" cont...
I'm currently coding for a school project. I'm planning on creating a virtual and simple Launchpad. Here's the first part of my code which treats the graphical interface. I know it's not well organized and that's why I ask for your help and tips! import java.awt.EventQueue; import java.awt.GridLayout; import javax.swin...
I want to easily create a binary tree given an array. The array elements are processed in a level order manner. E.g. If the array contains: {19,10,43} Then the root is 19, left child is 7 and right child is 3. To declare that the node does not have a child, I'm using a special data value as infinity marker. E.g. {19,10...
I found myself in need of a fixed size queue and decided to implement one using a ring (cyclic) buffer. I have tried my best to match the API of std::queue with the addition of full() to test if the queue is full and unable to accept another element. The code compiles cleanly with: -Wall -Wextra -pedantic --std=c++14 ...
I have implemented a working version of perceptron learning algorithm in C. Right now, it only works on single layer perceptrons and only takes two inputs. I plan on making it work with more than two inputs, but want to make sure I'm doing everything right first. Here is the tutorial I used: https://www.spicelogic.com/...
I'm learning Python after a 30+ year break from programming, got bored with the usual TicTacToe exercise, so went a bit wild adding functionality to it to make something that's a bit more fun to play than losing to the computer every time. Now reached the stage of aimlessly noodling around with it, which suggests to me...
I have written a haskell program for the following 'Code Monk' Challenge at HackerEarth. Here is the challenge description. Basically, we are looking for the number of vowels in a string. The first input n is the number of string to parse, followed by n number of random strings. And here is my implementation: import Da...
I have put together this function which compares two XMLs. On debugging, I found out that there are lot of useless loops which might cause performance problems for me if the files to compare are very big in size. Is there a tweak that I can do to this function so that i can cut down on some (if not all) of the useless ...
I was asked to write the HTML markup and CSS like the following: User's profile picture on the left his message heading his message content I was so concerned with how to correctly make it displayed (with JavaScript data and render it into HTML, and the HTML would result as: <div class="comment-section"> <div clas...
Preface I have decided to let my pet project created some years ago to undergo a code review here. The review will be broken into parts according to meta question Multiple reviews or one big review?. The overall concept and motivation can be inspected here (be patient, it takes some time to load). The doxygen generate...
I've been reading "clean code" tutorials, and I definitely see the value of using good names that "document themselves" to make intent clear. However, what can be done about complex formulas where describing the meaning of a symbol is difficult? My solution is to include a reference to the math source, and then use nam...
My company has a REST API, and one design issue that has come up a few times is that we use null to indicate "get everything". For example /api/books?genre=romance will get all romance books, but /api/books will return all books from all genres. The current technique used in the code is something like this public Respo...
This code is able to create a tic tac toe game, user vs a computer. For every move the user makes in a check board 3⨉3 abc⨉123. The functions setup the instance of the game along with creating the computer position response after user input. I would like help in refactoring code to use better mechanisms of loops instea...
Due to lack of central configuration management I am avoiding any Perl modules which would need to be installed on each of a great many servers. Result is more code than would normally be required in order to format HTML and send email as well as make system calls which are less desirable. #!/usr/bin/perl use strict; ...
The goal is to loop through an array of days-of-the-week (array values are stored as strings, eg: 'Mon, Tues, Weds', etc) and output some HTML when today's day is encountered. The file is a CMS's .tpl file, so the PHP sits directly alongside the HTML. My current, working code is: <?php $dayofweek = date('w'); forea...
I am writing a recreational language based off the speech pattern of Hodor from Game of Thrones. Basically the only commands are Hodor. You can find the complete spec here. One of my friends had a look at a different piece of code (but still somewhat related) and said that it was No joke, it [your program] was very we...
I have a stream of YUV422 encoded images coming in from a camera using Direct Show. I then run this byte array through a conversion method and return the RGB array to C# to display in a WPF app. My problem is that running the application for a 10 minute period and profiling it, the CPU usage is too high for my usage, a...
I have an array mapped to make a typical result string separated by commas and with numbers a bit beautified with array.map(formatNumber). Expected format is number [quantity], number [quantity], number [quantity] So 1234 [3], 1235 [2], 2234 [1] My mapping function was like this: function formatNumberSelected(numbe...
I tried creating the game of NIM in python. I researched a couple of videos on how to always win at NIM. Eventually, I found a method and i was able to implement it in my code. This is the result... #--------------------- # NIM GAME # Author : Akil Riaz #--------------------- import random import time def welco...
I've written a fairly simple script in F# which reads structured data from binary. I've avoided using the built-in .NET BinaryReader class because it's stateful in that it maintains its index in the stream. Instead I wanted to write a purely functional implementation. I'm doing this for my own personal learning so YAGN...
I'm a beginner to JavaScript and today I learned about primitive and reference values, so I decided to write a function that can deep clone an array and objects. Is this good code or is it not good enough? function clone(o,mode){ 'use strict'; mode = mode || 'deep'; var obj = {} ; var arr = []; if(typeof o ==...
In Swift I have a string where a dash needs to be inserted after every 3 characters, if there are 4 characters or 2 characters at the end of the string they should be shown as "-xx-xx" or "-xx" respectively. E.g "203940399345" to "203-940-399-345" "2039403993454" to "203-940-399-34-54" "20394039934546" to "203-...
My C program uses the Monte Carlo method to approximate the mathematical constant π, the ratio of a circle's circumference to its diameter (and, importantly for this code, 4 times the ratio of a circle's area to that of its bounding square). This estimation executes more slowly when parallelised using OpenMP than it do...