This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ############################################################################################ | |
// All added or edited lines have comments like this near at hand. | |
// Just a variable definition near the top of the code. | |
// Plus some code at the bottom of updateGame | |
// Otherwise the code is the same | |
// ############################################################################################ | |
package uk.ac.reading.sis05kol.mooc; | |
//Other parts of the android libraries that we use | |
import android.graphics.Bitmap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// These lines create a new "ink" to write with and sets the colour and size of the text | |
Paint textPaint = new Paint(); | |
textPaint.setColor(Color.WHITE); | |
textPaint.setTextSize(12); | |
// This is the code that actually writes to the screen. | |
// The command used takes a few values to achieve this. | |
// canvas.draw("text to print out",X_location,Y_location, textPaint); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define TEMP_SENSOR_0 0 | |
#define TEMP_SENSOR_1 0 | |
#define TEMP_SENSOR_2 0 | |
#define TEMP_SENSOR_BED 0 | |
// This makes temp sensor 1 a redundant sensor for sensor 0. If the temperatures difference between these sensors is to high the print will be aborted. | |
//#define TEMP_SENSOR_1_AS_REDUNDANT | |
#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// # Function to generate random numbers | |
// # This function generates a random whole number (An integer) | |
// # between a min and max number inclusive | |
// # Paste it into your code to call it from your program | |
// # This function requires an import | |
import java.util.Random; | |
// # The random generator function. | |
public int Rand_number(int min, int max) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Should be added to the updateGame method. | |
// below the current code | |
if (mBallX < 0) mBallX = mCanvasWidth; // If the ball hits the left wall, move it to the right | |
if (mBallX > mCanvasWidth) mBallX = 0; // If the ball hits the right wall, move it to the left | |
if (mBallY < 0) mBallY = mCanvasHeight; // If it hits the top, move it to the bottom | |
if (mBallY > mCanvasHeight) mBallY = 0; // If it hits the bottom, move it to the top. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code should be added to the updateGame function below the two lines of code currently in there. | |
// The ball speed is positive when moving right, and negative when moving left | |
// To reverse the ball direction we need to change the sign of the ball speed variable. | |
// If the ball speed is 100, it moves right at 100 pixels per second. | |
// To reverse direction we change the sign of the ball speed variable and make it -100 and it moves left. | |
// If ball hits left side, reverse direction | |
if (mBallX <= 0) mBallSpeedX = -mBallSpeedX; | |
// If ball hits right side of screen reverse direction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** * helpers.c * * Computer Science 50 * Problem Set 3 * * Helper functions for Problem Set 3. */ | |
#include <cs50.h> | |
#include <math.h> | |
#include "helpers.h" | |
/** * Returns true if value is in array of n values, else false. */ | |
bool search(int value, int array[], int n) { | |
// TODO: implement a searching algorithm | |
int high, low, i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* SOS.c by Iliyan Stankov | |
* Runs on TM4C123 LaunchPad | |
* Input from PF4(SW1),PF0(SW2), output to PF3 (Green LED) | |
* Pressing SW1 starts SOS (Green LED flashes SOS). | |
* Pressing SW2 stops SOS | |
*/ | |
// Constant declarations to access port registers using | |
// symbolic names instead of addresses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loop A: loop over old_file_height // looping over each scan line in original file | |
loop B: | |
read each rgb-triple into an array // Read each pixel value in a complete scanline into an array | |
end loop B | |
skip over padding at end of scanline | |
loop C: loop n times // Set up a loop. loop resize times. Write the complete scan line n times. | |
loop D: loop trough pixel array // read each pixel from the array we just read. | |
Write pixel resize times.// Write the pixel out resize times. | |
end of loop D | |
write end of line padding // write new padding required for this scan line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Include PHPMailer library | |
require("PHPMailer/class.phpmailer.php"); | |
// Include server settings | |
require("server_config.php"); | |
// Create email object | |
$mail = new PHPMailer(); | |
// Set email object options |
NewerOlder