Skip to content
Open navbar menu
Sign UpLog In
Profile icon

Emily Ye

@EmilyYe4
Discord - Iamety1318#8812
  • Snake Kaboom

    Cover page
    Made with Kaboom

    Its a simple Snake game in Kaboom.js

    Recent comments (2)
    PotatoIsMe
    PotatoIsMe
    2 years ago

    its not loading for me

EmilyYe4
EmilyYe4
published an Update
2 years ago
0
Livestock Lineup
Livestock Lineup
I need a simpler version
Quick, i need a simple version of this code: import java.util.*; import java.io.*; public class Main { final public static String[] COWS = {"Beatrice", "Belinda", "Bella", "Bessie", "Betsy", "Blue", "Buttercup", "Sue"}; public static int n; public static int list; public static void main(String[] args) throws Exception { HashMap map = new HashMap(); for (int i=0; i<COWS.length; i++) map.put(COWS[i], i); Scanner stdin = new Scanner(new File("lineup.in")); n = stdin.nextInt(); list = new intn; for (int i=0; i<n; i++) { listi = map.get(stdin.next()); System.out.println(listi); for (int j=0; j<4; j++) stdin.next(); listi = map.get(stdin.next()); System.out.println(listi); } int[] perm = new int[COWS.length]; boolean[] used = new boolean[COWS.length]; go(perm, used, 0); PrintWriter out = new PrintWriter(new FileWriter("lineup.out")); for (int i=0; i<COWS.length; i++) out.println(COWS[perm[i]]); out.close(); stdin.close(); } public static boolean go(int[] perm, boolean[] used, int k) { if (k == perm.length) return valid(perm); for (int i=0; i<perm.length; i++) { if (!used[i]) { perm[k] = i; used[i] = true; boolean tmp = go(perm, used, k+1); if (tmp) return true; used[i] = false; } } return false; } public static boolean valid(int[] perm) { int[] indexOf = new int[perm.length]; for (int i=0; i<perm.length; i++) indexOf[perm[i]] = i; for (int i=0; i<n; i++) if (Math.abs(indexOflist[i]-indexOflist[i]) != 1) return false; return true; } }
EmilyYe4
EmilyYe4
published an Update
2 years ago
0
Question
My java teacher gave me this question- The following program returns the right result for test data 1 and 2 -- however wrong result for test data 3 , 4 .... Try to test on more data, find the bug and fix it---- public class Main { public static int comp(int a, int b) { if(a >= b) return 1; else return -1; } public static void main(String[] args) { int k = 2; int N = 20; int consistent = 0; int P = { {11, 16, 4, 17, 12, 18, 6, 3, 19, 14, 1, 8, 13, 9, 2, 20, 5, 15, 10, 7}, {4, 20, 18, 17, 14, 11, 19, 3, 10, 16, 6, 8, 13, 9, 2, 12, 5, 7, 1, 15} }; //int P = { {7, 4, 5, 1, 9, 10, 11, 15, 14, 18, 13, 19, 16, 2, 6, 17, 8, 12, 20, 3}, // {7, 2, 14, 1, 20, 15, 8, 6, 5, 18, 13, 19, 16, 10, 4, 17, 3, 12, 9, 11}, // {13, 2, 14, 1, 9, 19, 11, 18, 5, 15, 7, 6, 12, 4, 20, 17, 3, 16, 10, 8}, // {18, 2, 17, 9, 19, 6, 11, 15, 5, 7, 13, 1, 16, 4, 10, 14, 3, 20, 12, 8}, // {7, 2, 14, 1, 12, 11, 15, 6, 5, 18, 9, 19, 16, 4, 10, 17, 3, 13, 20, 8} }; for(int i = 0; i < N-1; i++) { for(int j = i+1; j < N; j++) { int sum = 0; for(int r = 0; r < k; r++) { sum += comp(Pr, Pr); } if (sum == k || sum == -2 ) consistent=consistent+1; System.out.println("cow " + i + " and cow " + j + " is consistent"); } } System.out.println("The number of consistent pairs are: " + consistent); } } Can anyone help me?
EmilyYe4
EmilyYe4
published a Repl
2 years ago
5
Snake Kaboom
Snake KaboomIts a simple Snake game in Kaboom.js
PotatoIsMe
PotatoIsMe
its not loading for me 2 years ago
EmilyYe4
EmilyYe4
shared a Post
2 years ago
len(word) error. Im creating hangman btw
MrVoo
MrVoo
You forgot to concatenate them, replace that line with wordcompletion = '' + len(word)2 years ago
EmilyYe4
EmilyYe4
published a Repl
2 years ago
0
Word&Letter Counter
Word&Letter CounterA Code That Couts Words And Letters/Numbers
EmilyYe4
EmilyYe4
published a Repl
2 years ago
0
Calculator
CalculatorA Calculator In Java!
EmilyYe4
EmilyYe4
shared a Post
2 years ago
#java
#counting
A code that counts how many words and letters in a sentence or word you type. You can also change the background and text colors.
Word&Letter Counter
Java
EmilyYe4
EmilyYe4
shared a Post
2 years ago
A Calculator In Java(and mind I have Grammarly on and it's changing everything I write. kinda annoying)
Calculator
Java
EmilyYe4
EmilyYe4
shared a Post
2 years ago
Help I cant fix error. guesses.append(guesses.lower()) line 16
Hangman1
Python
ruiwenge2
ruiwenge2
you are trying to make the guess list lower cased, which is isn’t possible. It only works with strings2 years ago