Skip to content

Commit

Permalink
align screens and lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
goseind committed Nov 13, 2023
1 parent 3d7d881 commit 76e8286
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 22 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
28 changes: 19 additions & 9 deletions kryptolearn/screens/crt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import {
SafeAreaView,
StyleSheet,
TextInput,
Button,
Text,
ScrollView,
StatusBar,
} from 'react-native';
import { crt } from '../algorithms';

Expand All @@ -27,7 +25,6 @@ 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
Expand All @@ -45,9 +42,11 @@ const ChineseRemainderTheorem = () => {
placeholder="Nenne die Reste a1, a2, .., an (kommagetrennt)"
keyboardType="numeric"
/>
</SafeAreaView>

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

<ScrollView>
<Text style={styles.output}>Schritte:</Text>
{steps.map((step, index) => (
Expand All @@ -67,15 +66,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
29 changes: 25 additions & 4 deletions kryptolearn/screens/euclid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import {
SafeAreaView,
StyleSheet,
TextInput,
Button,
Text,
ScrollView,
StatusBar,
} from 'react-native';
import { Euclid } from '../algorithms';

Expand All @@ -25,7 +23,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 +41,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 +63,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
32 changes: 25 additions & 7 deletions kryptolearn/screens/extendedEuclid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import {
SafeAreaView,
StyleSheet,
TextInput,
Button,
Text,
ScrollView,
StatusBar,
} from 'react-native';
import { extendedEuclid } from '../algorithms';

Expand All @@ -24,7 +22,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 +40,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 +65,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

0 comments on commit 76e8286

Please sign in to comment.