Skip to content

Commit

Permalink
Merge pull request #5 from goseind/clean_prod
Browse files Browse the repository at this point in the history
align screens and lint code
  • Loading branch information
goseind authored Nov 13, 2023
2 parents 3d7d881 + bd368f1 commit f5c284c
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 42 deletions.
1 change: 0 additions & 1 deletion kryptolearn/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

Expand Down
5 changes: 4 additions & 1 deletion kryptolearn/algorithms.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export function extendedEuclid(a, b) {
let xs = [1, 0];
let ys = [0, 1];
let sign = 1; // relevant for minus 1
let x;
let y;

while (b != 0) {
const q = Math.floor(a / b);
Expand Down Expand Up @@ -47,7 +49,8 @@ export function precrt(m) {
let bigM = [];
bigM[0] = 1;
let y = [];

let ee;

for (let i = 0; i < m.length; i++) {
bigM[0] = bigM[0] * m[i];
console.log(`BigM ${bigM}`);
Expand Down
4 changes: 2 additions & 2 deletions kryptolearn/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"expo": {
"name": "Krypto Learn",
"slug": "kryptolearn",
"version": "1.0.1",
"version": "1.0.2",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
Expand All @@ -18,7 +18,7 @@
"supportsTablet": true
},
"android": {
"versionCode": 2,
"versionCode": 3,
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#586576"
Expand Down
63 changes: 37 additions & 26 deletions kryptolearn/screens/crt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import {
SafeAreaView,
StyleSheet,
TextInput,
Button,
Text,
ScrollView,
StatusBar,
Pressable,
} from 'react-native';
import { crt } from '../algorithms';

Expand All @@ -27,27 +26,28 @@ const ChineseRemainderTheorem = () => {

return (
<SafeAreaView style={styles.container}>
<SafeAreaView style={styles.containerr}>
<Text style={styles.description}>
Chinesischer Restsatz als Lösungsverfahren bei gleichzeitiger
Kongruenz. Gib mehrere durch Komma getrennte Module und die
zugehörigen Reste ein, um die unbekannte Summe zu berechnen.
</Text>
<TextInput
style={styles.input}
onChangeText={setM}
placeholder="Nenne die Module m1, m2, .., mn (kommagetrennt)"
keyboardType="numeric"
/>
<TextInput
style={styles.input}
onChangeText={setA}
placeholder="Nenne die Reste a1, a2, .., an (kommagetrennt)"
keyboardType="numeric"
/>
</SafeAreaView>
<Text style={styles.description}>
Chinesischer Restsatz als Lösungsverfahren bei gleichzeitiger Kongruenz.
Gib mehrere durch Komma getrennte Module und die zugehörigen Reste ein,
um die unbekannte Summe zu berechnen.
</Text>
<TextInput
style={styles.input}
onChangeText={setM}
placeholder="Nenne die Module m1, m2, .., mn (kommagetrennt)"
keyboardType="numeric"
/>
<TextInput
style={styles.input}
onChangeText={setA}
placeholder="Nenne die Reste a1, a2, .., an (kommagetrennt)"
keyboardType="numeric"
/>

<Pressable style={styles.button} onPress={handleClick}>
<Text style={styles.buttontext}>{'Berechne die Summe'}</Text>
</Pressable>

<Button onPress={handleClick} title="Berechne die Summe" />
<ScrollView>
<Text style={styles.output}>Schritte:</Text>
{steps.map((step, index) => (
Expand All @@ -67,15 +67,26 @@ const styles = StyleSheet.create({
container: {
flex: 1,
},
containerr: {
flex: 1,
//flexDirection: 'row',
button: {
alignItems: 'center',
justifyContent: 'center',
paddingVertical: 5,
paddingHorizontal: 7,
borderRadius: 4,
elevation: 3,
backgroundColor: 'royalblue',
margin: 3,
},
buttontext: {
fontSize: 12,
lineHeight: 21,
letterSpacing: 0.25,
color: 'white',
},
description: {
padding: 10,
},
input: {
flex: 1,
height: 40,
margin: 12,
borderWidth: 1,
Expand Down
30 changes: 26 additions & 4 deletions kryptolearn/screens/euclid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import {
SafeAreaView,
StyleSheet,
TextInput,
Button,
Text,
ScrollView,
StatusBar,
Pressable,
} from 'react-native';
import { Euclid } from '../algorithms';

Expand All @@ -25,7 +24,7 @@ const EuclideanAlgorithm = () => {

return (
<SafeAreaView style={styles.container}>
<Text>
<Text style={styles.description}>
Der euklidische Algorithmus dient zur Berechnung des größten gemeinsamen
Teilers zweier natürlicher Zahlen und gilt als sehr effizient. Gib zwei
natürliche Zahlen ein und drücke auf berechnen, um dir die Schritte des
Expand All @@ -43,7 +42,11 @@ const EuclideanAlgorithm = () => {
placeholder="Nenne eine Zahl b"
keyboardType="numeric"
/>
<Button onPress={handleClick} title="Berechne den ggT(a, b)" />

<Pressable style={styles.button} onPress={handleClick}>
<Text style={styles.buttontext}>{'Berechne den ggT(a, b)'}</Text>
</Pressable>

<ScrollView>
<Text style={styles.output}>Schritte:</Text>
{steps.map((step, index) => (
Expand All @@ -61,6 +64,25 @@ const styles = StyleSheet.create({
container: {
flex: 1,
},
button: {
alignItems: 'center',
justifyContent: 'center',
paddingVertical: 5,
paddingHorizontal: 7,
borderRadius: 4,
elevation: 3,
backgroundColor: 'royalblue',
margin: 3,
},
buttontext: {
fontSize: 12,
lineHeight: 21,
letterSpacing: 0.25,
color: 'white',
},
description: {
padding: 10,
},
input: {
height: 40,
margin: 12,
Expand Down
33 changes: 26 additions & 7 deletions kryptolearn/screens/extendedEuclid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import {
SafeAreaView,
StyleSheet,
TextInput,
Button,
Text,
ScrollView,
StatusBar,
Pressable,
} from 'react-native';
import { extendedEuclid } from '../algorithms';

Expand All @@ -24,7 +23,7 @@ const ExtendedEuclideanAlgorithm = () => {

return (
<SafeAreaView style={styles.container}>
<Text>
<Text style={styles.description}>
Der erweiterte euklidische Algorithmus kann zwei Zahlen x und y
berechnen, sodass ggt(a, b) = ax + by. Gib zwei natürliche Zahlen ein
und drücke auf berechnen, um dir die Schritte des Algorithmus zeigen zu
Expand All @@ -42,10 +41,11 @@ const ExtendedEuclideanAlgorithm = () => {
placeholder="Nenne eine Zahl b"
keyboardType="numeric"
/>
<Button
onPress={handleClick}
title="Berechne Zahlen x und y zu a und b"
/>

<Pressable style={styles.button} onPress={handleClick}>
<Text style={styles.buttontext}>{'Berechne Zahlen x und y zu a und b'}</Text>
</Pressable>

<ScrollView>
<Text style={styles.output}>Schritte:</Text>
{steps.map((step, index) => (
Expand All @@ -66,6 +66,25 @@ const styles = StyleSheet.create({
container: {
flex: 1,
},
button: {
alignItems: 'center',
justifyContent: 'center',
paddingVertical: 5,
paddingHorizontal: 7,
borderRadius: 4,
elevation: 3,
backgroundColor: 'royalblue',
margin: 3,
},
buttontext: {
fontSize: 12,
lineHeight: 21,
letterSpacing: 0.25,
color: 'white',
},
description: {
padding: 10,
},
input: {
height: 40,
margin: 12,
Expand Down
1 change: 0 additions & 1 deletion kryptolearn/screens/start.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
Button,
View,
Text,
SafeAreaView,
Expand Down

0 comments on commit f5c284c

Please sign in to comment.