No.3529 [Last50 Posts]
>you roll it
>you code it
>you post it
Time to get fit. Any language you prefer. No re-rolls boys.
____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3530
>>3529
#include <iostream>
double calc_factorial(int n);
int main()
{
int n;
std::cout << "enter a number >= 0 to calculate factorial: \n";
std::cin >> n;
while(n < 0){
std::cin.clear();
std::cout << "enter a number >= 0 to calculate factorial: \n";
std::cin >> n;
}
std::cout << calc_factorial(n) << std::endl;
return 0;
}
double calc_factorial(int n)
{
if(n == 0){
return 1;
}else{
return n * calc_factorial(n - 1);
}
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3531
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3532
>>3531
>31
ah hell nah
On a sidenote, I hope someone gets 23. We need one for 8chan.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3548
I don't even know what some of the things actually refer to but let's see. Hopefully it's not too hard ;_;
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3583
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3584
>>3583
that one looks fun anon.
I need to write a list container today, but I will roll for a new exercise. Fully expect 84 on account of /g/ being slow.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3595
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3596
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3598
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3600
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3601
>>3600
<button onclick="namesFunction()">click</button>
<p id="output"></p>
<script>
document.write("<style>b{color:green}</style>");
function namesFunction() {
var x = document.getElementById("output");
var y = [
"<b>Bob</b> \
<br>Specialty: master fapper \
<br>Education: high school dropout",
"<b>Jil</b> \
<br>Specialty: huge cunt \
<br>Education: college paper",
"<b>Jak</b> \
<br>Specialty: can put large dildos into his anus \
<br>Education: middle school",
"Rob text text text...",
"Tom text text text...",
"Bil text text text...",
"Kim text text text...",
"Joe text text text...",
"Mel text text text...",
"Meg text text text..."
];
x.innerHTML = y[Math.floor(Math.random() * 10)];
}
</script>
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3602
>>3601
Cool anon. I don't do web stuff but lately I've been picking up javascript for firefox extensions.
<button> is html tag and namesFunction() is the callback when clicked?
Here is my shitty paint program from >>3584
It's not yet fully implemented and has some errors (not a 1-to-1 correspondence between what is shown and what is saved, keeping track of all those points is slow eventually and isn't the best approach. Group paint isn't functional yet. Also, not the best OOP...)
http://pastebin.com/mcTWSZjZ
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3623
>>3583
I'm back, /g/. I got it mostly working, pending some UI improvements and additional testing.
Eventually I plan to implement multiplayer over TCP and maybe also do a gui.
https://bitbucket.org/snickerbockers/battleship
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3624
>>3623
Looking through it now, cool anon.
Also, I'm rollin' for a new exercise.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3628
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3629
>>3628
>[object Object]
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
long current = 0;
long previous = 0;
int numCases;
printf("Enter number of test cases for the fibonacci sequence: ");
scanf("%d", &numCases);
long *numbers = (long*)malloc(sizeof(long)*numCases);
int i;
for(i = 0; i < numCases; i++){
if(i == 0)
numbers[i] = current;
if(i == 1){
numbers[i] = 1;
current = 1;
}
else{
numbers[i] = current + previous;
previous = current;
current = numbers[i];
}
printf("\n");
printf("%d", numbers[i]);
}
free(numbers);
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3630
>>3629
>[object Object]
I just realized how much extraneous shit i put in there. Welp.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3635
>>3629
Rolling for another project.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3637
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3639
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3656
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3669
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3680
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3682
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3789
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3800
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3801
rerolling since i don't understand what a name generator does
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3851
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3857
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3858
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3859
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3860
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3861
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3862
>>3861
gotta reroll, actually just did this earlier
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3870
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3871
>>3529
>No re-rolls
yeah, fuck 70 for right now.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3873
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3877
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3878
>>3877
I don't know what this means
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3888
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3889
>>3878
Brainfuck is an esoteric programming language.
An interpreter is a program which will take commands in a programming language and run them.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3890
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3891
>>3890
used pastebin for syntax coloring, after mailing it to myself from another pc.
Kinda goofy.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3922
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3923
>>3922
I pass. This list is shit.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3954
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3955
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3959
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3964
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3976
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3982
I know I didn't roll it, but I'm new to Java and this thread inspired me to write a program that counts the number of letters, words, and sentences in your input.
Tell me if I'm doing something dumb or unneeded in doing this
package countwordsinastring;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println("(Type 'EXIT' to exit)");
System.out.println("Enter complete sentences:");
boolean stillRunning = true;
while(stillRunning){
Scanner input = new Scanner(System.in);
String userInput = input.nextLine();
if(!userInput.equals("EXIT")){
int sentences = 0 ;
int words = 1 ;
int letters = 0;
System.out.println();
int i = 0;
char[] inputArr = new char[userInput.length() + 2];
for (i = 0; i < userInput.length(); i++) {
inputArr[i] = userInput.charAt(i);
if(!Character.isLetter(inputArr[i])){
switch (inputArr[i]) {
case ' ':
words++;
break;
case '.':
sentences++;
break;
case '!':
sentences++;
break;
default:
}
}else{
letters++;
}
}
if (sentences == 0) {
sentences = 1;
} else if(sentences > 0 && inputArr[userInput.length() - 1] != '.'
&& inputArr[userInput.length() - 1] != '!') {
sentences++;
}
System.out.println("Number of letters: " + letters);
System.out.println("Number of words: " + words);
System.out.println("Number of sentences: " + sentences);
System.out.println();
}else{
stillRunning = false;
}
}
}
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3983
>>3982
Focking shit
Ignore the fact that I initialize inputArr as having 2 more than userInput.length();
That was a mistake made in seeing if I could make it so that it doesn't add a sentence when it picks up on a "..." but that didn't work out so I removed it from the code
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3984
>>3982
Sorry to put so much on this thread but reading this after I posted it made me notice some formatting issues that were bugging me.
Made it more readable.
package countwordsinastring;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println("(Type 'EXIT' to exit)");
System.out.println("Enter complete sentences:");
boolean stillRunning = true;
while (stillRunning) {
Scanner input = new Scanner(System.in);
String userInput = input.nextLine();
if (!userInput.equals("EXIT")) {
int sentences = 0;
int words = 1;
int letters = 0;
int i = 0;
System.out.println();
char[] inputArr = new char[userInput.length()];
for (i = 0; i < userInput.length(); i++) {
inputArr[i] = userInput.charAt(i);
if (!Character.isLetter(inputArr[i])) {
switch (inputArr[i]) {
case ' ':
words++;
break;
case '.':
sentences++;
break;
case '!':
sentences++;
break;
default:
}
} else {
letters++;
}
}
if (sentences == 0) {
sentences = 1;
} else if (sentences > 0 &&
inputArr[userInput.length() - 1] != '.' &&
inputArr[userInput.length() - 1] != '!') {
sentences++;
}
System.out.println("Number of letters: " + letters);
System.out.println("Number of words: " + words);
System.out.println("Number of sentences: " + sentences);
System.out.println();
} else {
stillRunning = false;
}
}
}
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3989
I'm gonna print this image out and use it as a means of inspiration for projects in Java and C++, seeing as I'm simultaneously learning those languages. I'll take these on (not necessarily in order) and learn whatever I don't know that I need to in order to complete them in my free time when I'm not learning by other means.
Wish me luck fam
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3996
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.3997
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4042
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4043
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4045
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4047
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4049
im gonna have to do this in swift fuck me
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4057
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4070
>>4047
Nobody wins in TTT.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4087
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4089
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4091
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4092
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4094
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4098
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4100
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4110
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4120
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4123
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4124
>>4123
require 'json'
require 'open-uri'
if ARGV.length != 2
puts "[-] Usage: 8chan-dl <board> <threadnum>"
end
board = ARGV[0]
threadnum = ARGV[1].to_i
threadurl = "http://8ch.net/#{board}/res/#{threadnum}.json"
thread = JSON.parse(open(threadurl).read)
title = thread['posts'][0]['sub'].gsub /[ |\/]/, '_'
puts "[+] Thread title: #{title}"
dir = "./#{title}/".gsub ' ', '_'
Dir.mkdir dir if not Dir.exists? dir
for post in thread['posts'].select{|p| p.has_key? 'ext'}
filename = "#{post['tim']}#{post['ext']}"
img_url = "http://media.8ch.net/#{board}/src/#{filename}"
puts "[+] Downloading #{img_url}"
File.open("#{dir}#{filename}", 'wb') do |file|
file.write(open(img_url).read)
end
end
Not the best. Has no error handling and shit but it seems to work. Also wrote a 4chan one that is very similar if you guys want that.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4129
Yay, a rollotto that isn't a jizzfest!
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4130
Roooooooolll in the dungeon
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4131
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4140
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4144
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4222
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4223
>>4222
Rerolling for too easy
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4224
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4225
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4232
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4233
i cant program but ill roll anyway
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4254
>tfw can't code for shit
>rolling anyway
Come on, FizzBuzz.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4258
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4260
>>3529
rolling for easy task-
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4261
>>4260
what the hell is that ?
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4333
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4362
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4376
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4398
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4404
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4409
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4412
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4416
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4417
>>4416
public static String reverseString(String input)
{
char[] chars = input.toCharArray();
StringBuilder reversed = new StringBuilder();
for(int i=input.length()-1;i>=0;i--)
reversed.append(Character.toLowerCase(chars[i]));
return reversed.toString();
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4446
they see me rollin', they codin'
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4448
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4453
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4464
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4465
>>4464
fuck your rules, rerollan
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4466
I terribly misunderstood the speed of this board...
I'll just look for something I know how to do...
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4471
>>3529
rolling will post later
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4472
>>3529
>>4471
#include <stdio.h>
unsigned triangularNumber(unsigned n);
const char *suffix[] = {" ","st","nd","rd"};
int main(int argc, char *argv[])
{
int n = 0,m;
unsigned t;
if ((argc < 2) ||
(sscanf(argv[1],"%d",&n) != 1) ||
(n <= 0))
{
printf("\nusage %s <n>\n",argv[0]);
printf(" where <n> is a positive integer\n");
return -1;
}
t = (int)(n * (((float)n + 1.0) / 2.0));
if (t == triangularNumber(n))
{
m = n % 10;
printf("\nThe %d%s triangular number is %d\n",
n,
((m > 0) && (m < 4)) ? suffix[m] : "th",
t);
}
else
{
printf("\nerror\n");
}
return 0;
}
unsigned triangularNumber(unsigned n)
{
if (n == 1) return 1;
return n + triangularNumber(n-1);
}
only works to around 65000 tho
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4479
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4481
>>4479
>Chip-8 emulator
>have to emulate an instruction set I'm completely unfamiliar with
fug
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4496
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4502
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4503
>>4502
Welp that was easy. See you later bitcheS
> let celciusToFarenheit c = 32 + (c * 1.8)
> celciusToFarenheit 0
32.0
> celciusToFarenheit 100
212.0
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4510
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4512
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4529
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4530
>>4529
(defun fact (n)
(if (= n 0)
1
(* n (fact (- n 1)))))
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4534
| Rolled 61 (1d100) |
rollin
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4538
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4539
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4541
>>3529
Fuck my shit up, OP.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4582
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4585
idk how to dice so my last post numbers are my roll
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4586
how does one do code tags?
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4587
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4588
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4589
>>4588
#include <stdio.h>
static const int ROWS = 67; //biggest that works
long double factorial(int argument){
if(argument>=0){
long double result=1;
for(;argument>1;argument--)
result = result*argument;
return result;
}else{
return -1; //out of range
}
}
long double choose(int n, int k){
return factorial(n) / ( factorial(k)*factorial(n-k) );
}
void pascal(unsigned long ptriangle[], int max_iter, int current_row){
if(current_row>=max_iter||current_row<0){ //done or out of range
return;
}else{
int i;
for(i=0;i<=current_row;i++) //compute row
ptriangle[(current_row*(current_row+1)/2)+i] = choose(current_row,i);
current_row++;
pascal(ptriangle,max_iter,current_row); //next row
}
}
void main(){
int iter = ROWS+1;
unsigned long triangle[(ROWS+1)*(ROWS+2)/2]; //n(n+1)/2
pascal(triangle, iter, 0); //do important thing
int i;
for(i=0;i<(iter*(iter+1)/2);i++){ //print triangle
if((triangle[i]==1)&&(triangle[i-1]==1)&&(i!=2)) //line breaks
printf("\n\n");
printf("%lu ",triangle[i]);
} return;
}
>>4586
Like this:
[code]code here
[/code]
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4599
| Rolled 46 (1d100) |
roll
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4601
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4607
| Rolled 2 (1d100) |
>>4599
le slightly obfuscated code. Tried to stay under 100 lines. Compile with
gcc -l allegro main.c
#include <allegro5/allegro.h>
float FPS = 5;
short t[300];
short gt[300] = { 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,2,1,2,2,
1,2,1,2,1,1,1,2,2,2,2,2,1,2,2,2,1,2,1,2,1,1,1,2,1,2,2,2,2,2,2,2,1,2,1,2,1,2,
1,2,1,2,1,2,1,1,2,2,2,2,2,2,1,2,1,2,1,1,1,2,1,2,1,2,1,2,2,2,2,2,2,2,1,1,1,2,
1,2,1,2,1,2,1,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,2,
1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,1,2,1,2,1,2,2,2,1,2,2,2,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,1,1,2,1,2,1,1,1,
1,1,2,1,2,1,2,1,2,1,2,2,1,1,2,2,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,1,1,2,1,2,1,
1,1,1,1,2,2,2,1,1,2,1,1,2,2,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1};
int main(int argc, char **argv){
ALLEGRO_DISPLAY *display = NULL;
ALLEGRO_EVENT_QUEUE *event_queue = NULL;
ALLEGRO_TIMER *timer = NULL;
ALLEGRO_BITMAP *b[3];
t[rand()%300] = 2;
int redraw = true, dir = 2 | (1 << 3), del = 3, draw = 0;
al_init();
al_install_keyboard();
timer = al_create_timer(1.0 / FPS);
display = al_create_display(640, 480);
t[130] = 1, t[131] = 4, t[132] = 7;
for(int i = 0; i < 3; ++i){
b[i] = al_create_bitmap(32, 32);
al_set_target_bitmap(b[i]);
al_clear_to_color(al_map_rgb(255*(i>0), 255*(i%3 == 2), 255*(i%3 == 1)));
}
al_set_target_bitmap(al_get_backbuffer(display));
event_queue = al_create_event_queue();
al_register_event_source(event_queue, al_get_display_event_source(display));
al_register_event_source(event_queue, al_get_keyboard_event_source());
al_register_event_source(event_queue, al_get_timer_event_source(timer));
al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();
al_start_timer(timer);
while(draw != 300) {
ALLEGRO_EVENT ev;
al_wait_for_event(event_queue, &ev);
if(ev.type == ALLEGRO_EVENT_TIMER) {
if(dir != 9) {
int pos,npos, max = -32768;
for(int i = 0; i < 300;++i) {
if(t[i] % 3 == 1) {
t[i] -= del;
if(t[i] > max) {
max = t[i];
pos = i;
}
}
t[i] = t[i] < 0 ? 0 : t[i];
}
npos = (pos/20+((dir>>3)+14))%15 * 20 + (pos%20+(dir&0x7)+19)%20;
if(t[npos] % 3 == 1) {
dir = 1 | (1 << 3);
al_set_timer_speed(timer, 1.0/50.0);
} else if(t[npos] % 3 == 2) {
do pos = rand()%300;
while(t[pos] % 3 != 0);
del = (t[pos] = 2) - 2;
al_set_timer_speed(timer, 1/(FPS += 0.3));
} else
del = 3;
t[npos] = max + 3;
} else {
t[draw] = gt[draw];
++draw;
}
redraw = true;
} else if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
break;
} else if (ev.type == ALLEGRO_EVENT_KEY_DOWN) {
if (ev.keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
break;
} else if(ev.keyboard.keycode == ALLEGRO_KEY_UP && dir != 17 && dir != 9) {
dir = 1 | (0 << 3);
} else if(ev.keyboard.keycode == ALLEGRO_KEY_DOWN && dir != 1 && dir != 9) {
dir = 1 | (2 << 3);
} else if(ev.keyboard.keycode == ALLEGRO_KEY_LEFT && dir != 10 && dir != 9) {
dir = 0 | (1 << 3);
} else if(ev.keyboard.keycode == ALLEGRO_KEY_RIGHT && dir != 8 && dir != 9) {
dir = 2 | (1 << 3);
}
}
if(redraw && al_is_event_queue_empty(event_queue)) {
redraw = false;
al_clear_to_color(al_map_rgb(0,0,0));
for(int i = 0; i < 300; ++i)
al_draw_bitmap(b[t[i]%3], (i%20) * 32, (i/20) * 32, 0);
al_flip_display();
}
}
return 0;
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4614
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4639
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4646
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4647
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4661
>>4647
>>4646
Is it hard or have you already done it before?
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4662
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4667
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4668
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4676
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4681
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4713
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4717
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4728
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4732
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4733
>>4732
>D&D
>Basic Rules: 114 pgs
Fuck it
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4770
>>4124
Let's see the 4chan one
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4776
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4778
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4800
| Rolled 53 (1d99) |
roll
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4802
>>3623
Yeah, that looks pretty damn great. Gonna roll something up for myself too
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4803
>>4802
Whew, writing in C gave me a real workout. Hope I can use C++ whatever I do later,
#include <stdio.h>
const float CONV_CONST = 5.0/9.0f;
int main()
{
float t;
char input;
float result;
printf("Celcius or Fahrenheit (c/f)?: ");
scanf("%c", &input);
printf("\nType in your temperature: ");
scanf("%f",&t);
if(tolower(input)=='c') {
result = t/CONV_CONST + 32.0;
} else {
result = (t - 32.0)*CONV_CONST;
}
printf("\nConverted temperature: %.2f", result);
return 0;
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4806
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4809
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4823
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4824
>>4823
already exists
[code]
import sys
import os
import json
import requests
import shutil
import argparse
from blessings import Terminal
from multiprocessing import Value
from multiprocessing.pool import Pool
VERSION = "0.1"
NAME = "Infinity Grabber"
class Infinity:
Main class, does everything
def init(self):
parser = argparse.ArgumentParser()
parser.add_argument("thread", help="URL of thread to scrape")
parser.add_argument("--directory", "-d", help="Specify dir to save to (Default: ~/8chan)")
parser.add_argument("--name", "-n", help="Specify name of dir to download to (Default: Topic/OP Post number)")
parser.add_argument("--workers", type=int, help="Number of threads to run (Default: 10)")
parser.add_argument("--version", "-v", action="version", version=VERSION)
self.args = parser.parse_args()
save_path = self.args.directory or os.path.join(
os.path.expanduser('~'), "8chan")
self.header = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11\
(KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept': 'text/html,application/xhtml+xml,\
application/xml;q=0.9,*/*;q=0.8'}
self.thread_url = self.args.thread
self.board = self.thread_url.split('/')[3]
self.thread_name = ""
self.downloads = []
self.save_path = save_path
self.counter = Value('i', 0)
self.total_count = Value('i', 0)
self.workers = self.args.workers
self.down_dir = ""
def url_open(self):
""" Returns raw data from thread """
url = "{0}.json".format(os.path.splitext(self.thread_url)[0])
return requests.get(url, headers=self.header)
def jsonify(self):
""" Converts raw data to text to json object """
jsonable = self.url_open().text
return json.loads(jsonable)
def download_image(self, url, filename):
""" Creates new dir if doesn't exist, downloads image """
down_dir = os.path.join(self.save_path, self.thread_name)
img_dir = os.path.join(down_dir, filename)
if not os.path.exists(down_dir):
os.makedirs(down_dir)
image = requests.get(url, headers=self.header, stream=True)
with open(img_dir, 'wb') as location:
image.raw.decode_content = True
shutil.copyfileobj(image.raw, location)
self.down_dir = down_dir
def image_urls(self):
""" Iterates over json obj, gets image links
Creates pool of workers, creates new workers """
json_obj = self.jsonify()
for post in json_obj['posts']:
if 'ext' in post:
self.total_count.value += 1
try:
self.thread_name = self.args.name
except (KeyError, NameError):
self.thread_name = json_obj['posts'][0]['sub'].replace(' ', "_")
else:
self.thread_name = str(json_obj['posts'][0]['no'])
for post in json_obj['posts']:
if 'ext' in post:
filename = post['tim'] + post['ext']
image_url = 'https://8ch.net/{board}/src/{file}'.format(
board=self.board, file=filename)
self.downloads.append((image_url, filename))
self.download_image(image_url, filename)
with self.counter.get_lock():
self.counter.value += 1
update_progress(self.counter.value, self.total_count.value)
pool = Pool(self.workers)
pool_map = pool.map_async(self.download_image, self.downloads)
try:
pool_map.get(0xFFFF)
except KeyboardInterrupt:
print("Aborting")
pool.terminate()
pool.join()
else:
pool.close()
pool.join()
def main():
""" Creates instance of Infinity """
grabber = Infinity()
args = grabber.args
if len(args.thread) < 1:
sys.exit(1)
grabber = Infinity()
grabber.image_urls()
def update_progress(current, total):
""" Draws bar and updates it """
bar_length = 40
percent_finished = current/float(total)
percent = int(current/total*100)
fillers = int(percent_finished * bar_length)
empty_fillers = bar_length - fillers
progress_bar = "["
progress_bar += fillers * "="
progress_bar += ">"
progress_bar += empty_fillers * " "
progress_bar += "]"
term = Terminal()
with term.location(x=0):
sys.stdout.write("{} {}/{} [{}%]".format(progress_bar, current, total, percent))
sys.stdout.flush()
if name == "main":
main()
[/Code]
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4827
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4828
>>4827
What the hell is a picross? Not a native speaker, so... Well, gonna post it when I solve it.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4836
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4844
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4845
>>4844
def alp(char):
alphabet={'a':'. -',
'b':'- . . .',
'c':'- . - .',
'd':'- . .',
'e':'.',
'f':'. . - .',
'g':'- - .',
'h':'. . . .',
'i':'. .',
'j':'. - - -',
'k':'- . -',
'l':'. - . .',
'm':'- -',
'n':'- .',
'o':'- - -',
'p':'. - - .',
'r':'. - .',
'q':'- - . -',
's':'. . .',
't':'-',
'u':'. . -',
'v':'. . . -',
'w':'. - -',
'x':'- . . -',
'y':'- . - -',
'z':'- - . .',
' ':' ',
'0':'- - - - -',
'1':'. - - - -',
'2':'. . - - -',
'3':'. . . - -',
'4':'. . . . -',
'5':'. . . . .',
'6':'- . . . .',
'7':'- - . . .',
'8':'- - - . .',
'9':'- - - - .',}
return str(alphabet[char])+" "
def translate(string):
original=string
original_lower = string.lower()
morse=""
for letter in original_lower:
try:
morse+=alp(letter)
except:
morse+=""
return morse+"\n"+original
print(translate("gas the kikes"))
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4846
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4848
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4849
>>3530
>You can run function x inside function x
Speaking as a guy who's just started programming, I didn't think that you could do that. Thanks.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4850
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4851
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4853
>>3529
The majority of those is wayy too much work for me to take seriously
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4949
>>3529
git is jewish mindtrick bullshit. version control is for faggots and niggers
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4952
>>3529
>>3529
probably something boring
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4956
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4963
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.4979
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5039
Let's see how much I can do with Python without classes.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5040
>>5039
commands.py
def plus(arg1, arg2):
return arg1 + arg2
def minus(arg1, arg2):
return arg1 - arg2
def times(arg1, arg2):
return arg1 * arg2
def div(arg1, arg2):
return arg1 / arg2
def exponential(base, power):
return base ** power
def pi():
return 3.141592654
def euler():
return 2.718281828
def scientific_notation(number): # sig_figs is significant figures
# I just don't wanna write that shit down every single time, okay?
power = 0
if (abs(number) > 10):
while number > 10:
number /= 10
power += 1
elif (abs(number) < 1):
while number < 1:
number *= 10
power -= 1
# s.f. in scientific notation typically includes the base number
# i don't know how you learned it, but I learned it this way. Sorry.
print "%0.6fe%d" % (number, power)
main.py
http://pastebin.com/NBXkp0n6
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5041
>>5040
This is buggy as shit, never fucking mind ;-;
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5060
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5062
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5066
public class Benis
{
public static String reverse( String s)
{
String ret="";
for(int i = s.length(); i>0;i--)
{
ret += s.charAt(i-1);
}
return ret;
}
public static void main(String [] args)
{
String s = "bujur";
System.out.println(reverse(s));
}
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5069
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5070
>>4824
Your python code is surprisingly go-like in some ways, you use go anon?
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5094
Daily reminder to sage when you roll.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5096
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5097
>>5096
#include <iostream>
using namespace std;
struct vect{
int x;
int y;
int z;
};
int dotProduct(vect a, vect b){
return a.x*b.x + a.y*b.y + a.z*b.z;
}
vect crossProduct(vect a, vect b){
vect c;
c.z = a.x*b.y;
c.y = a.z*b.x;
c.x = a.y*b.z;
return c;
}
vect accept(){
int a,b,c;
cin>>a;
cin.get();//to ignore i+
cin.get();
cin>>b;
cin.get();//to ignore j+
cin.get();
cin>>c;
cin.get();//to ignore k
vect ans;
ans.x=a;
ans.y=b;
ans.z=c;
return ans;
}
void displayVect(vect a){
cout<<a.x<<"i+"<<a.y<<"j+"<<a.z<<"k"<<endl;
}
int main()
{
vect first,second;
cout<<"Insert vector in ai+bj+ck format"<<endl;
cout<<"First Vector :";
first=accept();
cout<<"Second Vector :";
second=accept();
cout<<"Dot Product : ";
cout<<dotProduct(first,second);
cout<<"Cross Product : ";
vect cross=crossProduct(first,second);
displayVect(cross);
return 0;
}
Done.
Only works for positive values though.
Will improve.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5098
>>5097
easy fix, just remove the extra cin.get() from the accept() function besides the //to ignore i+ comments
apologies for samefagging
The algo can be expounded to multi dimensions but I only used three.
Also rerolling
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5099
>>3529
090017090C0C00011414050D1014001408091300090E000300100C151300100C1513
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5102
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5103
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5142
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5161
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5169
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5185
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5190
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5192
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5198
>>5192
Hi, I'm a bit new here so bear witrh me.
Does anyone know of a PGP solution that DOESN'T leave the unencrypted file? It's a pain. I can obviously erase the files but knowing they're u.nreadable if recovered would be peace of mind for me.
The way I see it my options are:
Encrypt the original file with truecrypt and then erase.
Or run everything in an encrypted volum on a VM - but are there any with a PGP standard? Most are things like trucrypt and I hear that has flaws.
What build would you suggest? What specific software? The goal is to leave no trace of the unencrypted file.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5202
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5203
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5204
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5206
>>5204
using Vigenère cipher
letter = 'abcdefghijklmnopqrstuvwxyz '
def encrypt(key,string):
encrypt_string = []
string = string.lower()
key = key.lower()
for n in range(0,len(string)):
ind =(letter.index(key[n]) + letter.index(string[n]))%26
print ind
encrypt_string.append(letter[ind])
print encrypt_string
def decrypt(key,string):
decrypt_string = []
string = string.lower()
key = key.lower()
for n in range(0,len(string)):
ind =(letter.index(string[n]) - letter.index(key[n]))%26
decrypt_string.append(letter[ind])
print decrypt_string
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5213
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5233
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5243
Guess I'll give it a roll. Trying to learn D cause I'm a dumb hipster yuppie.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5335
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5337
>>3529
>difficulty ranges from easy as fuck to /just/ fuck my shit up
Maybe it would make sense to make perhaps 3 different images, for beginners, intermediate, and pros.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5339
Benford's law (aka boring gay shit)
#! python3
numberfilepath = "numbers.txt"
numberfile = open(numberfilepath, "r")
numberfiletext = str(numberfile.read()).split()
numberfile.close()
numbercount = {}
for x in range(1,10):
numbercount.update({x:0})
for x in range(0, len(numberfiletext)):
firstdigit = int(str(numberfiletext[x])[0])
numbercount[firstdigit] += 1
finallist = sorted(numbercount, key=lambda x: numbercount[x], reverse=True)
print("Descending list")
for x in finallist:
numberofhits = numbercount[x]
averagenumber = numbercount[x]/len(numberfiletext)
print("%s: count=%s, average=%s" % (x, numberofhits, averagenumber))
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5340
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5343
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5344
import unittest
from dijkstras import Graph
class Graph_Test(unittest.TestCase):
#Runs before each test
def setUp(self):
self.graph = Graph()
def test_add_vertex(self):
self.graph.add_vertex('A', {'B': 7, 'C': 8})
self.assertEqual(self.graph.vertices, {'A': {'C': 8, 'B': 7}})
def test_shortest_path(self, ):
self.graph.add_vertex('A', {'B': 7, 'C': 8})
self.graph.add_vertex('B', {'A': 7, 'F': 2})
self.graph.add_vertex('C', {'A': 8, 'F': 6, 'G': 4})
self.graph.add_vertex('D', {'F': 8})
self.graph.add_vertex('E', {'H': 1})
self.graph.add_vertex('F', {'B': 2, 'C': 6, 'D': 8, 'G': 9, 'H': 3})
self.graph.add_vertex('G', {'C': 4, 'F': 9})
self.graph.add_vertex('H', {'E': 1, 'F': 3})
self.assertEqual(self.graph.shortest_path('A', 'H'), ['H', 'F', 'B'])
self.assertEqual(self.graph.shortest_path('H', 'I'), {'A': 12, 'B': 5, 'C': 9, 'D': 11, 'E': 1, 'F': 3, 'G': 12, 'H': 0})
unittest.main()
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5356
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5357
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5365
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5366
>>5365
reroll the ulam spiral is gay
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5381
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5393
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5401
Rolling. Currently 4chan, 8ch and gelbooru downloaders
https://github.com/wewman
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5404
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5407
>>5404
I really didn't want to do encryption since that looks so boring, so I did fizzbuzz instead.
/* Fizz Buzz program
The terminal will print seven numbers at a time every time the user presses a key.
Any number divisible by 3 will be replaced with the string "Fizz", and any number
divisible by 5 will be replaced with the string "Buzz".
The user can terminate the program by typing 'x'.
Demonstrates basic bitch programming capacity.
Developed by anon, 11 7 2017.
*/
#include <iostream>
int main()
{
int n {0}; // This is the number the program will increment for printing.
std::cout << "FizzBuzz program.\n\n";
std::cout << "The integers will be printed until the user submits 'x'.\n";
std::cout << "Every number divisible by 3 will print \"Fizz\" instead.\n";
std::cout << "Every number divisible by 5 will print \"Buzz\" instead.\n\n";
std::cout << "Every number divisible by both 3 and 5 will print \"FizzBuzz\".\n\n";
std::cout << "Press any key to begin. Except x, which terminates the program.\n";
for(char c; std::cin>>c; ) //while the user gives input
{
if(c =='x') break; //excape on x
for(int i=0; i!=10; ++i)
{
++n;
bool fb {false}; //fizzbuzz detector
if(n%3 == 0) {
std::cout << "Fizz";
fb = true;
}
if(n%5 == 0) {
std::cout << "Buzz";
fb = true;
}
if (!fb) std::cout << n;
std::cout << ", ";
}
std::cout << std::endl;
}
std::cout << "bye nigga\n";
return 0;
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5416
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5417
>>5416
fuck it, to tired, doing this tomorrow
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5420
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5429
rawlz. will be back in couple hours most likely
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5430
>>5429
holy shizz ive had enough alcohol to choke a mouse
(define factorial
(lambda(n)
(if (= n 0)
1
(* n (factorial (- n 1))))))
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5431
>>5407
i doz it four youz with ez encypztions
def CaesarCypher(message,key,mode):
if (gcd(key,26)!=1):
print()
return
message=message.upper()
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
translated=''
for each in message:
if each in alphabet:
out = alphabet.find(each)
if mode == 'encrypt':
out = (out+key)%26
elif mode == 'decrypt':
out = (out-key)%26
else:
print("invalid mode. exiting.")
return
translated+=alphabet[out]
else:
translated+=each
print(translated)
an nowz i stepz it up jusz a lil bit (iz crypto cuz toullz you what isz english
def isEnglish(message, wordPercentage=20, letterPercentage=85):
#these next two functions are only needed for isEnglish, so I encapsulated them within their parent function to limit their scope
def parseEnglish(message):
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lettersOnly = []
for each in message:
if each in (alphabet + alphabet.lower() + ' \t\n'):
lettersOnly.append(each)
return ''.join(lettersOnly)
def countEnglish(message):
#loads the dictionary file
def loadDict():
File = open('/usr/share/dict/linux.words')
words = {}
for each in File.read().split('\n'):
words[each] = None
File.close()
return words
message = parseEnglish(message)
possibleEnglish = message.split()
if possibleEnglish == []:
return 0.0
matches = 0
for word in possibleEnglish:
if word in loadDict():
matches += 1
return float(matches) / len(possibleEnglish)
#below is body of parent isEnglish() function...
matched = countEnglish(message) * 100 >= wordPercentage
numLetters = len(parseEnglish(message))
percentage = float(numLetters) / len(message) * 100
letters = percentage >= letterPercentage
return matched and letters
now iz do what isz ez in python
def generateRSAKey(keySize):
print("generating two Mersenne primes...")
p1 = generateMersennePrime(keySize)
p2 = generateMersennePrime(keySize)
print("generating n=prime1*prime2")
n = p1 * p2
print("determining a number coprime to n..")
e = randrange(2 ** (keySize - 1), 2 ** (keySize))
while gcd(e, (p1 - 1) * (p2 - 1)) != 1:
e = randrange(2 ** (keySize - 1), 2 ** (keySize))
print("generating modular inverse of number coprime to n...")
d = ModInverse(e, (p1 - 1) * (p2 - 1))
publicKey = (n, e)
privateKey = (n, d)
print('Public key:', publicKey)
print('Private key:', privateKey)
return (publicKey, privateKey)
def generateMersennePrime(keysize=1024):
# Return a random prime number of keysize bits in size.
while True:
num = randrange(2**(keysize-1), 2**(keysize))
if isPrime(num):
return num
def isPrime(num):
def rabinMillerPrimalityTest(num):
s = num - 1
t = 0
while s % 2 == 0:
s = s // 2
t += 1
for trials in range(5):
a = randrange(2, num - 1)
v = pow(a, s, num)
if v != 1:
i = 0
while v != (num - 1):
if i == t - 1:
return False
else:
i = i + 1
v = (v ** 2) % num
return True
if (num < 2):
return False
lowPrimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
if num in lowPrimes:
return True
for prime in lowPrimes:
if (num % prime == 0):
return False
return rabinMillerPrimalityTest(num)
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5432
>>5431
isz forgotz gcd funztions withch is curzial to crypti mats
def gcd(a, b):
while a != 0:
a, b = b % a, a
return b
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5433
ifz anyonez has cruptocuurenzies for beerz i m aczepting paiments naow
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5434
>>5432
>>5431
Ha HAZ! I say, stupid is I to forgetz modular invertz funknkz! Bazisz of ayyy!simetric cryiptogriphy
def ModInverse(a, m):
# Returns the modular inverse of a % m
if gcd(a, m) != 1:
return
q1, q2, q3 = 1, 0, a
r1, r2, r3 = 0, 1, m
while r3 != 0:
q = q3 // r3 # // is the integer division operator
r1, r2, r3, q1, q2, q3 = (q1 - q * r1), (q2 - q * r2), (q3 - q * r3), r1, r2, r3
return q1 % m
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5436
>>5407
isz weakz and feabilminded only stronk can incript cripto
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5437
>>5407
>>5407
Litaraeeze ginerick fiszbusz
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5664
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5665
>>5664
Well that's boring, rolling again.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5686
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5687
>>5686
What is an incremental economy. Do I spawn the factors of production and let the system simulate a market.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5757
>>3529
>tfw I'm too inexperienced and helpless to be able to do any of these things
FML I need to get better.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5768
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5854
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5868
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5892
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5916
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5922
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5929
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5958
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5961
>>3530
how do you get the box?
#include <iostream>
using namespace std
int main()
{
cout << "test" << endl;
return 0;
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5962
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5969
| Rolled 13 (1d100) |
Rollan
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5974
>>3529
I'm not at this level. Is there a beginners version?
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5975
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5976
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.5977
>>5975
w='w=%r;print w%%w';print w%w
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6005
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6030
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6040
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6106
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6108
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6270
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6295
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6353
| Rolled 466, 302, 118, 471, 477, 312, 893, 384, 654, 603, 432, 10, 297, 120, 72, 926, 37, 322, 313, 493, 133, 263, 333, 839, 296, 65, 179, 393, 142, 1020, 151, 607, 298, 269, 54, 774, 580, 947, 133, 209, 525, 565, 219, 821, 684, 290, 723, 721, 611, 11, 189, 744, 274, 522, 559, 569, 587, 737, 962, 729, 732, 88, 312, 5, 356, 365, 778, 935, 288, 911, 120, 812, 452, 338, 609, 111, 627, 307, 832, 214, 318, 1021, 957, 591, 518, 491, 136, 80, 204, 73, 809, 935, 161, 96, 939, 517, 461, 693, 428, 748, 580, 547, 535, 7, 884, 120, 117, 487, 427, 949, 700, 744, 945, 633, 311, 438, 99, 447, 518, 302, 519, 302, 213, 679, 398, 127, 171, 858, 820, 598, 581, 375, 121, 92, 381, 1004, 211, 498, 467, 638, 422, 142, 357, 342, 775, 668, 780, 873, 90, 273, 151, 609, 575, 363, 264, 972, 490, 434, 805, 286, 8, 362, 660, 128, 453, 17, 108, 664, 514, 574, 278, 936, 716, 635, 253, 467, 278, 8, 316, 368, 281, 466, 976, 856, 829, 215, 803, 295, 649, 584, 581, 657, 946, 216, 785, 375, 233, 892, 15, 746 = 93454 (200d1024) |
ok
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6373
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6777
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6807
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6831
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6834
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6836
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6838
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6852
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6880
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6917
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6946
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.6947
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7009
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7015
>>3529
Rollin my /g/ bois.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7053
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7061
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7062
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7063
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7064
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7065
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7067
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7092
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7093
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7094
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7210
>>3529
Reverse a string pls
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7211
>>3529
Somebody write a program which randomly generates a possible title for a porn video.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7221
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7228
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7229
>>7228
I'm a fucking genius.
import sys
def fib(n):
if n == 1:
return 1
if n == 2:
return 2
return fib(n - 1) + fib(n - 2)
print(fib(int(sys.argv[1])))
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7260
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7270
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7278
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7279
>>7229
This is a joke, right?
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7288
>>7229
>I’m a genius
>writes basic fibonacci function
Okay
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7302
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7305
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7320
>>3529
Post the newest version nigger. Also rolling for easy shit.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7324
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7348
>>7270
oh shit, it's cellino and barnes, representing buffalo new york for the last 79 years
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7489
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7490
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7491
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7492
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7502
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7511
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7934
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7991
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7994
I don't do line numbers because who cares
'HighLow
[start]
i = INT(21*RND(1))
guess = i
cls
[input]
input "Enter your guess from 1 to 20. Type 0 to display the answer: ";answer
if answer = 0 then [print] else [first]
[first]
if answer = guess then [correct] else [check]
[check]
if answer > guess then
Print "Too high, try again: "
goto [input]
end if
if answer < guess then
Print "Too low, try again: "
goto [input]
end if
[correct]
Print "Nice job!"
goto [prompt]
[prompt]
input "Play again? [y/n] ";playagain$
if playagain$ = "y" then [start] else [exit]
[print]
print i
goto [prompt]
[exit]
print "Goodbye"
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.7996
>>7994
A shitty gif of it in action, but considering that its the first one of these I've ever done, I think it looks ok. Not sure where I can cut anything out of it anyways.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8006
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8017
I'm functionally retarded and struggling to pull together a functioning excel-based ledger system using VBA
lets try this
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8025
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8044
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8046
>>3529
Roll roll roll roll
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8051
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8052
| Rolled 19 (1d100) |
Rollin'
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8068
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8072
>>3529
Let this be a good roll, I haven't programmed anything in a month and a half, I have no inspiration or motivation whatsoever...
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8073
>>8072
Uh huh, that's kind of easy, but to make it little more challaging, I'll reinvent the wheel...
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8087
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8123
>>3529
without deadline i'm not going to make it anyway
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8135
>>3529
I might regret this, but rolling.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8136
>>8135
[code]
#include <iostream>
#include <cmath>
using namespace std;
//Benfords Law
int main()
{
int digit;
double answer;
cin >> digit;
if (digit < 10 && digit > 0)
{
answer = log10(digit + 1) - log10(digit);
answer = answer * 100;
cout << answer;
}
else cout << "fuk off ya cheeky cunt";
}
[code/]
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8144
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8266
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8267
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8268
| Rolled 85 - 1 (1d100) |
aaa
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8269
>>8266
>fucking klingon translator
i was thinking about just sending input off to google translate and spitting out its output, but then i saw no "klingon" option anymore ;_;
i'm not about to spend time compiling a klingon dictionary just to create a map function. reroll
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8272
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8283
>>8269
fuccin done finally lol
could have done this in a couple minutes in GameMaker, but i want to get into "real programming" so i used C++ and SDL2.
https://gitgud.io/cptchuckles/graphical-clock.git
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8285
| Rolled 15 (1d99) |
>>8283
Alright time to do some fuckin battleships in SFML. Rolling for next project as well.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8296
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8298
>>3529
rolling rolling rolling. Lets go c++
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8299
>>8298
this is what i got
#include <iostream>
#include <string>
int factorial(unsigned long number){ //yay recursion
if(!number)
return 1;
else
return number * factorial(number-1);
}
int main(int argc, char* argv[])
{
unsigned long factor;
std::cin >> factor;
if(factor < 0){
std::cout << "factor was smaller than 0 s" << factor << std::endl;
exit(2);
}
if(factor > 4294967294){
std::cout << "input over flow " << factor << std::endl;
exit(3);
}
std::cout << factorial(factor) << std::endl;
return 0;
}#include <iostream>
#include <string>
int factorial(unsigned long number){ //yay recursion
if(!number)
return 1;
else
return number * factorial(number-1);
}
int main(int argc, char* argv[])
{
unsigned long factor;
std::cin >> factor;
if(factor < 0){
std::cout << "factor was smaller than 0 s" << factor << std::endl;
exit(2);
}
if(factor > 4294967294){
std::cout << "input over flow " << factor << std::endl;
exit(3);
}
std::cout << factorial(factor) << std::endl;
return 0;
} //this took longer than needed to make cause i facking wanted command line input but i dropped it in the end
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8300
>>8299
fuck i double copied this shit. well ROLLL
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8301
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8302
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8303
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8310
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8311
Python is so useful
[
import random
subjects = {1:"Cats", 2:"Niggers", 3:"Chinks", 4:"Crackers", 5:"I"}
verbs = {1:" eat", 2:" hit", 3:" shot", 4:" raped", 5:" stabbed"}
second_noun = {1:" bongs.", 2:" pipes.", 3:" pussy.", 4:" that vidya."}
print(subjects[random.choice(list(subjects.keys()))] + verbs[random.choice(list(verbs.keys()))] + second_noun[random.choice(list(second_noun.keys()))])
]
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8312
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8313
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8340
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8381
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8385
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8412
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8415
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8422
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8423
>>8422
boring.
rolling again.
weight = float(input('weight: '))
height = float(input('height (inches): '))
bmi = float((weight / height**2) * 703)
if bmi < 19:
print("underweight")
elif bmi > 19 and bmi < 25:
print ("normal")
elif bmi > 25 and bmi < 30:
print("overweight")
elif bmi >= 30:
print("obese")
print("BMI: " + str(round(bmi,2)))
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8434
>>8423
ok, what's next
import re
import requests
from bs4 import BeautifulSoup
thread_id = 68523241
thread = str(thread_id)
r = requests.get('http://boards.4chan.org/g/thread/' + thread)
soup = BeautifulSoup(r.text, 'html.parser')
posts = soup.find_all('a', {"class": "fileThumb"})
for a in posts:
img_url = a['href'].replace('//', '')
f = re.search('\/(\d+.(jpg|png|gif|webm))', img_url)
filename = f.group(1)
img_data = requests.get('http://' + img_url).content
with open(filename, 'wb') as handler:
handler.write(img_data)
print('[+] Downloading image @ URL: ' + img_url)
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8436
>>8434
>34
too hard vro. will come back to it.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8439
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8440
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8441
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8448
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8468
>>8285
Battleships is finally fuckin done.
- AI shoots randomly until it finds a cold hit.
- Then AI checks adjacent cells for the next hit.
- Then AI follows that direction until it finds a miss or the edge of the board.
- Then AI returns to the original cold hit and checks the rest of the adjacencies in case it had hit in the middle of the ship.
- Once all cells adjacent to the original cold hit have been checked, the AI resumes random strikes.
https://gitgud.io/cptchuckles/g-battleships.git
i'll paste main.cpp here for shits and giggles:
/**
* /g/ Coding challenge: Battleships with AI
*/
#include <SFML/Graphics.hpp>
#include "Board.h"
#include "AIController.h"
#include "InputPrompt.h"
#include "ShipBuilder.h"
#include "KeyInput.h"
const int WindowWidth = 640;
const int WindowHeight = 1508;
enum class GameState {
SETUP,
PLAY,
END
};
GameState state = GameState::SETUP;
sf::RenderWindow window = {
sf::VideoMode(WindowWidth, WindowHeight),
"/g/ battleships"
};
sf::Font arial;
sf::Text caption = {"aeiou", arial, 48U};
InputPrompt prompt = {"wew lads", caption, 0,1424};
sf::CircleShape open{32};
sf::CircleShape full{32};
sf::CircleShape miss{32};
sf::CircleShape hit{32};
Board board_1{64, 9,10, 64,64, open, full, miss, hit};
Board board_2{64, 9,10, 64,770, open, full, miss, hit};
AIController ai = {board_2, 2};
std::vector<IDrawable*> renderer;
bool init();
void gameReset();
void gameSetup();
void buildEnemyShips();
void inPlay();
void enemyTurn();
void atEndScreen();
int main()
{
if(! init()) return 1;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
KeyInput::Get().Update();
switch(state)
{
case GameState::SETUP :
gameSetup();
break;
case GameState::PLAY :
inPlay();
break;
case GameState::END :
atEndScreen();
break;
}
for(auto item : renderer) item->Draw(window);
window.display();
}
return 0;
}
bool init()
{
window.setFramerateLimit(60);
if(! arial.loadFromFile("c:/windows/fonts/arial.ttf"))
return false;
open.setFillColor(sf::Color::Blue);
full.setFillColor(sf::Color{128,128,128,255});
miss.setFillColor(sf::Color::White);
hit.setFillColor(sf::Color::Red);
board_1.SetDisplayResource(&caption);
board_2.SetDisplayResource(&caption);
board_1.SetHidden(true);
renderer.push_back(&board_1);
renderer.push_back(&board_2);
renderer.push_back(&prompt);
return true;
}
void gameReset()
{
board_1.Clear();
board_1.SetHidden(true);
board_2.Clear();
prompt.ClearInput();
state = GameState::SETUP;
}
void gameSetup()
{
prompt.SetCaption("Arrows, space, & return");
static ShipBuilder* builder = nullptr;
static int ships = 4;
int shipSizes[] = {2,3,3,4,5};
if(! builder) builder = new ShipBuilder{board_2};
if(! builder->GetShip()) builder->ConstructShip(shipSizes[ships]);
builder->Update();
builder->DrawBoard(window);
if(KeyInput::Get().Return())
{
if(builder->FinalizeShip())
ships--;
if(ships < 0)
{
ships = 4;
delete builder;
builder = nullptr;
buildEnemyShips();
state = GameState::PLAY;
}
}
}
void buildEnemyShips()
{
int shipSizes[] = {2,3,3,4,5};
ShipBuilder builder = {board_1};
for(int i=0; i<5; i++)
builder.RandomShip(shipSizes[i]);
}
void inPlay()
{
if(ai.isMyTurn()) {
enemyTurn();
return;
}
prompt.SetCaption("Try cell: ");
prompt.Update();
if(KeyInput::Get().Return())
{
auto cell = board_1.GetCellFromString(prompt.GetContent());
prompt.ClearInput();
if(! cell) return;
board_1.Attack(cell.value());
if(board_1.CheckDefeated()) {
prompt.SetCaption("You Win! Again? (y/n): ");
state = GameState::END;
return;
}
ai.ActivateTurn();
}
}
void enemyTurn()
{
prompt.SetCaption("Enemy AI thinking...");
if(ai.Strike()) {
if(board_2.CheckDefeated()) {
prompt.SetCaption("You Lost! Again? (y/n): ");
state = GameState::END;
}
}
}
void atEndScreen()
{
board_1.SetHidden(false);
prompt.Update();
if(KeyInput::Get().Return())
{
auto answer = prompt.GetContent();
if(answer=="Y")
gameReset();
else if(answer=="N")
window.close();
}
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8477
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8508
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8510
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8511
Probs a good thing to do some C again, currently doing node at work, FML.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8512
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8523
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8633
>>8512
Don't talk shit about my waifu.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8644
>>3529
Rolling for fizzbuzz
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8646
>>8644
>>8645
Nevermind, I looked at the wrong numbers.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8651
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8658
>>8644
uint64_t factorial(uint8_t ofNumber)
{
if (ofNumber <= 1)
{
return 1;
}
return ofNumber * factorial(ofNumber - 1);
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8883
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8884
>>8468
>>8285
Seriously, counting this as a re-roll for >>8883 as two other people have already done this...
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8887
<iframe width="560" height="315" src="https://www.youtube.com/embed/S-J1Pj8FC_A" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8903
>>3529
rng-sama give me a good one
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8904
>>8903
def age(years):
return(years*365.2422*24*60*60)
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8916
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8927
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8929
>>3529
Rollin cause I'm borred
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8951
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.8952
>>8951
Holy fuck I got game of life? That's a baby program. Fuck the rules. Reroll.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9080
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9130
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9141
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9144
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9148
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9178
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9179
>>9178
Too tired to write a path finding system before bed.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9214
#Magic 8 ball (a bit lazy...)
import random
x = random.randint(0, 19)
Answers = ["It is certain.",
"It is decidedly so.",
"Without a doubt.",
"Yes - definitely.",
"You may rely on it.",
"As I see it, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful."]
Question = input("Ask away! ")
print(Answers[x])
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9215
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9224
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9240
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9307
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9311
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9312
>>9311
I did it in shell.
base64 < /dev/urandom | head -c 16
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9333
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9343
>>3529
great idea anon. rolling
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9359
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9360
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9362
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9365
Pretty comprehensive BMI calculator I made. Both metric and inferior
http://youtuberips.tk/bmi/
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9367
>>9365
> .tk
Careful with those free domain names. They've been known to get hijacked after a while.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9368
>>7994
Nigga why the fuck you writing it in bash? That's gay af, like at least use python or don't be a deadass and use C
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9369
Holdup I already made rock paper scissors
http://youtuberips.tk/rps/
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9370
>>9367
They're a year for free so I can't decline. I'm not fucking paying for a joke website.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9697
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9714
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9715
>>9714
public static void Main(string[] args)
{
Console.WriteLine("Ask me a question.");
var rand = new Random();
var question = Console.ReadLine();
var answers = new List<string> {"Yes", "No", "You lost the game"};
Console.WriteLine($"Thinking about the answer to {question}...");
Thread.Sleep(1000);
Console.WriteLine(answers.OrderBy(item => rand.Next(answers.Count)).FirstOrDefault());
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9723
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9727
>>3529
rolling just because
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9740
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9787
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9825
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9883
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9896
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9904
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.9940
Rollin. Have some pics; hope to write this in a few weeks' time
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10014
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10134
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10156
>>3529
i will do it no matter what
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10223
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10579
>>4849
It's called recursion and lots of good programmers do it. It's good practice for short (20-30 lines MAX) fucntions.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10580
>>3529
Rol but also gite and gcc
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10581
>>10580
Can't find list of codes, reroll.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10596
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10597
Fire up the stack after a full night's day of vodka, meth, and pcp? Haha, no. Rolling.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10598
>>9715
is using Console.WriteLine and Console.ReadLine faster than just using a scanner?
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10604
>>3530
Aw, lucky you! You got an easy one. My turn.
Roll, but since I am not a professional programmer, if it's too hard for me I won't to it or I'll do it after a lot of time. Here we go!
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10605
>>10604
[code]/* I will use the one time pad encryption method. It's the most secure if you use it properly.*/
#include <stdio.h>
#include <stdlib.h>
void usage()
{
fprintf(stderr, "Usage: otp <key_file>\n");
exit(EXIT_FAILURE);
}
int main(int argc, char **argv)
{
int ch, ch2;
FILE *key;
if(argc != 2) usage();
key = fopen(argv[1], "r");
if(!key)
{
perror(argv[1]);
exit(EXIT_FAILURE);
}
while((ch = getchar()) != EOF)
{
ch2 = getc(key);
if(ch2 == EOF) break;
putchar(ch ^ ch2);
}
fclose(key);
exit(EXIT_SUCCESS);
}
/* Now you can use this program like this:
./otp key_file < plaintext.txt > cyphertext.enc
*/
[code]
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10608
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10625
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10692
Rollin rollin rollin, keep this shit on goin
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10715
>>10692
I had no idea what 92 is so I made blackjack instead. Here it is please bully code as I want to get better.
https://pastebin.com/aRBJ7PbY
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10739
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10756
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10846
>>10625
Well, shit. The board is back so I guess I better finally do this.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10873
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10899
roll
>>3529
moderation should activate cycling mode on this thread btw
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10915
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10916
>>10915
https://bpaste.net/K5PA
Done (only works for ints and I don't sanitize input, but whatever)
Might do it in Haskell later, can't wait for my FP course.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10974
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10975
>>10974
[code]
factorial :: Int -> Int
factorial !n = foldl (\!x !y -> (*) x $! y) 1 [1..n]
[\code]
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10976
>>10975
BO FAGGOT ENABLE [code] TAGS NOW
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10978
>>10976
there's no option in board settings that'll fix you not knowing which slash to use.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.10982
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11010
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11015
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11019
>>11015
No. 15, the Collatz conjecture. Not posted code on a []chan for a while, hope that simple markup tags work...
(defun collatz (n)
(if (= (mod n 2)
0)
(/ n 2)
(+ (* 3 n)
1)))
(defun collatz-recurs (n &optional (show nil))
(when show (format t "~A~%" n))
(let* ((next (collatz n)))
(if (eq next 1)
1
(collatz-recurs next show))))
I'm struck by how slowly the number of ops grows as you increase the size of the input.
CL-USER> (time (collatz-recurs 999))
Evaluation took:
0.000 seconds of real time
0.000010 seconds of total run time (0.000009 user, 0.000001 system)
100.00% CPU
18,176 processor cycles
0 bytes consed
1
CL-USER> (time (collatz-recurs (1- (expt 10 40))))
Evaluation took:
0.001 seconds of real time
0.000431 seconds of total run time (0.000400 user, 0.000031 system)
0.00% CPU
1,070,065 processor cycles
131,024 bytes consed
1
CL-USER>
40 orders of magnitude difference in input, 1 and a half orders of magnitude difference in processor cycles. Huh. Guess that's O(log(n)) for you... Or is it? That's the whole point of the conjecture, I suppose.
A fun little diversion. Thanks, /g/entooman!
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11020
>>4849
Yeah. There are a few conceptual leaps that really help when you're starting out. It's why people recommend reading books like SICP, and working in various paradigms. Broad knowledge gives you a solid foundation to work on-
....oh, and you wrote this in 2016. I didn't even look. Fuck, man. Hope you've gotten used to recursion since then
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11036
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11052
>>3530
>not dynamically programmed
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11118
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11155
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11156
>>11155
i don't know what RPN is and it's probably gay so I made heads/tails in the best language
function flip() {
var x = Math.round(Math.random())
if (x == 0) return 'heads'; else return 'tails';
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11159
>>11156
Your code is gay, here's a less gay version:
function flip() {
return ( Math.round(Math.random()) ) ? 'tails' : 'heads';
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11162
>>11159
> using bloated white spaces
function flip(){return Math.round(Math.random())?"tails":"heads"}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11164
>>11162
What is this, 2019? No self respecting javaship programmer ever types the word "function" anymore.
let flip=()=>{return Math.round(Math.random())?"tails":"heads"}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11178
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11273
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11274
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11278
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11305
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11308
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11309
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11310
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11311
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11312
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11313
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11314
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11315
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11316
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11317
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11323
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11324
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11325
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11347
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11401
>>3529
rollin rollin rollin
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11406
>>11401
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main(void) {
int toss = 0;
int call = 0;
srand(time(NULL));
toss = rand() % 2;
printf("Say head or tail! press 0 for head and 1 for tail:");
scanf("%d", &call);
if(call==0 || call==1)
{
if(toss == call)
{
if(toss==1)
printf("You called it correctly ... it is tailn");
else
printf("You called it correctly ... it is headn");
}
else
{
if(toss==1)
printf("No way ...it is head !n");
else
printf("No way ... it is tail!n");
}
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11409
>>11406
>scanf
never ever.
#! /usr/bin/env ijconsole
9!:1 >.*:+/6!:0'' NB. seed from sub-second time
usage =: 3 : 0
stderr 'usage: ', (>1 } ARGV), ' <heads|tails>', LF
exit 1
)
toss =: ?2
ohno =: 'No way' ; 'You called it correctly'
itis =: '... it is heads' ; '... it is tails'
right =: toss = 'tails' -: >(2 } :: usage) ARGV
echo (> right { ohno), (> right { itis)
exit 0
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11410
>>11409
then what? first time using C
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11411
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11425
>>11411
this is my first c program so bear with me...couldnt get a int value from newline or convert the string to int, kept getting seg faults
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11433
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11440
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11477
>>3529
rolling
no gay shit pls
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.11509
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.12015
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.12020
Guess I'll roll, depending on what I get I will post code.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.12044
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.12045
>>12020
>Guess I'll roll, depending on what I get I will post code.
I intended to post code, but ended up satisfied enough with it that I put it in my git repo instead.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.12070
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.12334
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.12475
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13028
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13029
local limit = ({...})[1]
assert(tonumber(limit), "Usage: fib (nth number)")
limit = tonumber(limit)
assert(limit > -1, "Only non negative numbers")
if limit == 0 or limit == 1 then
print "1"
return
end
local a = 1 --0th fib number
local b = 1 --1st fib number
local c
for i=1, limit-1 do
c = a+b
a = b
b = c
end
print(tostring(b))
Language: lua
Assumes 0th fib number is 1, 1st fib number is 1
I rolled 28, yes :/
can I help someone with their challenge?
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13030
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13040
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13041
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13046
>>13041
Python ez solution with sdl.
You will need:
pip install PySDL2
code:
https://pastebin.com/L1TEfWNU
use arrow keys to move
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13047
>>11409
>scanf never ever
scanf is fine as long as you're aware of the trailing newline. And what is getline and why does it exist when we have fgets
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13048
>>13047
may as well count that one as a roll
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13075
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13078
>>10605
Your code is vulnerable to stack buffer overflow.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13081
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13082
>>13081
already done, roll again
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13083
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13098
>>13078
Not my code, but I don't see it. He doesn't buffer anything, and only processes input a single character at a time.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13100
>>3529
Ready to get cucked by the programming god.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13109
>89 Sine wave generator from pseudorandom numbers
Why in the fuck would you do that. Maybe this is poorly worded and they mean is make a prg with a sinusoidal output, but if you want to make a sine wave generator you sure as hell shouldn't be using random numbers.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13110
>>13109
>if you want to make a sine wave generator you sure as hell shouldn't be using random numbers.
Nope. A white noise generator, perhaps.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13111
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13114
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13328
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13329
>>13328
//Fib Generator
//Generates 1st - ith fibonaci numbers
#include<stdlib.h>
#include<stdio.h>
int main(int argc, char **argv){
// printf("%d", argc);
//check for valid number of arguements
if(argc != 2)
{
printf("Error must specify exactly one interger argument\n");
return 1;
}
//convert str argument to int
//atoi() used here because 0 is not conidered a valid output
int numTerms = atoi(argv[1]);
//printf("%d\n", term);
//check if valid input
if(numTerms < 1)
{
printf("Error, input must be a valid positive interger.\n");
return 2;
}
long last = 0;
long current = 1;
long temp;
int i;
//iterative fibonacci addition
for(i=0; i<numTerms; i++)
{
printf("%d: %ld\n", (i+1), current);
temp = current;
current+=last;
last = temp;
if(current < 0)
{
//print message if addtion overflow
printf("Overflow has occured.\n");
break;
}
}
return 0;
}
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.13340
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.14022
Thanks for the information.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.14025
Thank you for sharing these exercises and for the recommendations of the services. I am currently busy writing a letter of recommendation and I have had difficulties. I decided to buy a recommendation letter because I have to be sure that it will be written well.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.14026
Thank you for sharing these exercises and for the recommendations of the services. I am currently busy writing a letter of recommendation and I have had difficulties. I decided to buy a recommendation letter https://www.lorservice.com/ because I have to be sure that it will be written well.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.14032
Some exercises are quite difficult to perform without qualified help. That's why I always have uk essay writing service https://www.brillassignment.co.uk/essay-writing-services/ handy where I can ask for help with any academic assignment. And I know that the work will be written qualitatively and in time convenient for me.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.14436
Recognized for excellence among https://www.vpsecurityguards.com/county-los-angeles/long-beach-security-guard/, VP Security Guards is led by a team of military and law enforcement professionals. We provide customized solutions with armed and unarmed guards, specializing in fire watch and industrial site security.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.